I try to generate a lot of pdf (more than 15000 for invoicing).
My program must be really performant, not more than 40min per 15000.
So, here how i’m doing for now :
- 3 xmls templates : 1 for the first page (client info + terms of sale), 1 for invoice summary, 1 for details
For each invoice,
- create an Aspose.Pdf.Generator.Pdf object and load first page (xml template) -> Pdf1
- Bind data in Pdf1
- create an Aspose.Pdf.Generator.Pdf object and load invoice summary (xml template) -> Pdf2
- Bind data in Pdf2
- Insert the Pdf2 's first section (single) into the end of Pdf1 sections
- create an Aspose.Pdf.Generator.Pdf object and load invoice details (xml template) -> Pdf3
- Bind data in Pdf3
- Insert the Pdf3 's first section (single) into the end of Pdf1 sections
- Save Pdf1 (final pdf)
I’m not really sure that’s the best way (result more than 2h per 15000), so I tried to create a single Pdf with multiple Sections (for page break) but it was the same. I also tried to save every part and finally concatenate them but it was worse.
So, do you know a better way ?
Second question, is it possible to Clone an Aspose.Pdf.Generator.Pdf object?
ps: I didn’t try to use xslt
Thanks for your inquiry. Aspose.Pdf for .NET supports msultithreaded environment so we would suggest you to please try using it. One Pdf document should be dealt in one thread, as access to a single document from several threads is not supported by Aspose products. Secondly, You may save the individual Pdf files into Stream objects and then concatenate the Pdf files. For further details, please check following documentation link for the details. Hopefully concatenating Pdf documents will help to improve performance.
Moreover, I’m afraid Aspose.Pdf don’t have the feature of cloning Aspose.Pdf.Generator.pdf object.
Please feel free to contact us for any further assistance.