I have a small Java utility that is run from the command line and converts a folder of SVGs into a PDF. The utility uses Apache FOP to do the conversion. I am not a Java expert and so hired someone to write this utility for me. It works correctly, but is VERY slow. It takes at least 7-8 seconds to run for a single page, and multi-page PDFs take 15-30 seconds. I have attached the source file as well as an archive representing the "typical" input folder. I am calling the utility as follows:
java -jar /var/www/helper_code/[login to view URL] /var/www/helper_code/pdf_staging/73898/10333/master*.svg /var/www/helper_code/pdf_staging/73898/10333/[login to view URL]
I am looking for someone that can optimize this utility for me so that it runs more quickly. Ideally I would like it to run in less than 5 seconds.
Hi,
There's only so much you can do to optimize this code. It just takes a lot of resources to read through and change all the files since it has to make copies of everything as it goes. I can rearrange some of the script so that it's not recreating all the objects for every page. That should speed it up a bit.
Thanks,
Derek