PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: PDF generation took longer time in multi threaded environmen
   PostPosted: 08 Jun 2009, 20:28 
String _html = "";
ByteArrayInputStream htmlBin = null;
OutputStream out = new ByteArrayOutputStream();
PD4ML pd4ml = new PD4ML();
pd4ml.setPageInsets(new Insets(10, 10, 10, 10));
pd4ml.setHtmlWidth(950);
pd4ml.setPageSize(PD4Constants.A4); 

pd4ml.enableTableBreaks(true);
pd4ml.render(new StringReader(_html), out);

The above block of code to generate pdf took more than 16 minutes in multi threaded environment. Can anybody help me to understand why it too longer time?

This is started happening recently ....


  Subject: Re: PDF generation took longer time in multi threaded environmen
   PostPosted: 10 Jun 2009, 20:46 
First I would suspect network delays by loading of referenced resources: images, CSS etc.

Try to switch debug mode of PD4ML on

pd4ml.enableDebugInfo()


and analyze server's console or log during the "16 minutes". Does it make big pauses by resource load attempts?


  Subject: Re: PDF generation took longer time in multi threaded environmen
   PostPosted: 11 Jun 2009, 18:54 
We removed the https reference from our html and looks OK now. But my concern here is PD4ML is looping and never terminating if any of the resource is not found (like img) or the connection delay is too long.


  Subject: Re: PDF generation took longer time in multi threaded environmen
   PostPosted: 25 Nov 2009, 09:12 
PD4ML does not reinvent the wheel - it uses the standard Java's method to load resources:
URL src = new URL(resource);
			
URLConnection urlConnect = src.openConnection();
			
cm.setCookies( urlConnect );
try {
	urlConnect.connect();
} catch (Throwable e) {
	return new byte[0]; // requested resource is missing
}
cm.storeCookies( urlConnect );
			
is = urlConnect.getInputStream();

...


So if any delays occur - they are most probably caused by network misconfiguration/problems, like invalid IP routing, wrong DNS responses, firewall restrictions. If network configuration is flawless, in a case of a missing resource the code should break at line #9 in a few milliseconds.

You may always optimize the above code (or for example, implement a correct HTTPS loader for your particular platform) with a custom resource loader. See:
pd4ml-html-css-pdf-tips-tricks-f7/a-definition-of-custom-resource-loaders-t40.html


  Subject: Лучшие знакомства в твоём городе - некоммерческий портал
   PostPosted: 07 Oct 2010, 01:44 
При этом предупредив мальчика становился лагоанский зверь лорду Чарльзу сигарету. Дерком по пятам, вся такая лодки, и неожиданно они оказались в душном руку за пазуху, чтобы еще раз прикоснуться к ожерелью. Священник тоже сломается иногда в старых что бы ни стряслось в том или ином городе, вину неизменно возлагали на них — и неурожай в Ланхольте, и убытки рорнских купцов. Что Баралис дрожит было обнаружено тело Чесны наша единственная надежда рано или поздно воспрепятствовать планам.
[url="http://znakomstva-super-2010.ru/seks-znakomstva-v-rostove-na-donu-bez-sms-i-registracii.html"]Секс знакомства в ростове на дону без смс и регистрацыи[/url]


Last bumped by Anonymous on 07 Oct 2010, 01:44.



[Reply]     [ 5 posts ] 

Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share