Hello there,
Our system works with PDF package eg. 10 pages, and try to extract 1 or more of these pages based on business rule and puts them together to a new PDF-file.
Since remove() method is no longer supported,
In my application I create a new MergeDocument - mDocNew, and add only the necessary pages from the original MergeDocument - mDocOriginal. I get the "Invalid Page Number" errors when I try to run the statement "mDocNew.Draw(stream);";
Simple example:
MergeDocument mDocNew = new MergeDocument();
foreach (Page item in mDocOriginal.Pages)
{
if (isNecessaryPage)
{
mDocNew.Pages.Add(item);
}
}
mDocNew.Draw(stream); //"Invalid Page Number"
Where is the mistake?
the stack trace is shown as below:
ceTe.DynamicPDF.GeneratorException: Invalid page number.
at zz93.dd.GetPageObject(Int32 pageNumber)
at zz93.d3.DrawDictionary(DocumentWriter writer)
at ceTe.DynamicPDF.Forms.FormField.Draw(DocumentWriter writer)
at ceTe.DynamicPDF.IO.DocumentResourceList.b(DocumentWriter A_0)
at zz93.dd.Draw()
at ceTe.DynamicPDF.Document.Draw(Stream stream)
at EnfoTech.BizModule.EP.Engine.PDFGenerator.GeneratePDF(Stream stream, XmlNode mapper, XmlNode node, Hashtable ht)
at EnSuite.Permit.UI.Util.AppUtil.GeneratePDF(SubmissionForm subFormObj, Form formObj, Hashtable imageHT)