Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Apr 15, 2015 5:02 pm

Hi,

I've been trying to use a master pdf file to create a document adding pages dynamically but when I add pages, there seems to be a margin on top of my document's first page. (see image)

Let me know what I'm doing wrong...

Code: Select all
public void AppendPage ( int sourcePageIndex ) {
            if ( _baseDocument.Pages[ sourcePageIndex ] == null ) {
                throw new Exception( "Unable to add page index " + sourcePageIndex );
            }

            var basePage = _baseDocument.Pages[ sourcePageIndex ];
            var currentSize = basePage.Size;
            var template = basePage.CreateTemplate();

            template.Draw( _document.Pages.Add( currentSize, new PdfMargins( 0 ) ), 0, 0 );
            /*
            var newPage = _document.Pages.Add( currentSize, new PdfMargins( 0 ) );
            newPage.Canvas.DrawTemplate( template, new PointF( 0, 0 ) );
             */
        }



Thank you!

spaquet
 
Posts: 1
Joined: Wed Apr 15, 2015 4:58 pm

Thu Apr 16, 2015 2:44 am

Dear Simon Paquet,

Thanks for your inquiry.
Your code is good. To help us reproduce your issue and resolve it soon, please provide us your pdf document. You also send document via e-mail to amy.zhao@e-iceblue.com or support@e-iceblue.com.

Thanks & Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF