pcorless / icepdf

PDF Rendering and Viewing API in Java
Apache License 2.0
81 stars 21 forks source link

PDFs opened using TWO_PAGE_LEFT_VIEW renders pages inversed #279

Closed robingood closed 1 year ago

robingood commented 1 year ago

This issue affects ice pdf 7.1.0

When using ice pdf 7.0.0, everything works as expected

Issue : When loading any PDF File using by default the TWO_PAGE_LEFT_VIEW option, then all pages are inversed : even pages are on the left and odd pages are on the right. Also, please check the comments for the View Properties from DocumentViewControllerImpl, some are faulty (eg Displays the pages in two columns, with even-numbered pages on the left. is two times making it useless)

My Configuration :

this.pdfController = new SwingController(); this.pdfController.setIsEmbeddedComponent(true); // read/store the font cache. FontPropertiesManager.getInstance().loadOrReadSystemFonts(); ViewerPropertiesManager propertiesManager = getViewerPropertiesManager(); SwingViewBuilder swingViewBuilder = new SwingViewBuilder( this.pdfController, propertiesManager, myFont, false, 10, new float[]{1.0f, 1.25f, 1.5f, 1.75f, 2.0f, 3.0f, 5.0f}, DocumentViewControllerImpl.TWO_PAGE_LEFT_VIEW, DocumentViewController.PAGE_FIT_WINDOW_HEIGHT, 0); this.viewerPanel = swingViewBuilder.buildViewerPanel(); this.viewerPanel.revalidate();

ViewerPropertiesManager propertiesManager = ViewerPropertiesManager.getInstance(); propertiesManager.set(ViewerPropertiesManager.PROPERTY_SHOW_TOOLBAR_UTILITY, FALSE); propertiesManager.set(ViewerPropertiesManager.PROPERTY_SHOW_TOOLBAR_FIT, FALSE); propertiesManager.set(ViewerPropertiesManager.PROPERTY_SHOW_TOOLBAR_FULL_SCREEN, FALSE); propertiesManager.set(ViewerPropertiesManager.PROPERTY_SHOW_TOOLBAR_TOOL, FALSE); propertiesManager.set(ViewerPropertiesManager.PROPERTY_SHOW_TOOLBAR_SEARCH, FALSE); propertiesManager.set(ViewerPropertiesManager.PROPERTY_SHOW_TOOLBAR_ANNOTATION, FALSE); propertiesManager.set(ViewerPropertiesManager.PROPERTY_SHOW_TOOLBAR_ROTATE, FALSE); propertiesManager.set(ViewerPropertiesManager.PROPERTY_SHOW_TOOLBAR_FORMS, FALSE); propertiesManager.set(ViewerPropertiesManager.PROPERTY_SHOW_STATUSBAR, FALSE); propertiesManager.getPreferences().put(ViewerPropertiesManager.PROPERTY_ICON_DEFAULT_SIZE, Images.SIZE_LARGE);

pcorless commented 1 year ago

Darn, there was some big changes to the layout for 7.1.0. I'll get this touched up.

pcorless commented 1 year ago

I'm pretty usre I have this figured out. For some reason when I was creating the new layout classes I got a little confused with right to left writing styles. I have a little more testing to do but the attached branch should address your issue.

pcorless commented 1 year ago

Finished testing, merged change into master. Likely see these changes in 7.1.1 in the next week or so.

robingood commented 1 year ago

Finished testing, merged change into master. Likely see these changes in 7.1.1 in the next week or so.

Thank you for the quick fix!