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!
SetPageDimensions Problem |
Post Reply |
Author | |
Martin
Beginner Joined: 01 Nov 05 Location: Canada Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 15 Nov 05 at 8:29PM |
I am trying to change the dimensions of an existing page and the result is that the page gets resized but all of the content that was previously on the is removed. Is this the proper result of the method or is there another way to resize an existing page.
|
|
Martin
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Martin!
I didn't try it out but ... What about creating a new and empty page with the new dimensions and then copy the old page into the new page? Perhaps it helps working additional with GetPageContent on the old page and SetPageContent on the new page (after resizing). Good luck. |
|
Cheers,
Ingo |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Me again ;-)
Here's some code from the "original" QuickPDF-website. It seems to feed your needs? First, load the original document: QP.LoadFromFile("original.pdf") It will be easier if we set the origin to the top-left corner of the page, use the SetOrigin function: QP.SetOrigin(1) Then we get the number of pages in the original document: originalPageCount = QP.PageCount() Now calculate the required number of pages for the booklet: if (originalPageCount == 1) requiredPages = 1; else requiredPages = (floor(originalPageCount - 1) / 4) * 2 Store the size of the pages in the original document: w = QP.PageWidth() h = QP.PageHeight() Add the required number of pages to the end of the document, using the NewPages function: QP.NewPages(requiredPages) Now capture the original pages: for (page = 1; page <= originalPageCount; page++) { capture[page] = QP.CapturePage(1) } Draw the first set of pages, alternate right/left: captureIndex = 1 drawLeft = false for (page = 1; page <= requiredPages; page++) { QP.SelectPage(page) QP.SetPageDimensions(h, w) if (drawLeft) x = 0; else x = h / 2 QP.DrawCapturedPage(capture[captureIndex], x, 0, h / 2, w) captureIndex++ drawLeft = !drawLeft } Draw the remaining pages, alternate left/right: for (page = requiredPages; (page >= 1) && (captureIndex <= originalPageCount); page--) { QP.SelectPage(page) if (drawLeft) x = 0; else x = h / 2 QP.DrawCapturedPage(capture[captureIndex], x, 0, h / 2, w) captureIndex++ drawLeft = !drawLeft } Now save the booklet you have just created to a file: QP.SaveToFile("booklet.pdf") |
|
Cheers,
Ingo |
|
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