Page Object Attributes

The reserved identifier "Pages" can be used to access each page’s attributes. To access the attributes of page 1 of a document, one can use the "Pages [1]" reference.

Example: To obtain the page width of page 2 of a document, we can use: PDF1.get_ObjectAttribute("Pages[2]", "Width").

 

Attribute

Description

Type

Values

Default Value

AutoStart

Go to this page when the PDF document is opened

Integer

0 : The page will not be set as the start page.

1 : The page will be set as the start page but the zoom level will remain unchanged.

1-1000 : The page will be set as the start page and the zoom level will be the value of the attribute .

 

0

BottomMargin

Bottom margin in Twips

Integer

> 0

340

CachingAllowed

Permission to be saved out according with PagesInCache attribute.  Otherwise, it will be in memory all times.  

Boolean

True / False

True

Landscape

Paper orientation.

Boolean

True / False

False

LeftMargin

Left margin in Twips.

Integer

> 0

340

Length

Length of paper in Twips (inches * 20).

Integer

> 0

15840 (Letter size) or 16838 (A4 size) depending on country.

Locked

Adds a custom flag on the page indicating that it should not be changed by the calling application

Boolean

True / False

False

MediaType

It specifies the type of paper that this page should be printed on.

String

 

NULL

Objects

*Read Only

List of objects contained on the page.

Array of acObjects

   

ObjectsVBS

*Read Only

List of objects contained on the page which can  be used by VBScript.

IacObject wrapped by VARIANT's in the COM array

   

ObjectType

*Read Only

Returns the type of object.

IacObjectType enumeration(Integer)

 

acObjectTypePage

PageContent

Byte array containing the PDF content stream. Note that the page should be the CuurentPage for this attribute to be valid

Array

   

PaperBin

Paper source when printing document.

Integer

Defined by Windows

15: default paper bin

4: manual feed

1: upper bin

15: default paper bin

PaperSize

Paper size.

Integer

Defined by Windows

1: Letter 8 ½ x 11in

5: Legal 8 ½ x 14 in

9: A4 210 x 297 mm

8: A3 297 x 420 mm

256: Custom size

1 (Letter size) or

9(A4 size) depending on country.

RightMargin

 

Right margin in Twips.

Integer

> 0

340

The page margins are the equivalent of the CropBox in PDF terminology. When a PDF file is opened and it has a CropBox that is different from the MediaBox, the page margin values are populated. When a PDF file is saved, the page margins are converted into a PDF CropBox.

Rotate

Page Rotation.

IacRotatePageOption enumeration(Integer)

-90: acRotatePageLeft

90: acRotatePageRight

180: acRotatePageFull

 

TopMargin

Top margin in Twips.

Integer

> 0

340

Width

Widht of paper in Twips (inches * 20).

Integer

> 0

12240 (Letter size) or 13011 (A4 size) depending on country.

 

 

Example

Sub Sample()

    ' Constants for Activation codes

    Const strLicenseTo As String = "Amyuni PDF Creator Evaluation"

    Const strActivationCode As String = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"

 

    ' Initializing PDFCreativeX Object

    Dim pdf As ACPDFCREACTIVEX.PDFCreactiveX = New ACPDFCREACTIVEX.PDFCreactiveX()

 

    ' Set license key

    pdf.SetLicenseKey(strLicenseTo, strActivationCode)

 

    ' Open an existent PDF file

    Dim fileName As String = "c:\temp\PDFdocument.pdf"

    Dim password As String = ""

    pdf.Open(fileName, password)

 

    ' Page Attributes

    Console.WriteLine(pdf.ObjectAttribute("Pages[1]", "AutoStart"))

    pdf.ObjectAttribute("Pages[1]", "Width") = 12240

    pdf.ObjectAttribute("Pages[1]", "Length") = 15840

 

    ' destroy objects

    pdf = Nothing

End Sub

static void Sample()

{

    // Constants for Activation codes

    const string strLicenseTo = "Amyuni PDF Creator Evaluation";

    const string strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";

 

    // Initializing PDFCreativeX Object

    ACPDFCREACTIVEX.PDFCreactiveX pdf = new ACPDFCREACTIVEX.PDFCreactiveX();

 

    // Set license key

    pdf.SetLicenseKey(strLicenseTo, strActivationCode);

 

    // Open an existent PDF file

    string fileName = @"c:\temp\PDFdocument.pdf";

    string password = "";

    pdf.Open(fileName, password);

 

    // Page Attributes

    Console.WriteLine(pdf.ObjectAttribute["Pages[1]", "AutoStart"]);

    pdf.ObjectAttribute["Pages[1]", "Width"] = 12240;

    pdf.ObjectAttribute["Pages[1]", "Length"] = 15840;

 

    // destroy objects

    pdf = null;

}

#include <iostream>

#import "c:\users\amyuni\pdfcreactivex.dll" no_namespace

 

using namespace std;

 

int main()

{

    // Constants for Activation codes

    bstr_t strLicenseTo = "Amyuni PDF Creator Evaluation";

    bstr_t strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC";

 

    // Initialize the COM subsystem

    CoInitialize(0);

 

    // IPDFCreactiveXPtr is a smart pointer type defined in pdfcreactivex.tlh,

    // the type library header file generated by the #import instruction above

    IPDFCreactiveXPtr pdf;

 

    // Create the PDFCreactiveX instance

    pdf.CreateInstance(__uuidof(PDFCreactiveX));

 

    // set license key

    pdf->SetLicenseKey(_bstr_t(strLicenseTo), _bstr_t(strActivationCode));

 

    // Open an existent PDF file

    _bstr_t fileName = "c:\\temp\\PDFdocument.pdf";

    _bstr_t password = "";

    pdf->Open(fileName, password);

 

 

    // Page Attributes

    cout << (_bstr_t)pdf->GetObjectAttribute(_bstr_t("Pages[1]"), _bstr_t("AutoStart")) << endl;

    pdf->ObjectAttributeLong("Pages[1]", "Width", 12240);

    pdf->ObjectAttributeLong("Pages[1]", "Length", 15840);

 

    // destroy objects

    pdf = NULL;

 

    return 0;

}

' FileSaveOptionConstants

Const acFileSaveAll = 0

Const acFileSaveDefault = -1

Const acFileSaveView = 1

Const acFileSaveDesign = 2

Const acFileSavePDFA_7 = 3

Const acFileSavePDFA = 4

Const acFileSavePDF14 = 5

 

' Constants for Activation codes

Const strLicenseTo = "Amyuni PDF Creator Evaluation"

Const strActivationCode = "07EFCDAB010001004282943F2AF19A88F332D9E781E40460727DF8A42847A1BDE06DB61C71E94E2D90424BF8762385335F9D6884E9FC"

 

' Initializing PDFCreativeX Object

Dim pdf

Set pdf = CreateObject("PDFCreactiveX.PDFCreactiveX.6.5")

 

' Set license key

pdf.SetLicenseKey strLicenseTo, strActivationCode

 

' Open an existent PDF file

Dim fileName

fileName = "c:\temp\PDFdocument.pdf"

Dim password

password = ""

pdf.Open fileName, password

 

' Page Attributes

WScript.Echo(pdf.ObjectAttribute("Pages[1]", "AutoStart"))

pdf.ObjectAttribute("Pages[1]", "Width") = 12240

pdf.ObjectAttribute("Pages[1]", "Length") = 15840

 

' destroy Objects

Set pdf = Nothing