Slow rendering with Linux OS

29 views
Skip to first unread message

girisatna girisatna

unread,
Jul 1, 2024, 1:35:46 AM7/1/24
to Flying Saucer Users
Hi,

I am using
<flying-saucer-pdf.version>9.1.22</flying-saucer-pdf.version>

and eclipse temurin 17 as JDK running in Ubuntu Linux.

In my code renderer.layout() takes long time (4-5mins) when the document contains slahed o(for ex o in 'udløber') of norwegian characters.

below is my similar code running in Linux. Thanks.

with the below code,we also use custom fonts html in .setDocumentFromString() method.

private void generateHtmlToPdf() throws Exception {
File inputHTML = new File(HTML_INPUT);
Document inputHtml = createWellFormedHtml(inputHTML);
File outputPdf = new File(PDF_OUTPUT);
xhtmlToPdf(inputHtml, outputPdf);
}

private Document createWellFormedHtml(File inputHTML) throws IOException {
String bytes = new String(Files.readAllBytes(inputHTML.toPath()), "UTF-8");
Document document = Jsoup.parse(bytes);
document.outputSettings()
.syntax(Document.OutputSettings.Syntax.xml);
// document.charset(Charset.forName("Cp1252"));
return document;
}

private void xhtmlToPdf(Document xhtml, File outputPdf) throws Exception {
try (OutputStream outputStream = new FileOutputStream(outputPdf)) {
ITextRenderer renderer = new ITextRenderer();
SharedContext sharedContext = renderer.getSharedContext();
sharedContext.setPrint(true);
sharedContext.setInteractive(false);
//sharedContext.setReplacedElementFactory(new CustomElementFactoryImpl());
renderer.setDocumentFromString(xhtml.html());
renderer.layout();
renderer.createPDF(outputStream);
}
}

Andrei Solntsev

unread,
Jul 8, 2024, 3:29:43 PM7/8/24
to flying-sa...@googlegroups.com
Hi Girisatna!
Why do you report an issue in a very old version of FlyingSaucer?

Please check if the problem exists in the latest FlyingSaucer 9.8.0.

NB! Anyway, you will need to create a reproducible example. Ideally, a simple github project with just one test. 

Because I cannot reproduce the problem: FS 9.1.22 generates a PDF with "udløber" word very quickly (300ms) on my machine.

Andrei Solntsev


пн, 1 июл. 2024 г. в 08:35, girisatna girisatna <ggiri...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Flying Saucer Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flying-saucer-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flying-saucer-users/d263c495-ebad-4b88-9194-d1a27a8da904n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages