Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting java.lang.UnsupportedOperationException at org.apache.pdfbox.pdmodel.graphics.color.PDPattern.toRGB #31

Open
aino-vedang opened this issue Sep 18, 2018 · 3 comments

Comments

@aino-vedang
Copy link

aino-vedang commented Sep 18, 2018

I am using Pdf2Dom to parse pdf document. In my java application when I tried to convert a PDF file to html. I am getting,

java.lang.UnsupportedOperationException
at org.apache.pdfbox.pdmodel.graphics.color.PDPattern.toRGB(PDPattern.java:95)
at org.fit.pdfdom.PathDrawer.pdfColorToColor(PathDrawer.java:133)
at org.fit.pdfdom.PathDrawer.clearPathGraphics(PathDrawer.java:79)
at org.fit.pdfdom.PathDrawer.drawPath(PathDrawer.java:59)
at org.fit.pdfdom.PDFDomTree.createPathImage(PDFDomTree.java:403)
at org.fit.pdfdom.PDFDomTree.renderPath(PDFDomTree.java:251)
at org.fit.pdfdom.PDFBoxTree.processOperator(PDFBoxTree.java:499)
at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:477)
at org.apache.pdfbox.contentstream.PDFStreamEngine.showForm(PDFStreamEngine.java:181)
at org.apache.pdfbox.contentstream.operator.DrawObject.process(DrawObject.java:65)
at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848)
at org.fit.pdfdom.PDFBoxTree.processOperator(PDFBoxTree.java:542)
at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503)
at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:477)
at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:150)
at org.apache.pdfbox.text.LegacyPDFStreamEngine.processPage(LegacyPDFStreamEngine.java:139)
at org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:391)
at org.fit.pdfdom.PDFBoxTree.processPage(PDFBoxTree.java:208)
at org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:319)
at org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:266)
at org.fit.pdfdom.PDFDomTree.createDOM(PDFDomTree.java:218)
at com.demo.pdf.converter.PdfProcessor.convertToHtml(PdfProcessor.java:87)

@THausherr
Copy link

I suspect this is a bug in PDF2Dom, a pattern in a PDF can't be converted to an RGB color. (Think about it - e.g. a dots pattern isn't one RGB color, it is a vector graphics instruction).

To see how patterns are treated in PDFBox, see PageDrawer.getPaint().

More files with patterns can be found here:
https://issues.apache.org/jira/browse/PDFBOX-1094

@aino-gautam
Copy link

@aino-vedang pdf2dom internally uses pdfbox and not the other way around as you mentioned. Did you find a solution yet ?

And seems @THausherr is correct in his quote that the issue lies in pdf2dom.

@aino-vedang
Copy link
Author

@aino-gautam I realised that issue is in pdf2dom library and just now I have updated the question. But I haven't found solution for it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants