HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › A large number of html file covert to pdf issue
- This topic has 2 replies, 2 voices, and was last updated Sep 19, 2014
19:08:04 by PD4ML.
-
AuthorPosts
-
September 18, 2014 at 03:38#26950
Hello PD4ML!
I met issue when I coverting a lot of file to PDF .First running, it’s very quickly.but when I running again, you know ,it’s slowly.
my code is in the below
public class PD4MLUtil {
protected static int topValue = 10;
protected static int leftValue = 20;
protected static int rightValue = 10;
protected static int bottomValue = 10;
protected static int userSpaceWidth = 1300;/**
*
* @param in StringReader
* @param outputPath
* @throws InvalidParameterException
* @throws MalformedURLException
* @throws IOException
*/
public static void doConversion(StringReader s, String outputPath)
throws InvalidParameterException, MalformedURLException,
IOException {
File output = new File(outputPath);
FileOutputStream fos = new FileOutputStream(output);PD4ML pd4ml = new PD4ML();
pd4ml.setHtmlWidth(userSpaceWidth); // set frame width of
// “virtual web browser”// choose target paper format and “rotate” it to landscape
// orientation
pd4ml.setPageSize(pd4ml.changePageOrientation(PD4Constants.A4));// define PDF page margins
pd4ml.setPageInsetsMM(new Insets(topValue, leftValue, bottomValue,
rightValue));// source HTML document also may have margins, could be suppressed
// this way
// (PD4ML *Pro* feature):
pd4ml.addStyle(“BODY {margin: 0}”, true);pd4ml.enableDebugInfo();
// If built-in basic PDF fonts are not sufficient or
// if you need to output non-Latin texts,
// TTF embedding feature should help (PD4ML *Pro*)
pd4ml.useTTF(“java:fonts”, true);
pd4ml.setDefaultTTFs(“Times New Roman”, “Arial”, “Courier New”);
pd4ml.render(s, fos); // actual document conversion from URL
//System.out.println(outputPath + “ndone.”);
fos.close();
}}
my log in the below
2014-09-18 11:20:05,745 [INFO] ==== ekp_quartz_thread-pool-7-thread-3: com.landray.kmss.sys.lbpmgs.service.imp.SysPdfExecuteTempServiceImp.execute(52)
beginingversion: PD4ML 381fx2 Pro (eval)
loading CSS file file:/ekp/resource/style/common/jquery-ui/jquery.ui.css?s_cache=1411009156978
not yet in cache: file:/ekp/resource/style/common/jquery-ui/jquery.ui.css?s_cache=1411009156978
/ekp/resource/style/common/jquery-ui/jquery.ui.css (No such file or directory): file:/ekp/resource/style/common/jquery-ui/jquery.ui.css?s_cache=1411009156978
loading CSS file file:/ekp/sys/attachment/view/img/upload.css?s_cache=1411009156978
not yet in cache: file:/ekp/sys/attachment/view/img/upload.css?s_cache=1411009156978
/ekp/sys/attachment/view/img/upload.css (No such file or directory): file:/ekp/sys/attachment/view/img/upload.css?s_cache=1411009156978
loading CSS file file:/ekp/sys/attachment/js/popup.css
not yet in cache: file:/ekp/sys/attachment/js/popup.css
/ekp/sys/attachment/js/popup.css (No such file or directory): file:/ekp/sys/attachment/js/popup.css
done in 290587ms.
2014-09-18 11:24:56,333 [INFO] ==== ekp_quartz_thread-pool-7-thread-3: com.landray.kmss.sys.lbpmgs.service.imp.SysPdfExecuteTempServiceImp.execute(57)
endingyou see ! It’s over 4 minutes, but first running ,this file is only hundred of ms
so leading to the issue that if I‘m ignore something.
September 19, 2014 at 00:58#29576Hello PD4ML,can you give me any suggestion
September 19, 2014 at 19:08#29577Hmm… Usually 1st request takes some longer (as Java classes need init time etc), after that it should work quicker.
1. Make sure the application has enough heap size. A JVM parameter -Xmx512m usually works fine.
2. Try to run v391. It reports now latencies by a loading of external resources, so you’ll be able to locate a slow responding one (if any), or at least to exclude “network delay” as a problem reason.
-
AuthorPosts
The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.