HTML to PDF / DOCX / RTF Java converter library Forums PD4ML Forums Technical questions / Troubleshooting Issue Adding PNG Image to PDF – AccessControlException Due to System.setErr

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #39848

    Hi Support,

    I’m encountering an issue when attempting to add a PNG image to a PDF using PD4ML. The same code works without any issues when using JPG images. However, when using PNGs, I receive a java.security.AccessControlException, specifically related to the use of System.setErr. It seems that during PNG image processing, PD4ML attempts to redirect System.err, which is blocked by our Java security manager.

    Below is the relevant exception trace:

    java.security.AccessControlException: Access denied ("java.lang.RuntimePermission" "setIO") at java.base/java.security.AccessController.throwACE(Unknown Source) at java.base/java.security.AccessController.checkPermission(Unknown Source) ... at java.base/java.lang.System.setErr(Unknown Source) at com.pd4ml.css.util.d.o00000(y:3477) at com.pd4ml.cache.img.d.super(y:2531) ... at com.pd4ml.PD4ML.writePDF(y:3447)

    This is likely due to internal PNG image handling in PD4ML triggering a call to System.setErr, which our environment restricts for security reasons.

    Can you confirm whether this is expected behavior when handling PNGs? If so, is there a workaround or configuration option to prevent PD4ML from attempting to reset System.err, or a way to process PNGs without triggering this permission?

    I have also attached the image (it was generated by ChatGTP as far as I recall).

    Thank you,
    Dmytro

    Attachments:
    You must be logged in to view attached files.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.