Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Create multiple pages using same qp.LoadFromFile |
Post Reply
|
| Author | |
Halv
Beginner
Joined: 17 Sep 12 Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Topic: Create multiple pages using same qp.LoadFromFilePosted: 25 Sep 12 at 1:47AM |
|
Greetings,
Alright I have another question again. I am trying to create multiple pages of the same PDF file. I am trying to use qp.NewPage and use the same PDF file I'm loading with qp.LoadFromFile to appear in the new page as well, but so far it only appears in the first page, while the second page and so on is a blank page. If anyone has any tips on how I could get the qp.LoadFromFile to appear in every page I'd appreciate it a lot. Halv
|
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 25 Sep 12 at 2:24AM |
|
Here some code to copy a single page PDF and create a pdf with 20 copies of page 1. You may also want to look at ClonePages in the Refererence guide. Also, a very good place to get up to speed with the library is to read the PDF Developer Guide PDF that is in the Quick PDF installation folder. It will help explain how this code works. QP.LoadFromFile("1page.pdf"); double pw = QP.PageWidth(); double ph = QP.PageHeight(); QP.NewPage(); // Add a 2nd blank page and selects it as the current page. int id = QP.CapturePage(1); // Capture the contents of page 1. for (int i = 1;i<=20;i++) { if (i != 1) QP.NewPage(); // add an extra new page. We already have page 1. QP.SelectPage(i); QP.SetOrigin(1); QP.SetPageDimensions(pw, ph); QP.DrawCapturedPage(id, 0, 0, pw, ph); // Draw the captured page on to each page. } QP.SaveToFile("20pages.pdf"); Andrew.
Edited by AndrewC - 26 Sep 12 at 2:19AM |
|
![]() |
|
Halv
Beginner
Joined: 17 Sep 12 Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Posted: 26 Sep 12 at 1:32AM |
|
Greetings,
Andrew I tried the code sample you wrote down but I couldn't get it to work. I tried changing some parts here and there but could not get my qp.LoadFromFile to be captured and drawn to the other pages. So I looked into qp.ClonePages and I managed to get it working. It's a small example but this is how I'm using it. if (rowCount > 14) { qp.ClonePages(1, 1, Convert.ToInt32(System.Math.Ceiling(rowCount / 14.0))- 1); qp.SelectPage(1); } Basically the PDF file that I am loading has only 14 fields, so with this it counts how many rows there are beforehand and will make additional pages as needed. Thanks again for your help Andrew! Halv
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store