pcorless / icepdf

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

Printissiue in Version 7.1.2 ? Cant no print on anny Printer , only in PDF-Printer. #316

Closed groegner closed 11 months ago

groegner commented 12 months ago

Hello ,

i cant print in PDF-Viewer. On Errorlog i found this Message:

Exception in thread "Thread-5" java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "annotations" is null at org.icepdf.ri.common.print.PrintHelperImpl.print(PrintHelperImpl.java:186) at java.desktop/sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:2278) at java.desktop/sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1657) at java.desktop/sun.print.Win32PrintJob.printableJob(Win32PrintJob.java:519) at java.desktop/sun.print.Win32PrintJob.print(Win32PrintJob.java:392) at org.icepdf.ri.common.print.PrintHelperImpl.cancelablePrint(PrintHelperImpl.java:283) at org.icepdf.ri.common.print.PrinterTask.run(PrinterTask.java:63) at org.icepdf.ri.common.SwingController.startBackgroundPrinting(SwingController.java:4049) at org.icepdf.ri.common.SwingController.initialisePrinting(SwingController.java:3972) at org.icepdf.ri.common.SwingController.lambda$print$5(SwingController.java:3906) at java.base/java.lang.Thread.run(Thread.java:1623)

My Dokumentcall are here. Is also Standardviewer in Java 20. (Testfunction)

`private void openpdf(){ String filePath = "R:\JPPS-P\gesamt\FPR-385901-08.pdf";

// build a controller SwingController controller = new SwingController();

// Build a SwingViewFactory configured with the controller SwingViewBuilder factory = new SwingViewBuilder(controller);

// Use the factory to build a JPanel that is pre-configured //with a complete, active Viewer UI. JPanel viewerComponentPanel = factory.buildViewerPanel();

// add copy keyboard command ComponentKeyBinding.install(controller, viewerComponentPanel);

// add interactive mouse link annotation support via callback controller.getDocumentViewController().setAnnotationCallback( new org.icepdf.ri.common.MyAnnotationCallback( controller.getDocumentViewController()));

// Create a JFrame to display the panel in JFrame window = new JFrame("Using the Viewer Component"); window.getContentPane().add(viewerComponentPanel); window.pack(); window.setVisible(true);

// Open a PDF document to view controller.openDocument(filePath); }`

I can see on Printing-Dialog some Printers. I can use some Printers but i cant customize Printersettings on the Button in this View. When i click Print, there is no print on Hardware-Printers only in as Pdf-Printers.

Greatings Gerd

pcorless commented 12 months ago

Ugh. Just push a potential fix. If you have the ability to test this the branch please let me know if it resolves the issue.

pcorless commented 11 months ago

Marking as fixed will go out in the next release.