OpenPDF icon indicating copy to clipboard operation
OpenPDF copied to clipboard

Not all PdfName properties are settable in PdfViewerPreferencesImp (eg. MediaBox)

Open tbessie opened this issue 3 years ago • 0 comments

Describe the bug I can't change all PdfName properties with PdfWriter.addViewerPreference()

To Reproduce Try something like this:

writer.addViewerPreference(PdfName.MEDIABOX, new PdfRectangle(PageSize.LETTER));

... observe that the resulting PDF does not have the MEDIABOX value set as per above. This is apparently because only a limited set of values is supported in PdfViewerPreferencesImp.java

Expected behavior The changed value of MEDIABOX is set in the resulting PDF.

Screenshots

System (please complete the following information): All / NA

Additional context Why are not all values settable in PdfViewerPreferencesImp.java? Is there some logical reason for it, or was it just that the developers didn't make this a priority?

Alternately, is this not considered a Viewer Preference, and this value should be set elsewhere? I have been searching around the code to see where this might be done. If there is a correct way to do this, can someone let me know? Thanks!

tbessie avatar May 27 '22 21:05 tbessie