GrapheneOS / PdfViewer

Simple Android PDF viewer based on pdf.js and content providers. The app doesn't require any permissions. The PDF stream is fed into the sandboxed WebView without giving it access to content or files. CSP is used to enforce that the JavaScript and styling properties within the WebView are entirely static.
https://grapheneos.org/
MIT License
617 stars 99 forks source link

Issues displaying .PDF images which are placed inside PDF documents #55

Open den43 opened 4 years ago

den43 commented 4 years ago

Expected Behaviour:

The application should display images in the way described in the LaTeX document, e.g. centred

Actual Behaviour:

Images are displayed in the top left hand corner of the document.

How to reproduce:

  1. Create an image using Inkscape or Powerpoint and save it as a .pdf.
  2. Place image into a LaTeX document with appropriate alignment and justification and compile using pdfLaTeX.
  3. Open pdf document in Secure PDF viewer.
  4. .pdf images within the document are now displayed in top left hand corner.

Information:

App version: 3 OS: Android 10 (April 5, 2020 Security update) Device: Pixel 3a (stock)

Notes:

I believe this is related to something called "Page Groups", please see here: https://tex.stackexchange.com/questions/76273/multiple-pdfs-with-page-group-included-in-a-single-page-warning

This problem does not occur in other pdf document readers such as Adobe Reader or Microsoft Edge. I have attached the document for you to see the problem. Please open it in Secure PDF Viewer and any other pdf viewer to compare: document.pdf

thestinger commented 4 years ago

Updating the PDF rendering engine code may resolve this... but that may require a lot of work due to upstream issues that were encountered last time it was attempted.

thestinger commented 4 years ago

Please try with the latest release (version 6) which has updated pdf.js.

den43 commented 3 years ago

Please try with the latest release (version 6) which has updated pdf.js.

I joined the beta programme and tried with version 6 but the problem persists.

ghost commented 2 years ago

We're missing some CSS and/or JavaScript that solves this as other pdf.js PDF Viewers do not have this issue.

Bernstein76 commented 2 years ago

Possibly this not only applies to images but to annotations in general. If we create annotated pdfs in the ipados notes or goodnotes app the annotations shift to the upper left corner as well. Of course if you flatten the pdf they are displayed correctly. poc.pdf I have attached an example pdf demonstrating the behaviour. If correctly rendered, eg on firefox, the grid fills the whole page. In the GrapheneOS pdf viewer it fills roughly the upper left ninth of the page. Maybe this is related to the layout issue mentioned in #183 and/or the issue concerning multiple pages (groups) described in #133.

thestinger commented 2 years ago

Styling for annotations hasn't been implemented.