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

ClassCastException: org.xhtmlrenderer.render.BlockBox cannot be cast to org.xhtmlrenderer.newtable.TableBox #28

Open
tazmaniax opened this issue Feb 1, 2013 · 2 comments

Comments

@tazmaniax
Copy link

Hi Nicolas,

I'm experiencing the following exception when trying to render a PDF:
play.exceptions.UnexpectedException: Unexpected Error
at play.modules.pdf.RenderPDFTemplate.apply(RenderPDFTemplate.java:102)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:252)
at Invocation.HTTP Request(Play!)
Caused by: org.allcolor.yahp.converter.IHtmlToPdfTransformer$CConvertException: ERROR: An unhandled exception occured: org.xhtmlrenderer.render.BlockBox cannot be cast to org.xhtmlrenderer.newtable.TableBox
at org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer.transform(CHtmlToPdfFlyingSaucerTransformer.java:809)
at play.modules.pdf.RenderPDFTemplate.renderDoc(RenderPDFTemplate.java:142)
at play.modules.pdf.RenderPDFTemplate.renderPDF(RenderPDFTemplate.java:118)
at play.modules.pdf.RenderPDFTemplate.apply(RenderPDFTemplate.java:100)
... 2 more
Caused by: java.lang.ClassCastException: org.xhtmlrenderer.render.BlockBox cannot be cast to org.xhtmlrenderer.newtable.TableBox
at org.xhtmlrenderer.layout.BoxCollector.collect(BoxCollector.java:127)
at org.xhtmlrenderer.layout.BoxCollector.collect(BoxCollector.java:139)
at org.xhtmlrenderer.layout.BoxCollector.collect(BoxCollector.java:139)
at org.xhtmlrenderer.layout.BoxCollector.collect(BoxCollector.java:139)
at org.xhtmlrenderer.layout.BoxCollector.collect(BoxCollector.java:139)
at org.xhtmlrenderer.layout.BoxCollector.collect(BoxCollector.java:46)
at org.xhtmlrenderer.layout.Layer.paint(Layer.java:314)
at org.xhtmlrenderer.pdf.ITextRenderer.paintPage(ITextRenderer.java:391)
at org.xhtmlrenderer.pdf.ITextRenderer.writePDF(ITextRenderer.java:355)
at org.xhtmlrenderer.pdf.ITextRenderer.createPDF(ITextRenderer.java:322)
at org.xhtmlrenderer.pdf.ITextRenderer.createPDF(ITextRenderer.java:287)
at org.allcolor.yahp.cl.converter.CHtmlToPdfFlyingSaucerTransformer.transform(CHtmlToPdfFlyingSaucerTransformer.java:790)
... 5 more

I believe this issue is more to do with the Flying Saucer transformer then the play-pdf plugin. In fact I think it is this issue which is fixed by this pull request. I'm trying to work out how I get this fix all the way back in to my play app. Is it the case that the Flying Saucer transformer is included via the YaHP project? So will I have to update and build Flying Saucer, then YaHP and then play-pdf? Any assistance appreciated.

cheers,
Chris

@jayhawk
Copy link

jayhawk commented Nov 27, 2013

Hi @tazmaniax

did you find a way to fix this issue? I'm also encountering this issue. I tried updating the 3rd party libs but it doesn't work.

@lanceon
Copy link

lanceon commented Mar 17, 2014

This fix philcali/flyingsaucer@e653850 with rebuilt jar actually solves the problem.

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