activePDF KB #10669 - Get the height and width of an input PDF
activePDF KB #10669 - Get the height and width of an input PDF
Get the height and width of an input PDF
Product
Version
Service Pack
Code Samples
Toolkit Std Toolkit Pro
3.5.2 4.0 4.0 SR1
SP4 SP5 SP6
VBS ASP CF
Description
The following VBScript example demonstrates how to retrieve the height and width of the input PDF using the GetBoundingBox method.
These files are required:4pages.pdf - The input PDF.GetPageHeightWidth.vbs - Code detail provided below.
Click here to download this example (includes required files) :
' Variables
' Input PDF
varInputFile = "4pages.pdf"
' Instantiate Objects
Set objTK = CreateObject( "APToolkit.Object" )
' Specify the PDF to use as the template
varReturn = objTK.NumPages( varInputFile)
If varReturn = 0 Then Error ( "NumPages" ) End If
' Loop through each page in the PDF
For i = 1 To varReturn
' Get the bounding box of the current page
objTK.GetBoundingBox varInputFile, i
' Set the height and width to variables
varHeight = objTK.BBHeight
varWidth = objTK.BBWidth
' Use a msgbox to display results
Msgbox "Page " & i & ": Height=" & varHeight & " Width=" & varWidth
Next
' Close the input PDF we are done
objTK.CloseInputFile
' Release Object
Set objTK = Nothing
' Error Handling
Sub Error ( Method)
Msgbox "'" & Method & "' failed with a '" & varReturn & _
"'" & VBCRLF & "TK Return Codes:" & VBCRLF & _
"http://www.activepdf.com/support/kb/?id=10670&tk=ts"
Set objTK = Nothing
Wscript.Quit
End Sub
Keywords
get, page, height, width, bounding, box, bound, box, boundingbox, dimensions, getboundingbox, asp, cfm, cf, coldfusion, cold, fusion, VBS, VBScript, vb, script, example, create, from, html, text, method, property
The information in this article is for the use of activePDF Customers and Evaluation Users Only. No part of this document may be transmitted or reproduced without the express written consent of activePDF.
Copyright © 2005, activePDF, Inc. All Rights Reserved