HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML Forums › Technical questions / Troubleshooting › Slow initial PDF generation
- This topic has 5 replies, 2 voices, and was last updated Feb 18, 2025
01:37:37 byPD4ML.
-
AuthorPosts
-
February 17, 2025 at 15:28#39144
Hi, we purchased a new license recently and I am upgrading from a much older version as part of our upgrade to Java 17. Now using ‘com.pd4ml:pd4ml:4.1.0-SNAPSHOT’. It generates the PDF without any code changes, but for some reason the first time it runs it can take 2 minutes to generate. Once that happens all subsequent generations of that report OR other reports are near instant. Do you know what could cause this situation? What would be the best way to go about debugging it? It only happens on our test server and not in my local environment.
February 17, 2025 at 15:39#39145Hi! A possible explanation is that the source HTML has unavailable external links and it waits until the socket times out. Once the resource is marked as unavailable in the PD4ML cache, it no longer tries to download.
But it is only a guess. More input needed too find out the real cause of the problem.
As a first step, try enabling logging and look at the STDOUT output of PD4ML – this will allow you to see which phase the delay is occurring in.
February 17, 2025 at 16:00#39146how do I enable logging? I tried adding the below and see no output
logging.level.com.pd4ml=DEBUG
logging.level.org.zefer=DEBUGFebruary 17, 2025 at 16:03#39147Try the API call
pd4ml.setLogLevel(255)
February 17, 2025 at 23:01#39151My last message doesn’t seem to have posted when looking from my end so I apologize if this is a duplicate. There does seem to be an error getting a css file, but it isn’t really external. It is served up by the same server that is generating the PDF. See attached. I can access the file fine when I navigate to it in a browser
February 18, 2025 at 01:37#39152Typical situation: the server only knows its own human-unfriendly corporate network name. But you access this server under a human-readable server alias, configured somewhere with your proxy, in the client DNS server, IP settings, in the user profile, etc.
So your browser can resolve this alias to an IP, but the server (and the applications running on it) cannot. It cannot connect to itself due to insufficient DNS configuration.
This may not be your case, but you can check if you log in to the server and try to ping it by the problematic DNS name or try to load the CSS URL from there.
As an experiment, try to replace the server name in the CSS URL with the server IP address or with 127.0.0.1. You can also add the DNS name to server’s
hosts
file -
AuthorPosts
You must be logged in to reply to this topic.