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

Figures not rendered properly #129

Closed glentner closed 7 years ago

glentner commented 8 years ago

I think this might actually be an issue with PDF.js. My use case is a PDF compiled using pdflatex. pdf-view does not display the figures in the correct location or dimensions (and figure labels/captions are missing).

screenshot 2016-03-06 11 11 51
izuzak commented 8 years ago

Thanks for opening an issue, @glentner. Can you share the pdf in question? You should be able to attach it as a file in a comment here.

glentner commented 8 years ago

Here is a copy of the PDF (please disregard the content -- it is one of my lab reports from school). lentner_71010_c.pdf

izuzak commented 8 years ago

Thanks! Yep, I'm seeing that as well in atom-pdf-view, but not seeing it in the online demo of pdf.js. It might be that the version of pdf.js in atom-pdf-view needs to be updated, but it might be more complicated than that.

Not sure I'll have time to investigate this in the near future. If someone else wants to :mag_right: investigate :mag: and open a pull request to fix this -- I'd be happy to review that. :+1:

glentner commented 8 years ago

Thank you for confirming this. It's a pain that every other part of my workflow can stay in the Atom ecosystem, but not view my paper.

I would attempt to fix this myself, but I don't know the first thing about it.

izuzak commented 8 years ago

Yeah, I'm not sure what the problem is with that image -- images show up just fine for me in a bunch of other PDFs.

glentner commented 8 years ago

Just to provide additional information:

The PDF was made using pdflatex and the figure itself is also a PDF. The relevant source code is below, and that is within the two-column environment. I don't know how the graphics are encoded in PDF documents or how they get positioned, but it might have something to do with the way latex compiles the PDF.

\begin{figure*}[!b]
\captionsetup{width=0.8\textwidth}
\centering
\includegraphics[width=0.9\textwidth]{figures/energy-calibration}
\caption{The energy-calibration curve for the electrical system and the mixed
alpha source. In the bottom panel is the uncalibrated spectrum with channel
number on the horizontal axis and relative intensity on the virtical axis. The
side panel is the same as the bottom panel, but rotated and the corresponding
axis having energy (MeV). In the main panel, the calibration curve is shown
with a dashed, blue line. The diameter of the circles is proportional to the
FWHM of the fitted peaks. The shaded region shows the 1-$\sigma$ uncertainty in
the projection back to the lower energy peak (before identifying it as
$^{\textrm{148}}$Gd emission).}
\label{fig:calibration}
\end{figure*}
chbuschmann commented 8 years ago

I have a similar issue with a pdf that should (and indeed does in skim/preview/etc) render fullsize. pdf-view bug I can post the latex project if needed.

rben01 commented 8 years ago

I have the same problem as OP. Notably, pdf-view has no problem positioning PNGs; it only has trouble positioning PDFs. Might it be a problem specifically with typesetting vector graphics?

returntoreality commented 7 years ago

I have upgraded the pdf.js version in the pull request #154 and this fixes the Problem. Currently this causes the page counter to be stuck at 1.

izuzak commented 7 years ago

We merged the update for pdf.js so let me know if you can still reproduce this problem. :bow:

Note: you'll need to update to the latest version of the package, 0.51.0

glentner commented 7 years ago

I'm confirming that the figures and captions are now rendered properly with the latest version.