izuzak / atom-pdf-view

Support for viewing PDF files in Atom.
https://atom.io/packages/pdf-view
MIT License
106 stars 30 forks source link

PDF.js Message: PDFDocument: stream must have data #209

Closed cani-venatici closed 6 years ago

cani-venatici commented 6 years ago

Working on a latex project using atom-latex and texlive2018

\documentclass[options]{extbook}
  \include{./preamble.tex}

\begin{document}
  \frontmatter
  \tableofcontents
\mainmatter
  \include{./chapter-1}
  \include{./chapter-2}
  \include{./...}
  \include{./chapter-14}
\end{document}
\chapter{}
  \section{}
    \subsection{}
      \input{./--/tables}
      \input{./--/figures}

After building the pdf for the whole book I tried to use \includeonly{chapter-1.tex} in line 3 of main.tex to recompile only one .tex subfile in the pdf (instead of the whole book) in order to save on compiling time. When I build the project atom-latex reports it built successfully while pdf-view pane reports this error:

An error occured while loading the PDF.

PDF.js v1.9.426 (build: 2558a58d)
Message: PDFDocument: stream must have data

Possibly a pdf-view issue?

PS: If it helps, I'm using \newcommand*\ExpandableInput[1]{\@@input#1 } in preamble.tex in order to \input tables and figures from within an \include{chapter-1}.

izuzak commented 6 years ago

Thanks for opening an issue, @carnage101. Can you share the generated PDF so that I can try reproducing the problem?

cani-venatici commented 6 years ago

Hi @izuzak . I can't share the PDF. I could set up dummy files in a documents structure similar to the one I'm using and share that, so that you can reproduce the issue. Would that work for you?

izuzak commented 6 years ago

Hi @izuzak . I can't share the PDF. I could set up dummy files in a documents structure similar to the one I'm using and share that, so that you can reproduce the issue. Would that work for you?

No, that wouldn't work for me. This package works with PDFs, not with latex files. So, you'd need provide a PDF that fails to load for you to demonstrate a problem (which I'd try to reproduce).

Why can't you share the PDF? It doesn't have to have any real content in it, feel free to replace all the content with lorem ipsum text if you'd like

cani-venatici commented 6 years ago

Alright I meant the same thing. I'll provide a dummy pdf that fails to load under the same conditions in a couple of minutes.

cani-venatici commented 6 years ago

issue209_main.zip

izuzak commented 6 years ago

Thanks. As far as I can tell, the PDF in that ZIP has 0 bytes and can't even be opened by MacOS preview or Chrome's PDF viewer. Are you able to open that PDF with some other PDF viewer?

cani-venatici commented 6 years ago

No, I can't either. After I build the project with \includeonly{chapterfilename} the pdf gets corrupted, I think, and it can't be open again. I would need to recompile it through latex without that command in order to read it properly. I posted the issue here seems latex reports the build was successful while pdf-view reports the PDF.js issue.

izuzak commented 6 years ago

Yeah, a 0-byte PDF definitely isn't something this package can open, and that's expected behavior. If you can provide a PDF that you can open with other PDF viewers but can't open with this package -- I'd be happy to take a look at this again! For now, I'm going to close this issue, but please let me know if I'm misunderstanding and you still believe there's a problem in this package.

cani-venatici commented 6 years ago

Yeah, no sorry if I wasted your time. The issue was in the syntax of \includeonly{chapterfilename} which would cause a code error and a blank pdf. Apparently TeX wiki reports the syntax for that command wrongly.....