beatngu13 / pdf-zoom-wizard

Lightweight and cross-platform tool for PDF bookmarks and links zoom settings
GNU General Public License v3.0
69 stars 4 forks source link

PDF version 1.5 yields RuntimeException #483

Open beatngu13 opened 9 months ago

beatngu13 commented 9 months ago

Expected Behavior

This PDF can be modified to set its bookmarks to "Fit width".

Actual Behavior

A RuntimeException is thrown:

java.lang.RuntimeException: Invalid PDF version format: '^(\d+)\.(\d+)$' pattern expected.
    at org.pdfclown.Version.get(Version.java:72)
    at org.pdfclown.Version.get(Version.java:62)
    at org.pdfclown.documents.Document.getVersion(Document.java:539)
    at org.pdfclown.objects.PdfObjectWrapper.checkCompatibility(PdfObjectWrapper.java:358)
    at org.pdfclown.documents.Document.access$1(Document.java:1)
    at org.pdfclown.documents.Document$Configuration.setXrefMode(Document.java:166)
    at org.pdfclown.files.File.<init>(File.java:192)
    at org.pdfclown.files.File.<init>(File.java:171)
    at com.github.beatngu13.pdfzoomwizard.core.Wizard.modifyFile(Wizard.java:132)

Steps to Reproduce

If possible, please provide a sample PDF and describe the steps to reproduce the behavior:

  1. Select the aforementioned PDF
  2. Uncheck "Copy"
  3. Select "Fit width"
  4. Click on "Run"
  5. "Success" is reported, although the PDF is not modified
  6. The log file shows a RuntimeException is thrown

Debugging shows that the PDF version 1.5 is converted to 1#2E5, which yields the exception in org.pdfclown.Version.

Log

log.txt

Environment

beatngu13 commented 9 months ago

@idsks555 while I'm further investigating the underlying issue, here's the converted PDF (fit width):

Old_._New_Testament-FIT-WIDTH.pdf