Page Class Documentation
classPageNamespace:com::datalogics::PDFL
Detailed Description
Represents a page within a PDF file. The page is the basic object used for organizing content in a PDF document.
Referenced by
Constructor & Destructor Documentation
Page
Parameters
doc: DocumentThe document in which the page is created.
afterPageNum: intThe page number after which the new page is inserted. The first page is 0. Use PDBeforeFirstPage() (see PDExpT.h) to insert the new page at the beginning of a document.
mediaBox: RectA rectangle specifying the page's media box, specified in user space coordinates.
Creates and acquires a new page. The page is inserted into the document at the specified location. Call PDPageRelease() when you are done using the page.
Page
Page(Documentdoc, intpageNum)Parameters
doc: DocumentThe document containing the page to acquire.
pageNum: intThe page number of the page to acquire. The first page is 0.
Gets a Page from a document.
Member Function Documentation
DisposeChildren
voidDisposeChildren()Returns:
voidDrawContentsRGBAInternal
Parameters
Returns:
voidDraw into a raw buffer; intended for a JNI implementation
DrawContentsRGBAInternal
Parameters
Returns:
voidDraw into a raw buffer; intended for a JNI implementation
DrawContentsSeparatedInternal
voidDrawContentsSeparatedInternal(DrawParamsdrawParams, java.util.List< SeparationColorSpace >separationColorants, booleanneedStride, bytebitmaps)Parameters
drawParams: DrawParamsParameters for the drawing operation
separationColorants: java.util.List< SeparationColorSpace >List of inks to be drawn
needStride: booleanFlag which show should we expand data banks by adding padding to have line width 4 bytes aligned. Always true for C# and always false for Java.
bitmaps: bytebuffer represented as array of IntPtr for .Net implementation and jbyte* for JNI implementation
Returns:
voidDraw into a raw buffer as a series of Separation plates; intended for a JNI and PINVOKE implementation This function ignored colorSpace parameter from drawParams it render the page with DeviceN colorspace and get all information about colorants directly from the page.
DrawContentsToJavaBitmapInternal
voidDrawContentsToJavaBitmapInternal(byte[]buffer, intw, inth, intstride, RectexportRect, PageImageParamsImageParams)Parameters
buffer: byte[]w: inth: intstride: intexportRect: RectImageParams: PageImageParams
Returns:
voidDrawContentsToJavaBitmapInternal
voidDrawContentsToJavaBitmapInternal(byte[]buffer, intw, inth, intstride, RectexportRect, PageImageParamsImageParams, RenderProgressProcprogressProc)Parameters
buffer: byte[]w: inth: intstride: intexportRect: RectImageParams: PageImageParamsprogressProc: RenderProgressProc
Returns:
voidDrawContentsToJavaBitmapInternal
voidDrawContentsToJavaBitmapInternal(int[]buffer, intw, inth, intstride, RectexportRect, PageImageParamsImageParams)Parameters
buffer: int[]w: inth: intstride: intexportRect: RectImageParams: PageImageParams
Returns:
void[static initializer]
static void[static initializer]()addAnnotation
voidaddAnnotation(intaddAfter, Annotationannot)Parameters
addAfter: intThe index into the page's annotation array where the annotation is added. The first annotation in the array has an index of zero. Passing a value of -2 adds the annotation to the end of the array. Passing other negative values produces undefined results.
annot: AnnotationThe annotation to add.
Returns:
void(Deprecated, function may be removed in the future. Instead, use the constructor for Annotation or a subclass of Annotation.)
Adds an annotation at the specified location in a page's annotation array.
addNewAnnotation
AnnotationaddNewAnnotation(intaddAfter, StringsubType, RectinitialRect)Parameters
addAfter: intWhere to add the annotation in the page's annotation array. Passing a value of -2 adds the annotation to the end of the array (this is generally what you should do unless you have a need to place the annotation at a special location in the array). Passing a value of -1 adds the annotation to the beginning of the array. Passing other negative values produces undefined results.
subType: StringThe subtype of the annotation to add.
initialRect: RectA pointer to a rectangle specifying the annotation's bounds, specified in user space coordinates.
Returns:
The newly created annotation.(Deprecated, function may be removed in the future. Instead, use the constructor for Annotation or a subclass of Annotation.)
Adds an annotation to the page. This method is equivalent to calling PDPageCreateAnnot() followed by PDPageAddAnnot().
addQRBarcode
booleanaddQRBarcode(QREncodeParamsparams)Parameters
params: QREncodeParamsThe Params specified how to encode the barcode
Returns:
if True, the Barcode was successfully added to the Page.Add a QR Two-Dimensional Barcode encoded with the specified Params to the specified PDF page as an image.
addQRBarcode
voidaddQRBarcode(StringtextToEncode, doublex, doubley, doublewidth, doubleheight)Parameters
textToEncode: StringThe Text to be encoded in the barcode
x: doubleThe horizontal location on the page in points
y: doubleThe vertical location on the page in points
width: doubleThe width of the barcode image in points
height: doubleThe height of the barcode image in points
Returns:
voidAdd a QR Two-Dimensional Barcode encoded with the specified Text to the page as an image.
calculateBufferDimension
voidcalculateBufferDimension(java.awt.DimensionrowPixels, RectexportRect, PageImageParamsImageParams)Parameters
rowPixels: java.awt.DimensionexportRect: RectImageParams: PageImageParams
Returns:
voidcalculateBufferDimension
voidcalculateBufferDimension(java.awt.DimensionrowPixels, RectexportRect, PageImageParamsImageParams, booleanisDrawSKBitmap)Parameters
rowPixels: java.awt.DimensionexportRect: RectImageParams: PageImageParamsisDrawSKBitmap: boolean
Returns:
voidcolorConvertContent
booleancolorConvertContent(ColorConvertParamsparams)Parameters
params: ColorConvertParamsThe color conversion parameters.
Returns:
True if color conversion occurred. False if nothing was color converted.Convert the colors (in place) in a page as specified by the params block by applying an ICC profile to the objects contained in the page.
createAnnotation
AnnotationcreateAnnotation(StringsubType, RectinitialRect)Parameters
subType: StringThe subtype of the annotation to add.
initialRect: RectA pointer to a rectangle specifying the annotation's bounds, specified in user space coordinates.
Returns:
The newly created annotation.(Deprecated, function may be removed in the future. Instead, use the constructor for Annotation or a subclass of Annotation.)
Creates a new annotation, associated with the specified page's Document, but not added to the page. Use AddAnnotation to add the annotation to the page.
delete
synchronized voiddelete(Booleandisposing)Parameters
disposing: Boolean
Returns:
synchronized voiddelete
synchronized voiddelete()Returns:
synchronized voiddrawContents
byte[]drawContents(DrawParamsdrawParams)Parameters
drawParams: DrawParamsParameters for the drawing operation
Returns:
an array of bytes containing the image.Draw the contents of the page into a bitmap, and return the raw bitmap data as an array of bytes arranged in left to right, top to bottom order. Each row of the bitmap is aligned onto a four-byte boundary.
The amount of data returned depends on the destRect parameter. Using integer arithmetic:
stride = (width * components + 3) & ~3
array_size = stride * height
drawContents
java.util.List< java.awt.image.BufferedImage >drawContents(DrawParamsdrawParams, java.util.List< SeparationColorSpace >colorants)Parameters
drawParams: DrawParamsdraw parameters for rendering of this page
colorants: java.util.List< SeparationColorSpace >collection of the page's colorants in SeparationColorSpace, that were constructed from an ink and a page. Their tint transforms and alternates will be ignored
Returns:
List, that contains buffered image for each inkDraw the contents of this page in collection of the images. Each image in collection is a separated channel.
drawContents
Parameters
image: java.awt.image.BufferedImagethe image into which to rasterize the page.
matrix: MatrixA matrix to concatenate onto the default page matrix. It is useful for converting from page to window coordinates and for scaling.
updateRect: Rectthe rectangle to draw, specified in user coordinates. Any objects outside the updateRect will not be drawn.
Returns:
voidDraw the contents of this page to an image, only DeviceRGBA colorModel is supported.
drawContents
Parameters
image: java.awt.image.BufferedImagethe image into which to rasterize the page.
matrix: MatrixA matrix to concatenate onto the default page matrix. It is useful for converting from page to window coordinates and for scaling.
updateRect: Rectthe rectangle to draw, specified in user coordinates. Any objects outside the updateRect will not be drawn.
newAntiAlias: java.util.EnumSet< SmoothFlags >antialias level.
doThinLine: booleanflag to set ThinLineHeuristics, to determine whether thin lines will be fattened non-linearly.
bypassCopyPerm: booleanflag to set to determine whether Copy Permissions are bypassed for drawing.
Returns:
voidDraw the contents of this page to a BufferedImage, only DeviceRGBA colorModel is supported.
finalize
voidfinalize()Returns:
voidflattenOptionalContent
booleanflattenOptionalContent()Returns:
true if the page was successfully flattened, false otherwise.Flattens optional content on the page.
This page will be replaced with a version that has no optional content. The new version of the page will contain only what was visible on the page when the call was made.
The document's default optional content context will be used to determine visibility of optional content.
The optional content information formerly associated with content on the page will NOT be deleted from the document, as it is possible for optional content groups to contain items on multiple pages.
flattenOptionalContent
booleanflattenOptionalContent(OptionalContentContextocc)Parameters
occ: OptionalContentContextThe optional content context in which content is checked for visibility.
Returns:
true if the page was successfully flattened, false otherwise.Flattens optional content on the page.
This page will be replaced with a version that has no optional content. The new version of the page will contain only what was visible on the page when the call was made.
The optional content information formerly associated with content on the page will NOT be deleted from the document, as it is possible for optional content groups to contain items on multiple pages.
getAnnotation
AnnotationgetAnnotation(intannotIndex)Parameters
annotIndex: intThe index of the annotation to get on a page. The first annotation on a page has an index of zero.
Returns:
The indexed annotation object.Gets the annotIndex annotation on the page.
getArtBox
RectgetArtBox()Returns:
RectGet the page's ArtBox.
getBBox
RectgetBBox()Returns:
RectGet the page's Bounding Box.
getBleedBox
RectgetBleedBox()Returns:
RectGet the page's BleedBox.
getContent
ContentgetContent()Returns:
The content for the page.Creates a Content from the Page object's contents and resources. The Content is cached, so that subsequent calls on the same Page return the same Content.
After making changes to the content, make sure to call the UpdateContent method on the Page.
getCropBox
RectgetCropBox()Returns:
RectGet the page's CropBox.
getImage
Parameters
exportRect: RectA Rect describing the region of the page to export, specified in user space coordinates. One user unit corresponds to 1/72 inch. To export the entire page, set this parameter to the page's CropBox. User space coordinates correspond to the unrotated page; the rotation specified in Page.Rotation is not taken into account with these coordinates.
Returns:
ImageExport a region of a PDF page to an Image object.
If the exportRect is smaller than the PDF page, then the pixel width and pixel height of the resulting image will be calculated from the exportRect and a resolution of 300.0, containing the area of the page inside the exportRect, scaled to fit. If a specific pixel size or resolution is desired, use the version of GetImage that takes a PageImageParams as a parameter.
getImage
ImagegetImage(RectexportRect, PageImageParamsImageParams)Parameters
exportRect: RectA Rect describing the region of the page to export, specified in user space coordinates. One user unit corresponds to 1/72 inch. To export the entire page, set this parameter to the page's CropBox. User space coordinates correspond to the unrotated page; the rotation specified in Page.Rotation is not taken into account with these coordinates.
ImageParams: PageImageParamsA PageImageParams containing additional parameters for the exported image, including the exported image's pixel width, pixel height, and resolution. If these parameters are not specified, the pixel width and pixel height of the image are calculated using the exportRect and a resolution of 300.0.
Returns:
ImageExport a region of a PDF page to an Image object.
This version of GetImage can be used to specify a particular size in pixels for the exported image by setting ImageParams.PixelWidth and/or ImageParams.PixelHeight.
If the exportRect is smaller than the PDF page and ImageParams.PixelWidth and ImageParams.PixelHeight are set, then the resulting image will be of the size ImageParams.PixelWidth x ImageParams.PixelHeight and contain the area of the page inside the exportRect, scaled to fit.
It is also possible to use this function by specifying only ImageParams.PixelWidth or only ImageParams.PixelHeight. When only one is specified, the function will calculate the other.
getImage
ImagegetImage(RectexportRect, PageImageParamsImageParams, java.util.List< SeparationColorSpace >spaces)Parameters
exportRect: RectA Rect describing the region of the page to export, specified in user space coordinates. One user unit corresponds to 1/72 inch. To export the entire page, set this parameter to the page's CropBox. User space coordinates correspond to the unrotated page; the rotation specified in Page.Rotation is not taken into account with these coordinates.
ImageParams: PageImageParamsA PageImageParams containing additional parameters for the exported image, including the exported image's pixel width, pixel height, and resolution. If these parameters are not specified, the pixel width and pixel height of the image are calculated using the exportRect and a resolution of 300.0.
spaces: java.util.List< SeparationColorSpace >A collection of SeparationColorSpace objects. This parameter is used to specify page's inks to be drawn. Each SeparationColorSpace must be constructed from an ink and a page. Their tint transforms and alternates will be ignored.
Returns:
ImageExport a region of a PDF page to an Image object.
This version of GetImage can be used to specify a particular size in pixels for the exported image by setting ImageParams.PixelWidth and/or ImageParams.PixelHeight.
It renders specified page's inks and ignores colorSpace parameter from ImageParams. This function always renders the page in DeviceN colorspace.
If the exportRect is smaller than the PDF page and ImageParams.PixelWidth and ImageParams.PixelHeight are set, then the resulting image will be of the size ImageParams.PixelWidth x ImageParams.PixelHeight and contain the area of the page inside the exportRect, scaled to fit.
It is also possible to use this function by specifying only ImageParams.PixelWidth or only ImageParams.PixelHeight. When only one is specified, the function will calculate the other.
getImageSeparations
ImageCollectiongetImageSeparations(RectexportRect, PageImageParamsImageParams, java.util.List< SeparationColorSpace >spaces, RenderProgressProcprogressProc)Parameters
exportRect: RectImageParams: PageImageParamsprogressProc: RenderProgressProc
Returns:
ImageCollectiongetImageSeparations
ImageCollectiongetImageSeparations(RectexportRect, PageImageParamsImageParams, java.util.List< SeparationColorSpace >spacesCollection)Parameters
exportRect: RectA Rect describing the region of the page to export, specified in user space coordinates. One user unit corresponds to 1/72 inch. To export the entire page, set this parameter to the page's CropBox. User space coordinates correspond to the unrotated page; the rotation specified in Page.Rotation is not taken into account with these coordinates.
ImageParams: PageImageParamsA PageImageParams containing additional parameters for the exported image, including the exported image's pixel width, pixel height, and resolution. If these parameters are not specified, the pixel width and pixel height of the image are calculated using the exportRect and a resolution of 300.0.
spacesCollection: java.util.List< SeparationColorSpace >A collection of SeparationColorSpace class additional parameter for specifying colorants for bitmap rendering. Each SeparationColorSpace must be constructed from an ink and a page. Their tint transforms and alternates will be ignored.
Returns:
ImageCollectionExport a region of a PDF page using the specified Separation ColorSpaces to an Image Collection object.
This version of GetImage can be used to specify a particular size in pixels for the exported image by setting ImageParams.PixelWidth and/or ImageParams.PixelHeight.
If the exportRect is smaller than the PDF page and ImageParams.PixelWidth and ImageParams.PixelHeight are set, then the resulting image will be of the size ImageParams.PixelWidth x ImageParams.PixelHeight and contain the area of the page inside the exportRect, scaled to fit.
It is also possible to use this function by specifying only ImageParams.PixelWidth or only ImageParams.PixelHeight. When only one is specified, the function will calculate the other.
getMediaBox
RectgetMediaBox()Returns:
RectGet the page's MediaBox.
getNumAnnotations
intgetNumAnnotations()Returns:
The number of annotations on this page.Gets the number of annotations on a page. Annotations associated with pop-up windows (such as strikeouts) are counted as two annotations. Widget annotations (form fields) are included in the count.
getOutputPreviewImage
ImagegetOutputPreviewImage(RectexportRect, PageImageParamsImageParams, java.util.List< SeparationColorSpace >spaces)Parameters
exportRect: RectA Rect describing the region of the page to export, specified in user space coordinates. One user unit corresponds to 1/72 inch. To export the entire page, set this parameter to the page's CropBox. User space coordinates correspond to the unrotated page; the rotation specified in Page.Rotation is not taken into account with these coordinates.
ImageParams: PageImageParamsA PageImageParams containing additional parameters for the exported image, including the exported image's pixel width, pixel height, and resolution. If these parameters are not specified, the pixel width and pixel height of the image are calculated using the exportRect and a resolution of 300.0.
spaces: java.util.List< SeparationColorSpace >A collection of SeparationColorSpace class additional parameter for specifying colorants for bitmap rendering. Each SeparationColorSpace must be constructed from an ink and a page.
Returns:
ImageCreate an Output Preview image used when Soft Proofing a document prior to actual printing.
getOutputPreviewImage
ImagegetOutputPreviewImage(RectexportRect, PageImageParamsImageParams, java.util.List< SeparationColorSpace >spaces, booleansimulateOverprint)Parameters
exportRect: RectA Rect describing the region of the page to export, specified in user space coordinates. One user unit corresponds to 1/72 inch. To export the entire page, set this parameter to the page's CropBox. User space coordinates correspond to the unrotated page; the rotation specified in Page.Rotation is not taken into account with these coordinates.
ImageParams: PageImageParamsA PageImageParams containing additional parameters for the exported image, including the exported image's pixel width, pixel height, and resolution. If these parameters are not specified, the pixel width and pixel height of the image are calculated using the exportRect and a resolution of 300.0.
spaces: java.util.List< SeparationColorSpace >A collection of SeparationColorSpace class additional parameter for specifying colorants for bitmap rendering. Each SeparationColorSpace must be constructed from an ink and a page.
simulateOverprint: booleanA flag that controls if Overprint is simulated or not for Spot Colorants. NOTE: A file with Overprinting, Process, and Spot Colorants can yield a different appearance when Simulation is enabled compared to when it's not.
Returns:
ImageCreate an Output Preview image used when Soft Proofing a document prior to actual printing.
getPDFDict
PDFDictgetPDFDict()Returns:
PDFDictRetrieve the PDFObject representation of this object.
getPageNumber
intgetPageNumber()Returns:
the number of this page in the Document.Retrieve the page number for this PDF page.
Page numbers always start at zero.
getRenderWarnings
intgetRenderWarnings()Returns:
A bitfield to be compared against PageRenderWarning Enum values.Reports possible page rendering problems.
getRotation
PageRotationgetRotation()Returns:
PageRotationThe number of degrees by which the page is rotated clockwise when displayed or printed.
getTrimBox
RectgetTrimBox()Returns:
RectGet the page's TrimBox.
getUserUnit
floatgetUserUnit()Returns:
the size of default user space units.Gets the size of default user space units for the page.
hasTransparency
booleanhasTransparency(booleanincludeAnnotAppearances)Parameters
includeAnnotAppearances: booleanIf true, annotation appearances are included in the check; if false, annotation appearances will be ignored.
Returns:
booleanChecks whether a page uses any transparency features.
Note: To determine whether a page uses transparency, the resources of the page must be enumerated (though the page contents do not need to be parsed). The page resources may not be optimized for slow (browser-based) connections, so calling Page.HasTransparency() before the page has been downloaded may cause unpleasant read behavior and performance problems.
listInks
java.util.List< Ink >listInks()Returns:
java.util.List< Ink >Retrieve a list of all inks present on a page.
listInks
java.util.List< Ink >listInks(booleanincludeOPI)Parameters
includeOPI: booleanIf true, include inks contained in OPI dictionaries.
Returns:
java.util.List< Ink >Retrieve a list of all inks present on a page.
makeBufferedImage
java.awt.image.BufferedImagemakeBufferedImage(RectexportRect, PageImageParamspip)Parameters
exportRect: RectA Rect describing the region of the page to export, specified in user space coordinates. One user unit corresponds to 1/72 inch. To export the entire page, set this parameter to the page's CropBox. User space coordinates correspond to the unrotated page; the rotation specified in Page.Rotation is not taken into account with these coordinates.
pip: PageImageParamsAdditional parameters for the exported image, including the exported image's pixel width, pixel height, and resolution. If these parameters are not specified, the pixel width and height of the returned image are calculated using the exportRect and a resolution of 300.0.
Returns:
java.awt.image.BufferedImageExport a region of a PDF page to a java.awt.BufferedImage.
A particular size in pixels can be specified for the exported Bitmap by setting ImageParams.PixelWidth and/or ImageParams.PixelHeight.
If the exportRect is smaller than the PDF page and pip.PixelWidth and pip.PixelHeight are set, then the resulting image will be of the size pip.PixelWidth x pip.PixelHeight and contain the area of the page inside the exportRect, scaled to fit.
It is also possible to use this function by specifying only pip.PixelWidth or only pip.PixelHeight. When only one is specified, the function will calculate the other.
makeSeparations
voidmakeSeparations(SeparationParamsparams)Parameters
params: SeparationParamsParameters for the separation generation, including a list of plates.
Returns:
voidGenerate print color separations for a page.
recognizePageContents
Parameters
Returns:
voidRun optical character recognition (OCR) on a page.
removeAnnotation
voidremoveAnnotation(intannotIndex)Parameters
annotIndex: intThe index (into the page's annotation array) of the annotation to remove.
Returns:
voidRemoves an annotation from the specified page. Annotations are stored in arrays, which are automatically compressed when an annotation is removed. For this reason, if you use a loop in which you remove annotations, structure the code so the loop processes from the highest to the lowest index. If you loop the other direction, you will skip over annotations immediately following ones you remove.
setArtBox
voidsetArtBox(Rectr)Parameters
r: Rect
Returns:
voidSet the page's ArtBox.
setBleedBox
voidsetBleedBox(Rectr)Parameters
r: Rect
Returns:
voidSet the page's BleedBox.
setCropBox
voidsetCropBox(Rectr)Parameters
r: Rect
Returns:
voidSet the page's CropBox.
setMediaBox
voidsetMediaBox(Rectr)Parameters
r: Rect
Returns:
voidSet the page's MediaBox.
setRotation
voidsetRotation(PageRotationrotation)Parameters
rotation: PageRotation
Returns:
voidThe number of degrees by which the page is rotated clockwise when displayed or printed.
setTrimBox
voidsetTrimBox(Rectr)Parameters
r: Rect
Returns:
voidSet the page's TrimBox.
setUserUnit
voidsetUserUnit(floatuserUnit)Parameters
userUnit: floatthe size of default user space units.
Returns:
voidSets the size of default user space units for the page.
updateContent
voidupdateContent()Returns:
voidSets the page's Content back into the Page, using the same compression filters with which the content was previously encoded.
Call this function after making any changes to the Page's content.