ClassCastException in parseDescendantFont
unchecked cast in descendantFont = (CompositeFont) library.getObject(descendantFontReference); produces a ClassCastException if object is a FontDescriptor. Handling for a FontDescriptor should be added
Can you post a sample file or post the stack trace?
I can add a fix to avoid the class cast issue but without a sample I won't be able to piece together if the FontDescriptor should be searched for an embedded file.
this is the stactrace we get:
java.lang.ClassCastException: class org.icepdf.core.pobjects.fonts.FontDescriptor cannot be cast to class org.icepdf.core.pobjects.fonts.zfont.CompositeFont (org.icepdf.core.pobjects.fonts.FontDescriptor and org.icepdf.core.pobjects.fonts.zfont.CompositeFont are in module [email protected] of loader 'app')
at [email protected]/org.icepdf.core.pobjects.fonts.zfont.Type0Font.parseDescendantFont(Type0Font.java:76)
at [email protected]/org.icepdf.core.pobjects.fonts.zfont.Type0Font.init(Type0Font.java:38)
at [email protected]/org.icepdf.core.pobjects.Resources.getFont(Resources.java:171)
at [email protected]/org.icepdf.core.util.parser.content.AbstractContentParser.consume_Tf(AbstractContentParser.java:820)
at [email protected]/org.icepdf.core.util.parser.content.ContentParser.parseText(ContentParser.java:743)
at [email protected]/org.icepdf.core.util.parser.content.ContentParser.parse(ContentParser.java:149)
at [email protected]/org.icepdf.core.pobjects.Page.init(Page.java:441)
at [email protected]/org.icepdf.core.pobjects.Page.init(Page.java:381)
at [email protected]/org.icepdf.ri.common.views.AbstractPageViewComponent$PageImageCaptureTask.call(AbstractPageViewComponent.java:412)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
I'll try to provide a sample-pdf. The one i've got right now contains personal data, so I have to modify it. Additionally I could create a pull request with a change fixing the error
There is the redaction and edit text feature on the main branch (right click on text with the text tool selected). Might work well in this instance, just make sure to export the document, not save as.
Committed a fix, marking as done.