AlambicEdit Library

Revision 4 - v7.5

Design overview

The AlambicEdit library allows the Workflow module to access, create or modify PDF files. It does so by wrapping Adobe PDF Library API calls in an object-oriented COM API. The use of COM as the underlying technology allows Workflow's scripting environment to create an instance of that COM object through the Watch.GetPDFEditObject method.

The object's hierarchy is modeled on the PDF document structure:


Syntax Conventions

This document contains definitions for methods, properties and structures . The syntax for each is as follows.

Methods

Syntax

RETURN_VALUE_TYPE methodName( [ARGUMENT_TYPE arg1[, ARGUMENT_TYPE arg2[,...]]] )

Examples

API documentation
VOID Open( STRING fileName, BOOLEAN doRepair )
STRING GetXYML()


Javascript implementation
myPDF.Open("C:\\PDFs\\SomeDocument.pdf", false);
var myXYML = myPDF.GetXYML();


VBScript implementation
myPDF.Open "C:\\PDFs\\SomeDocument.pdf", false
myXYML = myPDF.GetXYML

In case of failure, methods raise an exception. Methods with a RETURN_VALUE_TYPE of VOID do not have a return value.

Note : in JavaScript, all method calls must include parentheses, even for methods that do not require arguments (e.g.  Watch.GetPDFEditObject()myPDF.Pages() ).


Properties

Syntax

PROPERTY_TYPE propName

Examples

API syntax
INTEGER Orientation

Javascript implementation
var currentOrientation = myPDF.Pages(0).Orientation;
myPDF.Pages(0).Orientation = 180;


VBScript implementation
currentOrientation = myPDF.Pages(0).Orientation
myPDF.Pages(0).Orientation = 180;


Structures

Syntax

STRUCT_NAME {
    FIELD_TYPE fieldName1[,
    FIELD_TYPE fieldName2[,
    ...]]
}

Examples

API documentation
IPDFRect {
   LONG left,
   LONG top,
   LONG right,
   LONG bottom
}


Javascript implementation
var pdfRect = myPDF.Pages(0).Size();
var pageWidth = pdfRect.right - pdfRect.left ;


VBScript implementation
set pdfRect = myPDF.Pages(0).Size
pageWidth = pdfRect.right - pdfRect.left



The PDF object

To instantiate the PDF object, call the Watch.GetPDFEditObject method in Workflow's scripting environment.

Javascript implementation
var myPDF = Watch.GetPDFEditObject();

VBScript implementation
set myPDF = Watch.GetPDFEditObject

Methods and Properties

IPDF Methods

VOID Open (STRING filename, BOOL doRepair)
VOID OpenEx (STRING filename, STRING password, BOOL doRepair)
VOID Create (STRING filename)
VOID Close ()
BOOL IsProtected (STRING filename)
VOID Save (BOOL optimize)
IPages Pages ()
VOID Print (STRING printerName, LONG fromPage, LONG toPage)
VOID PrintEx (STRING printerName, IPdfPrintParams PdfPrintParams)
STRING GetXMP ()
VOID SetXMP (STRING Value)
IPdfInfos GetInfos ()
VOID SetInfos (IPdfInfos Infos)
VOID setPageCacheSize (UNSIGNED LONG cacheSize)
VOID GetVersion (LONG *major, LONG *minor)
VOID SetVersion (LONG major, LONG minor)
VOID setTolerances (FLOAT tolerableDeltaWidth, FLOAT tolerableDeltaHeight, FLOAT tolerableDeltaFontHeight, FLOAT tolerableGap)
STRING GetXYML ()
VOID MergeWith (STRING pdfFilename)
VOID MergeWith2 (STRING pdfFilename, LONG xnum, LONG ynum, LONG xoffset, LONG yoffset, FLOAT scaleFactor)
VOID ConvertToVDX (STRING pdfFilename, STRING ppmlFilename)

IPages Methods

LONG Count ()
VOID Insert (LONG index, IPdfRect mediaSize)
VOID InsertFrom (STRING srcFilename, LONG srcIndex, LONG srcCount, LONG destIndex)
VOID InsertFrom2 (IPages srcPages, LONG srcIndex, LONG srcCount, LONG destIndex)
VOID ExtractTo (STRING destFilename, LONG srcIndex, LONG srcCount, BOOL optimize)
VOID Delete (LONG index)
VOID Move (LONG index, LONG count, LONG offset)
IPage Item (LONG index)

IPage Properties

INTEGER Orientation

IPage Methods

IPdfRect MediaSize ()
IPdfRect Size ()
VOID Draw (VOID context, FLOAT scale, LONG offsetX, LONG offsetY)
STRING ExtractText (FLOAT left, FLOAT bottom, FLOAT right, FLOAT top)
STRING ExtractText2 (FLOAT left, FLOAT top, FLOAT right, FLOAT bottom)
VOID setTolerances (FLOAT tolerableDeltaWidth, FLOAT tolerableDeltaHeight, FLOAT tolerableDeltaFontHeight, FLOAT tolerableGap)
VOID setIncludeBorders (LONG pbIncludeBorders)
VOID Merge (STRING imageFile, FLOAT left, FLOAT top, FLOAT rotateAngle, FLOAT scaleFactor)
VOID Merge2 (IPage srcPage, FLOAT left, FLOAT top, FLOAT rotateAngle, FLOAT scaleFactor)
VOID MergeToLayer (STRING imageFile, FLOAT left, FLOAT top, FLOAT rotateAngle, FLOAT scaleFactor, STRING layerName)
VOID MergeToLayer2 (IPage srcPage, FLOAT left, FLOAT top, FLOAT rotateAngle, FLOAT scaleFactor, STRING layerName)


Structures

IPdfInfos

The IPdfInfos structure contains the same basic information that can be found in Actobat Reader's ™ File Properties . To instantiate the IPdfInfos structure, create the AlambicEdit.PdfInfos object in Workflow's scripting environment.

Javascript implementation
var pdfInfos = new ActiveXObject("AlambicEdit.PdfInfos");

VBScript implementation
set pdfInfos = CreateObject("AlambicEdit.PdfInfos")

iPdfInfos {

STRING Title
The document's title.
STRING Author
The name of the person who created the document.
STRING Subject
The subject of the document.
STRING Keywords
Keywords associated with the document. Multiple keywords are separated with semi-colons.
STRING Creator
If the document was converted to PDF from another format, the name of the application that created the original document from which it was converted.
STRING Producer
If the document was converted to PDF from another format, the name of the application that converted it to PDF.
STRING CreationDate
The date and time the document was created, in human-readable form.
}

IPdfPrintParams

The IPdfPrintParams structure contains information used to control the printing of the file. To instantiate the IPdfPrintParams structure, create the AlambicEdit.PdfPrintParams object in Workflow's scripting environment.

Javascript implementation
var pdfPrintParams= new ActiveXObject("AlambicEdit.PdfPrintParams");

VBScript implementation
set pdfPrintParams = CreateObject("AlambicEdit.PdfPrintParams")
IPdfPrintParams{

STRING docName
Name of the document; this is the name displayed in the Windows spooler window.
STRING
pageRange
Pages to print and/or page ranges separated by commas; e.g. "0,3,5-12". Page numbers are 0-based. Leave empty to print all pages.
LONG copies
Number of copies to print.
BOOL shrinkToFit
If true, the page will be resized (shrunk or expanded) and rotated to fit to the physical media on which it is being printed.
BOOL printAnnotations
If true, annotations will be printed.
}

IPdfRect

The IPdfRect structure defines a rectangular region within a PDF page. To instanciate the IPdfRect structure, create the AlambicEdit.PdfRect object in Workflow's scripting environment.

Javascript implementation
var pdfRect = new ActiveXObject("AlambicEdit.PdfRect");

VBScript implementation
set pdfRect = CreateObject("AlambicEdit.PdfRect")

IPdfRect {
LONG left
Left edge of the rectangle.
LONG top
Top edge of the rectangle.
LONG right
Right edge of the rectangle.
LONG bottom
Bottom edge of the rectangle.
}


All values are expressed in points (72 points per inch).

NOTE: the PDF's coordinate system has its origin on the bottom left corner of the page, extending up and to the right. Therefore, a Letter-sized page has the following rectangular values:

(612,792)
Left
0
Top
792
Right
612
Bottom
0
(0,0)



IPDF Object

VOID Open ( STRING filename,


BOOL  doRepair  

)

Opens an existing PDF, optionally repairing it.

Parameters

filename  Name of the file to open.

doRepair  If true, the software automatically attempts to repair the file if it is found to be damaged or corrupt. Otherwise, the operation fails if the file is damaged.
Return value
None.

VOID OpenEx ( STRING filename,


STRING  password  


BOOL  doRepair  

)

Opens an existing, password-protected PDF, optionally repairing it.

Parameters

filename  Name of the file to open.

password  Password to open the file.

doRepair  If true, the software automatically attempts to repair the file if it is found to be damaged or corrupt. Otherwise, the operation fails if the file is damaged.
Return value
None.
See also:
IsProtected()

VOID Create ( STRING filename  ) 

Creates a new empty PDF file.

Parameters

filename  Name of the file to create. The file is not physically written to disk until IPDF.Save() is called.
Return value
None.
See also:
Save

VOID Close (

Closes the PDF file. If changes were made but not saved, they are silently lost. All IPage objects must be released before closing a PDF.

NOTE: before using Close() in Javascript, you should call the CollectGarbage() global method to ensure all references to pages are properly discarded. This additional statement is not required with other languages. For instance:

var objPDF = Watch.GetPDFEditObject();
objPDF.Open(Watch.GetJobFileName(), false);

var objPages = objPDF.Pages();
var objPage = null;
for(var i=0; i<objPages.Count(); i++) {
objPage = objPages.Item(i);
}
objPage=null;
objPages=null;
CollectGarbage();
objPDF.Close();
If you run the above code without calling the CollectGarbage() method, the Close() method will error out.

Parameters


None.
Return value
None.

BOOL IsProtected ( STRING filename  ) 

Returns True if the PDF file is password-protected. When a file is password-protected, the OpenEx() method must be used instead of the Open() method.

Parameters

filename  Name of the file to check for password-protection.
Return value
True if the file is password-protected, False otherwise.
See also:
OpenEx()

VOID Save ( BOOL  optimize  ) 

Saves changes to the PDF file. The version of the PDF file format is the highest possible for a newly created file and is unchanged when saving an existing file, unless the SetVersion method was called in which case the file format used will be the one set by SetVersion.

Parameters

optimize  If true, the file is optimized before being written to disk, i.e. objects are garbage-collected and/or regenerated, the PDF is linearized, etc.
Return value
Nothing.
See also:
SetVersion

IPages Pages (

Provides access to the Pages collection of the PDF.

Parameters


None.
Return value
An IPages collection object. Each page in the zero-based collection can be accessed through the IPages.Item() method. Note that since Item() is the collection's default method, it can be omitted altogether (e.g. IPages(0) is the same as IPages.Item(0)).

VOID Print ( STRING printerName,


LONG
fromPage,


LONG toPage  

)

Prints a range of PDF pages to the specified Windows printer with default options.

Parameters

printerName  (optional) Name of the printer to print to. The default options of the printer will be used. If NULL, the default printer is used.

fromPage  0-based index of the first page to print.

toPage  0-based index of the last page to print. To print all pages from fromPage to the end, use -1.
Return value
None.
See also:
PrintEx

VOID PrintEx ( STRING printerName,


IPdfPrintParams PdfPrintParams  

)

Prints a range of PDF pages to the specified Windows printer with specific printer options stored in a IPdfPrintParams structure.

Parameters

printerName  (optional) Name of the printer to print to. The default options of the printer will be used. PdfPrintParams , if non-NULL, may override some of them. If NULL, the default printer is used.

PdfPrintParams  (optional) Pointer to an IPdfPrintParams interface that specifies various print options. If NULL , default values are used.
Return value
None.
See also:
Print

STRING  GetXMP ( )

 

Retrieves the XMP attachment embedded in the PDF.

Parameters

None.

Return value
String containing the complete text of the PDF's XMP attachment.

VOID SetXMP ( STRING xmpPacket  ) 

Sets the XMP attachment by replacing the existing one with xmpPacket.

Parameters

xmpPacket  New XMP attachment to use instead of the existing one.
Return value
None.

IPdfInfos GetInfos ( )

 

Retrieves the contents of the Document Information Dictionary from the PDF.

Parameters

None.

Return value
An IPDFInfos structure containing the PDF properties. Cannot be NULL.

VOID SetInfos ( IPdfInfos Infos  ) 

Sets the contents for the PDF's Document Information Dictionary.

Parameters

Infos  IPdfInfos structure containing the new values.
Return value
None.

VOID setPageCacheSize ( UNSIGNED LONG
cacheSize  ) 

Sets the maximum number of IPage objects in the cache. Calling this method flushes the cache.

Parameters

cacheSize  Maximum number of IPage pointers that the cache can hold, between 1 and 1000.
Return value
None.

VOID GetVersion ( LONG *  major


LONG *
minor

 )



Returns the version of the underlying PDF file format.

Parameters

major
 Pointer to a LONG that receives the major version number.

minor
 Pointer to a LONG that receives the minor version number.
Return value
None.
NOTE: this method is not available in all scripting environments.

VOID SetVersion ( LONG major


LONG
minor

 )



Sets the version of the underlying PDF file format. This is applied when the file is saved.

Parameters

major
 Major version number.

minor
 Minor version number.
Return value
None.
See also:
Save

VOID setTolerances ( FLOAT tolerableDeltaWidth,


FLOAT tolerableDeltaHeight,


FLOAT tolerableDeltaFontHeight,


FLOAT tolerableGap  

)

Sets the floating point values for the tolerable factors.

Parameters

tolerableDeltaWidth  Tolerable delta width factor value.

tolerableDeltaHeight  Tolerable delta height factor value.

tolerableDeltaFontHeight  Tolerable delta font height factor value.

tolerableGap  Tolerable delta gap between words factor value.
Return value
None.

STRING GetXYML ( )
 

Retrieves the entire extractable text from the PDF in XYML format.

Parameters

None.
Return value
A string containing the complete text of the PDF in XYML format.

VOID MergeWith ( STRING pdfFilename  ) 

Merges the pages of pdfFilename (the source) onto the pages of the current PDF (the destination ). Each page of the source is overlaid transparently onto the corresponding destination page, 1 on 1, 2 on 2, 3 on 3, etc. The source must have the same number of pages than the destination and each pair of pages should have the same size. The resulting file is not optimized.

This method is the same as calling:

PDF.MergeWith2(pdfFilename, 1, 1, 0, 0, 1.0);
Parameters

pdfFilename
 Name of the source PDF from which pages are taken to be overlaid on the pages of the destination PDF.
Return value
None.

VOID MergeWith2 ( STRING pdfFilename,


LONG xnum,


LONG ynum,


LONG xoffset,


LONG yoffset,


FLOAT scaleFactor  

)

Merges the pages of pdfFilename (the source) onto the pages of the current PDF (the destination ). Each page of the source is overlaid transparently onto a destination page in a grid whose size is specified by xnum and ynum . The pages are laid from left to right and then from top to bottom. The resulting file is not optimized.

This method is useful for n-Up imposition. For example, (xnum=1, ynum=1, scaleFactor=1.0 ) means that each source is overlaid on the corresponding destination page, 1 on 1, 2 on 2, 3 on 3, etc. Having (xnum=3, ynum=2) with xoffset, yoffset and scaleFactor set accordingly results in a 3x2 mosaic looking like this:

1
2
3
4
5
6

There is no separator between the source pages on the destination page. A space can be obtained by using an offset bigger than the size of the scaled source page.

Parameters

pdfFilename
 Name of the source PDF from which pages are taken.

xnum
 Number of columns.

ynum
 Number of rows.

xoffset
 Horizontal space to put between the top left corner of each source page, in points.

yoffset
 Vertical space to put between the top left corner of each source page, in points.

scaleFactor
 Scale at which to draw on source pages on the destination. Use 1.0 to draw the page at its nominal size.
Return value
None.

VOID ConvertToVDX ( STRING pdfFilename,


STRING ppmlFilename  

)

Converts a PDF file to a VDX file by adding the necessary entries in the catalog and root dictionaries as well as embedding a PPML file as a stream object in the PDF. The validity of the PPML is left to the caller.

This method opens, modifies, saves and closes the specified PDF file. This means that, contrary to the other methods of the IPDF interface, this method works on - and only on - the PDF file specified by the first argument; IPDF.Open() or .Create() do not need to be called beforehand. If they were called, the file opened or created by these methods is untouched (unless of course pdfFilename specifies the same filename as Open()).

Parameters

pdfFilename
 Name of the file to convert.

ppmlFilename
 Name of the PPML file to embed.
Return value
None.



IPages Collection

LONG Count ( )


Returns the number of items in the Pages collection, in other words the number of pages in the PDF.

Parameters

None.
Return value
The number of pages in the PDF.

VOID Insert ( LONG index,


IPdfRect mediaSize  

)

Inserts a new blank page in the PDF file

Parameters

index  0-based index at which to insert the page. The page is inserted *before* the page at index "index ". To insert a page at the end, use IPages.Count().

mediaSize  IPdfRect structure containing the rectangular dimensions of the new page, in points. Cannot be NULL.
Return value
None.

See also:
Count

VOID InsertFrom ( STRING srcFilename,


LONG srcIndex,


LONG srcCount,


LONG destIndex  

)

Inserts pages from another PDF file into this one. All relevant resources are copied with the pages.

Parameters

srcFilename  Name of the PDF from which pages are retrieved.

srcIndex  0-based index of the first page to copy.

srcCount  Number of contiguous pages starting from srcIndex to insert. If srcCount is -1, all pages from srcIndex up to the end are inserted.

destIndex  0-based index of the position where to insert the pages. They will be inserted before the page at index destIndex . To insert the pages at the end, use IPages.Count().
Return value
None. 
See also:
Count

VOID InsertFrom2 ( IPages 
srcPages,


LONG srcIndex,


LONG srcCount,


LONG destIndex  

)

Inserts pages from another IPages object into this one. All relevant resources are copied with the pages.

Parameters

srcPages
IPages collection from which the pages are retrieved.

srcIndex  0-based index of the first page to copy.

srcCount  Number of contiguous pages starting from srcIndex to insert. If srcCount is -1, all pages from srcIndex up to the end are inserted.

destIndex  0-based index of the position where to insert the pages. They will be inserted before the page at index destIndex . To insert the pages at the end, use IPages.Count().
Return value
None. 
See also:
Count

VOID ExtractTo ( STRING destFilename,


LONG srcIndex,


LONG srcCount,


BOOL  optimize  

)

Extracts pages from the PDF and creates a new file with these pages. All relevant resources are copied with the pages. If the target file already exists, it is overwritten.

Parameters

destFilename  Name of the PDF to create with the specified pages.

srcIndex  0-based index of the first page to copy.

srcCount  Number of contiguous pages starting from srcIndex to extract.

optimize  If true, optimize (linearize and garbage-collect) the output file.
Return value
None.

VOID Delete ( LONG index  ) 

Deletes a page from the PDF.

Parameters

index  0-based index of the page to delete.
Return value
None.

VOID Move ( LONG index,


LONG count,


LONG offset  

)

Moves a range of pages within the same PDF.

Parameters

index  0-based index of the first page of the range.

count  Number of contiguous pages to move.

offset  Number of hops to move the pages. If negative, the pages are moved towards the beginning of the file. If positive, towards the end.
Return value
None.

IPage Item ( LONG  index )

Returns a Page object from the PDF. Note that since Item() is the collection's default method, it can be omitted altogether (e.g. IPages(0) is the same as IPages.Item(0) )

Parameters

index  0-based index of the page to acquire.
Return value
An IPage object for the specified page.



IPage Method and Property Documentation

INTEGER Orientation

Gets/sets the orientation of the page, in degrees. The value is always a multiple of 90 and is the number of degrees the page should be rotated clockwise when displayed or printed.

IPdfRect MediaSize ( )

Returns the size of the physical medium on which the page is intended to be placed, in points. This corresponds to the /MediaBox entry of the /Page object in the PDF.

Parameters

None.
Return value
An IPdfRect structure containing the dimensions, in points, of the media size. Cannot be NULL.
See also:
Size

IPdfRect Size (  ) 

Returns the size of the rectangle that is used to clip (crop) the content of the page before applying it to the medium, in points. This corresponds to the /CropBox entry of the /Page PDF object. It can be seen as the bounding box of the page since by definition, anything outside of it should be left out of the drawing, although there may be empty areas within it.

Parameters

None.
Return value
An IPdfRect structure containing the dimensions, in points, of the page size. Cannot be NULL.
See also:
MediaSize

VOID Draw ( HDC context,


FLOAT scale,


LONG offsetX,


LONG offsetY  

)

Draws the page onto the device context. This method is highly dependent on the state of the DC and there are a few interaction pitfalls to lookout for. Read on for details.

The drawing is done in PDF user space units (72th of an inch). In order to have a smooth drawing of the page, the DC must have its mapping mode set to MM_TEXT with a 1:1 mapping between logical space (SetWindowExtEx ) and device space (SetViewportExtEx). Since MM_TEXT has its origin at the top instead of the bottom, the drawing is done vertically mirrored; this means that the other mapping modes may not work because they are based at the bottom. A 100% zoom is obtained by setting the scale to the ratio of the device dpi divided by 72.

The Acrobat library automatically clips the drawing based on the viewable portion of the DC. If the DC is translated or scaled, either by a world transform (SetWorldTransform) or a logical-to-device space transform (SetWindowOrgEx or SetViewportOrgEx ), the *untransformed* space is used. As a result, all scaling and translation operation must be done by the library itself to work correctly. Otherwise, unwanted scaling artifacts or clipping will occur.

As such, the drawing code of the caller should look similar to this to obtain the same result as what Acrobat does:

Note that extra care must be taken when filling rectangles as to whether the boundary pixel will be *inside* or *outside* the region.

NOTE: this method is not available in all scripting environments.

Parameters

context  Device context on which to draw the page.

scale  Scale at which to draw. To draw at the 100% size, use a scale of device_dpi / 72. Do not use the DC to do the scaling; this will result in scaling artifacts being drawn.

offsetX  Horizontal offset from the left edge of the DC surface, in *device* units, at which to start the drawing.

offsetY  Vertical offset from the top edge of the DC surface, in *device* units, at which to start the drawing.
Return value
None.

STRING ExtractText ( FLOAT left,


FLOAT bottom,


FLOAT right,


FLOAT top,

)

Returns the text located inside the region bounded by the left, bottom, right and top parameters. If multiple lines are found, they are separated by a CR-LF pair.

NOTE: This method is subject to many limitations and exists for backward-compatibility and debugging purposes only. For production purposes, use ExtractText2 instead.

Limitations:

Parameters

left  Distance in inches of the left limit of the region from the left edge of the /CropBox.

bottom  Distance in inches of the bottom limit of the region from the bottom edge of the /CropBox.

right  Distance in inches of the right limit of the region from the left edge of the /CropBox.

top  Distance in inches of the top limit of the region from the bottom edge of the /CropBox.
Return value
A string containing the text extracted from the specified region.

See also
ExtractText2

STRING ExtractText2 ( FLOAT left,


FLOAT top,


FLOAT right,


FLOAT bottom,

)

Returns the text located inside the region bounded by the left, top, right and bottom parameters. If multiple lines are found, they are separated by a CR-LF pair.

Parameters

left  Distance in inches of the left limit of the region from the left edge of the /CropBox. Must be between 0 and 5000.

top  Distance in inches of the top limit of the region from the top edge of the /CropBox. Must be between 0 and 5000.

right  Distance in inches of the right limit of the region from the left edge of the /CropBox. Must be between 0 and 5000.

bottom  Distance in inches of the bottom limit of the region from the top edge of the /CropBox. Must be between 0 and 5000.
Return value
A string containing the text extracted from the specified region.

VOID setTolerances ( FLOAT tolerableDeltaWidth,


FLOAT tolerableDeltaHeight,


FLOAT tolerableDeltaFontHeight,


FLOAT tolerableGap  

)

Sets the floating point values for the tolerable factors.

Parameters

tolerableDeltaWidth  Tolerable delta width factor value.

tolerableDeltaHeight  Tolerable delta height factor value.

tolerableDeltaFontHeight  Tolerable delta font height factor value.

tolerableGap  Tolerable gap between words factor value.
Return value
None.

VOID setIncludeBorders ( LONG pbIncludeBorders  ) 

Sets whether or not borders are included for IPage.ExtractText2(). If true, a character is considered to be inside the region using the 30% rule (i.e. at least 30% of the character must be enclosed in the region). Otherwise, the character must be entirely enclosed in the region to be returned.

Parameters

pbIncludeBorders  If zero, the char must be completely inside the region. Otherwise, the 30% rule applies.
Return value
None.
See also:
ExtractText2

VOID Merge ( STRING imageFile,


FLOAT left,


FLOAT top,


FLOAT rotateAngle,


FLOAT scaleFactor  

)

Inserts an image file and places it on the page at a specific location.
Image types supported are: PDF (page 1), JPG, GIF, PNG, TIFF.

Parameters

imageFile
 Full name of the image to insert on the current page.

left
 Coordinate at which to place the left edge of the image from the left edge of the page, in points.

top
 Coordinate at which to place the top edge of the image from the top of the page, in points.

rotateAngle
 Angle at which to rotate counter-clockwise the inserted image, in degrees. The rotation is done after the image is placed at (left, top) and centered around that point.

scaleFactor
 Scale at which to display the image. For bitmaps, this is based on a 72 dpi resolution. Use 1.0 for the nominal size.
Return value
None.

VOID Merge2 ( IPage 
srcPage,


FLOAT left,


FLOAT top,


FLOAT rotateAngle,


FLOAT scaleFactor  

)

Transparently places a PDF page on top of the current page at a specific location. The source page can be either from the same PDF or another opened file. If the source is from the same PDF file, the source page is not modified. This allows to have the same behavior as IPDF.MergeWith() by first inserting the pages from an external file, merging them and then deleting them, but with more flexibility.

Parameters

sourcePage
 IPage object to overlay on the current page.

left
 Coordinate at which to place the left edge of the image from the left edge of the page, in points.

top
 Coordinate at which to place the top edge of the image from the top of the page, in points.

rotateAngle
 Angle at which to rotate counter-clockwise the inserted image, in degrees. The rotation is done after the image is placed at (left, top) and centered around that point.

scaleFactor
 Scale at which to display the image. For bitmaps, this is based on a 72 dpi resolution. Use 1.0 for the nominal size.
Return value
None.

VOID MergeToLayer ( STRING imageFile,


FLOAT left,


FLOAT top,


FLOAT rotateAngle,


FLOAT scaleFactor  


STRING layerName  

)

This method behaves the same as Merge() but allows to insert the image as a layer (a.k.a. an Optional Content Group).

Image types supported are JPG and PNG. If the input file is a PNG with an alpha channel, the PNG is alpha blended with the page underneath. Monochrome PNG files are drawn transparently, with the white used as the transparent color.

Parameters

sourcePage
IPage pointer to the page to overlay on the current page.

left
Coordinate at which to place the left edge of the image from the left edge of the page, in points.

top
Coordinate at which to place the top edge of the image from the top of the page, in points.

rotateAngle
Angle at which to rotate counter-clockwise the inserted image, in degrees. The rotation is done after the image is placed at (left, top) and centered around that point.

scaleFactor
Scale at which to display the image. For bitmaps, this is based on a 72 dpi resolution. Use 1.0 for the nominal size.

layerName
Name of an Optional Content Group in which to put the layer containing the image. The string cannot be empty but can be NULL if no layer is required.
Return value
None.

VOID MergeToLayer2 ( IPage  srcPage,


float  left,


float  top,


float  rotateAngle,


float  scaleFactor  


BSTR layerName  

)

This method behaves the same as Merge2() but allows to put the source page as a layer (a.k.a. an Optional Content Group).

Parameters

sourcePage
IPage object to overlay on the current page.

left
Coordinate at which to place the left edge of the image from the left edge of the page, in points.

top
Coordinate at which to place the top edge of the image from the top of the page, in points.

rotateAngle
Angle at which to rotate counter-clockwise the inserted image, in degrees. The rotation is done after the image is placed at (left, top) and centered around that point.

scaleFactor
Scale at which to display the image. For bitmaps, this is based on a 72 dpi resolution. Use 1.0 for the nominal size.

layerName
Name of an Optional Content Group in which to put the layer created from the source page. The string cannot be empty but can be NULL if no layer is required.
Return value
None.