I have been recently working on building a PDF Server to convert text files into PDF files with your product “Aspsose.pdf”. What I need to do is not just simple conversion but read every characters for cutomized fontstyles. Because of the demand to process a large amount of files in a limited time, I had tried many different methods to optimize the performance.
These are the methods I had used (Please inform me if I did anything wrong):
- Instead of reading each character as a TextSegment, I read several words as a TextFragment by some self-defined delimiters. I thought reducing the number of the components I used would eventually speed up a little.
- I found the OptimizeResources function was quite time-consuming, so I took away it. (Indeed it worked)
Here is a table I made to compare performances:
PerformanceComparison.png (13.3 KB)
I found that the most time-consuming part is the document.save() function. For example: a file with 89 pages took 7.7 sec to finish, whereas document.save() occupied 3/4 of the total spent time. Is it because the whole document was held in memory, and didn’t write to file until document.save()? In iTextSharp, it uses stream to write files directly. Is there any method like that?
Is there any chance I can make the performance as good as iTextSharp does or at least not differ too much?
Thank you very much!