Invalid page number

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for .NET (v4)  /  Invalid page number

DynamicPDF Merger for .NET (v4) Forum

 May 02 2007 6:27 AM
The code below works fine when I use a new page but when I use an imported page i get an invalid page number error on the last line of code. I am trying to use an existing page as a template then add new elements. Any help please this one is doing my nut.

PDFDocument = New Document

        PDFDocument.Sections.Begin()

        'Loop each page building the pdf file
        For Each Page

            Dim PDFPage As Page = New ImportedPage(TemplateLocation, 1)

            ' Create a Page and add it to the document
            PDFPage.Dimensions.Width = 750
            PDFPage.Dimensions.SetMargins(35, 10, 35, 0)
            PDFDocument.Pages.Add(PDFPage)

            'Add each element
            For Each Element

                PDFPage.Elements.Add(New Label(ElementName, Element.Xcord, Element.YCord, _
                                                Element.Width, Element.Height, Font.Helvetica, Element.FontSize))

            Next

            'Reset page
            PDFPage = Nothing
        Next

        PDFDocument.Draw(PDFNAME.pdf")
 May 02 2007 8:29 AM
Posted by a ceTe Software moderator
Hello,

Can you please make sure that you are using the latest build DLL files and see if it solves the problem or not.

Do you get an error when trying to add elements to an existing PDF template? If yes, can you please send over the PDF template and the code you are using to our Support Team and they can take a look at it?

Thanks,
ceTe Software Support Team
 Dec 04 2008 12:50 PM
I am having the same issue when using the following code:

*Note:  m_PDF is a MergeDocument object.

[CODE]
PdfDocument template = new PdfDocument(m_DocumentPath);

            foreach (DataRow row in m_DataTable.Rows)
            {
                ImportedPage page = new ImportedPage(template.Pages[0]);
                
                // Add elements to page
                Label lblDate = new Label(DateTime.Now.ToString("MM/dd/yyyy"), 90, 134, 300, 20, FontFamily.Times.Regular, 12);
                page.Elements.Add(lblDate);
                

                // Add page to merge document
                m_PDF.Pages.Add(page);

                // Nullify page
                page = null;
            }


I am using the following build: 5.0.1.20 (Build 10926)

Thanks!

Matt
 Dec 04 2008 1:17 PM
Posted by a ceTe Software moderator
Hello Matt,

Can you please make sure that you are using the latest build DLL files and see if it solves the problem or not?

If the problem continues to occur using the latest DLL files, please send over the PDF template you are using to our Support Team and they can take a look at it?

Thanks,
ceTe Software Support Team
 Dec 04 2008 1:18 PM
I believe I just found the problem.  I had a tiny checkbox (form field) in my document template.  When I removed that the error went away.

Thanks!

Matt

All times are US Eastern Standard time. The time now is 3:34 AM.