How to improve purePDF performance?

I am using the open source PurePDF library in a Flex AIR application. The problem is performance:

It takes 100% processor load and takes too long to create a PDF file.

  • I did some analysis on it and that pdf text letter is expensive. This is why I need to know how I can improve performance. Are there any fonts for which pdf generations are cheaper, or are there any tweaks or tips that can make this process a little better in terms of performance?

  • secondly, in the case of images, ImageElement generation is very expensive when writing this element to PDF. Is there a way to reduce processing?

At the same time, I found a way to reduce the processing of ImageElement generation by resizing the image using flex and then passing small bitmap data to the image element. It works great, and I have significantly reduced the execution time. Does anyone else have ideas on other issues?

  • Is there a way to let the PDF work in pieces or split the work in such a way that it may take longer to complete but will not block the GUI when creating the PDF file?

Please help - in advance.

+7
source share
2 answers

A way to optimize PDF generation with purePDF is to split the work of generating purePDF components into pieces, creating components from time to time, and the main problem is fixed by resizing the image

As the images take time to embed in the PDF, and the time spent on these processes is directly proportional to the size of the image.

So, first reduce the size of the image, and then paste it into the PDF (keep in mind if the sizes are reduced to a large scale, this will significantly reduce the quality of the image), continue to experiment to get the optimal size in order to have good enough quality and PDF generation speed.

The last thing to avoid transparent images, since they need more processing, use only transparency, if otherwise you need to use images with a white background.

0
source

is there any way to tell the pdf to work in chunks or to split the work in such a way that it may take longer to complete but not force the GUI to pause until the pdf is created

You can make the generation asynchronous by creating a thread ... The best way I came across is to do this in flash memory, is the code:

import flash.utils.setTimeout; import flash.events.Event; import flash.events.EventDispatcher; ... setTimeout(function():void { //TODO asynchronous schtuff dispatchEvent(new Event(Event.COMPLETE)); }, 0); 
0
source

All Articles