Search code examples
macosnullpointerexceptionitextfreemarkerflying-saucer

flying saucer PDF generation with Image will it work on linux server?


I'm able to generate the pdf with images using custom implementation of RelacementElementFactory from xhtml template using Freemarker.

But I got an error when my system screen was off, hence pdf didn't generated.

Caused by: java.lang.NullPointerException
    at sun.lwawt.macosx.LWCToolkit.getScreenResolution(LWCToolkit.java:356)
    at org.xhtmlrenderer.layout.SharedContext.<init>(SharedContext.java:110)
    at org.xhtmlrenderer.pdf.ITextRenderer.<init>(ITextRenderer.java:111)
    at org.xhtmlrenderer.pdf.ITextRenderer.<init>(ITextRenderer.java:102)

Why this happened...? [NOTE: I'm using OS X Yosemite Version 10.10.4]

I have failed to reproduced this by running several time my server when system screen is locked and not displaying anything.

Will it impact on other OS machines(like linux machine server) ...? or is this MAC OS related only and does not impact on other machines.


Solution

    • As mentioned in the question issue was not reproducible.
    • Since question was to know flying saucer PDF generation with Image will it work on linux server?

    Answer is yes it is working without any issue.