Print Page | Close Window

Change papersize on existing PDF

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3284
Printed Date: 22 Jul 25 at 3:00PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Change papersize on existing PDF
Posted By: PeterL
Subject: Change papersize on existing PDF
Date Posted: 16 Mar 16 at 11:51AM
Hi,
 
 I'm trying to change the paper size on an existing PDF file from "A4" to "Letter" and have used the PDF library (version 12.12)  (VBScript) for this purpose - using the CapturePage function. However, it looks like this function does not capture comments and bookmarks.
 Any suggestion on how to solve this ?
 
Thanks.
Partial code
----------------------------------------------------------
 
Call QP.LoadFromFile("C:\Development\PDF\blankcrf.pdf","" )
Call QP.SetOrigin(1)
Dim  np' No of pages
np = QP.PageCount() 
WScript.Echo("No Pages.."+CStr(np))

'
' Process all pages
'
Dim pw   'Page Width
Dim ph   'Page Height
Dim hb   'Horiz border
Dim vb   'Vertz Border
Dim pi   'Page Id
Dim cp   'Captured Page

Dim ScaleFactor
ScaleFactor = 0.9

For oCount = 1To np

  WScript.Echo("Processing.."+CStr(oCount))
  
  Call QP.SelectPage(1)
  pw = QP.PageWidth()
  ph = QP.PageHeight()

  WScript.Echo(CStr(pw)+":"+CStr(ph))
  
  hb = pw * (1.0 - scaleFactor) / 2
  vb = ph * (1.0 - scaleFactor) / 2

  cp = QP.CapturePage(1)
  Call QP.SetPageSize("Letter")
  pi = QP.NewPage() 
  Call QP.SetPageSize("Letter")
  Call QP.SetPageDimensions(pw, ph)
  Call QP.DrawCapturedPage(cp, hb, vb*2, pw - 2 * hb, ph)

Next


Call QP.SaveToFile("C:\Development\A4LetterPDF\resized.pdf")

 



Replies:
Posted By: Ingo
Date Posted: 17 Mar 16 at 9:24PM
Hi Peter,

i've found older posts regarding similar issues with lost internal links. 
Perhaps it's still a prob.
Perhpas posts like this could be a help:
http://www.quickpdf.org/forum/usingtwice-drawrotatedcapturedpage-on-a-new-page_topic2930.html
Perhaps a NormalizePage before capture can help, too?

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: BobW
Date Posted: 23 Mar 16 at 6:39PM
Check out this post:
http://www.quickpdf.org/forum/taking-3-inches-off-the-bottom_topic3170.html




Posted By: PeterL
Date Posted: 31 Mar 16 at 12:01PM
Unfortunately, all the comments are upside down after applying your suggestion.


Posted By: Ingo
Date Posted: 31 Mar 16 at 1:11PM
so it seems to me that the relevant pdf was processed using "rotate"?
Try NormalizePage before ...
http://www.debenu.com/docs/pdf_library_reference/NormalizePage.php



-------------
Cheers,
Ingo



Posted By: BobW
Date Posted: 31 Mar 16 at 10:41PM
The post I reference needed to take 3 inches off the bottom of the page.  This required rotating the page, cutting three inches off the top, then rotating it back.  If you take out the rotation part it should do what you want.  The key, as Ingo points out, is NormalizePage.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk