ActivePDF will be closed Monday September 6th in observance of the Labor Day Holiday.

ActivePDF
Shopping Cart My Account Help Contact Us
Request a Call
Search
Products Solutions Support Downloads Corporate
Submit an Issue
Knowledge Base
Server Product Support
Examples & How-Tos
Support Options
Support Policies
Annual Subscription
Extensions
Documentation
Resource Links
   
 
 
 
 

HomeSupportKnowledge Base
 
activePDF KB #10669 - Get the height and width of an input PDF
activePDF KB #10669 - Get the height and width of an input PDF
Information: Example Printer Version | Return to Search
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
 
Last Updated 2007-07-19 Printer Version | Return to Search
 
Knowledge Base Article Feedback*
*KB article feedback ONLY (submit support issues here)
Quality of this article?
  Poor Excellent 
1 2 3 4 5 6 7 8 9 10
Is this article helpful? Yes       No       Maybe
Comments (Optional)
Email Address (Optional)
Please enter the word "PDF"
(without quotes)
 
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
2003 activePDF Site Map Feedback Privacy Policy Legal