itext / i7j-rups

RUPS is an acronym for Reading and Updating PDF Syntax. RUPS is a tool built on top of iText® that allows you to look inside a PDF document and browse the different PDF objects and content streams.
Other
279 stars 36 forks source link

Can't save anything to a file #147

Open lokman2k5 opened 1 day ago

lokman2k5 commented 1 day ago

Describe the bug I get Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: class com.itextpdf.kernel.pdf.PdfIndirectReference cannot be cast to class com.itextpdf.kernel.pdf.PdfStream (com.itextpdf.kernel.pdf.PdfIndirectReference and com.itextpdf.kernel.pdf.PdfStream are in unnamed module of loader 'app') at com.itextpdf.rups.view.contextmenu.SaveToFilePdfTreeAction$1.run(SaveToFilePdfTreeAction.java:97) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) Whenever I try 'save to file' or 'save raw bytes to file'

I am on Fedora 40, java --version: openjdk 21.0.4 2024-07-16 OpenJDK Runtime Environment (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7) OpenJDK 64-Bit Server VM (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7, mixed mode, sharing)

Eswcvlad commented 1 day ago

Is this on the 7.2.5 version or on the develop branch version?

As of 7.2.5 you can only save PDF streams, and everything else throws an exception like this... It looks like you were trying to save a "reference" node, not a stream.

On the develop branch version this should be fixed and it should gray-out the option, if it doesn't support saving a particular node. And it also should allow to save PDF strings.