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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - SetPageDimensions Problem
  FAQ FAQ  Forum Search   Register Register  Login Login

SetPageDimensions Problem

 Post Reply Post Reply
Author
Message
Martin View Drop Down
Beginner
Beginner
Avatar

Joined: 01 Nov 05
Location: Canada
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Martin Quote  Post ReplyReply Direct Link To This Post Topic: SetPageDimensions Problem
    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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 16 Nov 05 at 1:18AM
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

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 16 Nov 05 at 1:22AM
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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store