We have a program that reads an existing PDF from disc. That PDF tempalte contains text and form elements and converts it to a PDF/A document. We draw some text to the position where the form elements are positioned and then we delete the form elements. Then we do a PdfDocument.Merge(destPdfADoc, sourcePdfLoadedDoc) to merge the the PDF template with a PDF/A document. And that works great! The problem occurs when the text has dynamic length and it won’t fit into the available area.
Thank you for using syncfusion products,
It is possible to “Extend the number of pages to fit the content”, for this you need to set PdfLayout type as Paginate, this will extend the pages until your content is fit. I have attached a simple sample regarding this in the below link, please check it.
For your another query about “Need to detect when the content doesn’t fit available area”, I have attached a simple sample, here we can get the bounds of the text after drawn in the page by using PdfTextElement class. By comparing the bounds of the text with page bounds we can able to detect whether the content will be fit into it. Can you please check with this and let me know if these helps.
Thank you for your patience,
Yes, It is possible to Merge “sourceLoadedDocument to the destLoadedDocument”, I have attached a simple sample regarding this, can you please check with this and let us know if these helps.
And for your query regarding “Exception occurs while trying to Merge Loaded documents”, can you please provide us the code snippet which causes the exception, this will help us to provide better solution.