Hey All,
I'm trying to do something a little more advanced with EO.Pdf, and I'm not 100% sure if it's possible.
Basically, my ASP.net site is dynamically generating a PDF. Each page of that PDF wants to have a copy of a page from another PDF at about 90% scale (enough room to throw in a header).
Leaving aside the scaling for the moment, I tried getting the PdfContentCollection from each page and copying the content piece by piece into my new page. This would throw a Form Fields must be named error if the source PDF had fields OR would throw a "The object already has an owner. Please use a clone of the object instead." error if it didn't run into any form fields.
Code: C#
PdfDocument doc = new PdfDocument(HttpContext.Current.Server.MapPath("~/test.pdf"));
PdfContentCollection contentCollection = doc.Clone().Pages.First().Contents;
foreach (PdfContent content in contentCollection)
{
newPage.Contents.Add(content);
}
Does anyone have any thoughts on if this is possible - or why I am still getting a "owner / clone" error when I've cloned the document? Is there another approach I should try?
Thanks!