Best design to create a document
Hi all,
I am creating a PDF document from scratch with the Adobe SDK Library. My first version of the code is working but I would like to improve the speed of the algorithm.
Here is the initial workflow :
1 - Create a new empty document via
* PDDocCreate
* PDDocCreatePage
* PDDocSave
2 - For each text element to add
* PDDocOpen
* PDDocAquirePage
* PDPageAcquirePDEContent
* PDEContentAddElem
* PDPageSetPDEContent
* PDDocSave
As I said, this process works fine but it's not efficient because each time we open and save the same file. So my second thought was to do :
1 - Create a new empty document via
* PDDocCreate
* PDDocCreatePage
* PDDocSave
* return pdDoc
2 - For each text element to add, using the already known pdDoc
* PDDocOpen
* PDDocAquirePage
* PDPageAcquirePDEContent
* PDEContentAddElem
* PDPageSetPDEContent
* PDDocSave
In this way it seems to be two times faster. It is great but I would like to know if it is possible to avoid the PDDocSave and doing it only one time at the end. Here is the Idea :
1 - Create a new empty document via
* PDDocCreate
* PDDocCreatePage
* PDDocAquirePage
* PDPageAcquirePDEContent
* PDDocSave
* return pdeContent
2 - For each text element to add, using the already known pdeContent
* PDDocOpen
* PDDocAquirePage
* PDPageAcquirePDEContent
* PDEContentAddElem
* PDPageSetPDEContent
* PDDocSave
3 - Save the Document
* ???
The Question are :
- How can I deal with the multiple page ? Is PDEContentAddPage the answer ?
- I think I could use PDPageSetPDEContent to send the pdeContent to a pdPage but what is the pdDoc for PDDocSave ? How could I set it with pdPage ?
Thank you in advance for your help.
