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 Jul 22, 2015 12:28 pm

Hi team,

I tried to insert a custom page into second index of the pdf document.

single parametrized method working for me

Code: Select all
PdfDocument pdfdoc = new PdfDocument(pdfdocStream);
PdfPageBase page = pdfdoc.Pages.Insert(1);


Above code insert the new page as second page as expected.


But multiple parametrized method not working for me

Code: Select all
PdfDocument pdfdoc = new PdfDocument(pdfdocStream);
PdfNewPage pdfNewpage = new PdfNewPage();
PdfPageBase page = pdfdoc.Pages.Insert(1, pdfNewpage, pdfdoc.Pages[0].Section.PageSettings, false);


Above code always insert the new page at end of the document.


1. Is this an issue with Spire pdf or am I doing it wrong ?

2. I want to insert a page at second index(as second page) for different sized documents. Does spire for pdf has any option to do the same in a responsive way(Text should be resized with respect to document size) ?.

Suggestions are most welcome

Thanks,
Arun Chandran C

cArunChandran
 
Posts: 2
Joined: Wed Jul 22, 2015 8:54 am

Thu Jul 23, 2015 9:07 am

Hello,
Thanks for your inquiry.
1) Please change the "false" to "true".
Code: Select all
 PdfPageBase page = doc.Pages.Insert(1, pdfNewpage, doc.Pages[0].Section.PageSettings, true);

2)You can use below method. It will let text be resized with respect to document size.
Code: Select all
  PdfDocument pdf = new PdfDocument("test.pdf");     
            PdfDocument newPdf = new PdfDocument();
            foreach (PdfPageBase page in pdf.Pages)
            { PdfPageBase newPage = newPdf.Pages.Add(PdfPageSize.A1, new PdfMargins(0));
              PdfTextLayout loLayout = new PdfTextLayout();
              loLayout.Layout = PdfLayoutType.OnePage; page.CreateTemplate().Draw(newPage, new PointF(0, 0), loLayout); }
              newPdf.SaveToFile("Result.pdf");


Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Fri Jul 24, 2015 6:34 am

Hello,

Have you tried the code?
Has your issue been resolved?
Thanks for your feedback.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Fri Jul 24, 2015 1:17 pm

Hi Sweety,

Thanks for the replay .
I had tried the first code and working fine for me. But the folwing code not inserting page on first index(as second page)
Code: Select all
PdfPageBase page = pdfDoc1.Pages.Insert(1, pdfDoc1.PageSettings.Size, new Spire.Pdf.Graphics.PdfMargins(0));
PdfTextLayout loLayout = new PdfTextLayout();
loLayout.Layout = PdfLayoutType.OnePage;
pdfdoc2.Pages[0].CreateTemplate().Draw(page , new PointF(0, 0), loLayout);


can you help me on this ?

With Regards,
Arun Chandran C

cArunChandran
 
Posts: 2
Joined: Wed Jul 22, 2015 8:54 am

Mon Jul 27, 2015 3:22 am

Hello,

I have noticed your issue. And I have posted the issue to our dev team. We will inform you when it is fixed. Sorry for the inconvenience.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Tue Aug 18, 2015 9:23 am

Hello,

Sorry to keep you waiting.
The new version of Spire.Pdf( Spire.PDF Pack Version:3.5 ) solved your issue has been released. Please download it via link below and have a try.
http://www.e-iceblue.com/Download/download-pdf-for-net-now.html

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Aug 20, 2015 9:20 am

Hello,

Have you tried the Spire.PDF Pack Version:3.5?
Has your issue been resolved?
Thanks for your feedback.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.PDF