Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  

PDFKit.GetPDFPageImage

Renders an image of a page in a PDF document.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
PDFKit 2.1 Yes No Yes, macOS only No No

MBS( "PDFKit.GetPDFPageImage"; PDF; index { ; ImageType; Filename; DPI; box; ClearBackground } )

Parameters

Parameter Description Example value
PDF A container value with the PDF content from a media field. Or a text with an URL. Or a PDF reference from PDFKit.Open.
index The index of the page. From zero to PDFKit.GetPDFPageCount-1. 1
ImageType Optional
The type of image to return. Either JPEG, PNG, GIF or BMP. Default is JPEG.
"JPEG"
Filename Optional
The filename to use for the picture. Default is "image" with the extension matching the image type.
"test.jpg"
DPI Optional
The DPI to use for the resolution of the image. Default is 72.
72
box Optional
The PDF box to use. Can be Media Box = 0, Crop Box = 1, Bleed Box = 2, TrimBox = 3 or ArtBox = 4. If the box is not defined, we fall back to the media box. Default is 0.
1
ClearBackground Optional
Optionally, whether to have a transparent background (1) vs. a white background (0). Default is 0 for white. For JPEG, you can't pass 1.
0

Result

Returns a container with a JPEG picture of the PDF page. You can store it in a media field.

Description

Renders an image of a page in a PDF document.
With plugin version 2.4 you can specify format with ImageType parameter.

Due to bugs in Apple’s PDFKit you may see memory leaks with JPEG data from PDF pages (seen in macOS 10.12).
For Windows, Linux or iOS, please check DynaPDF.RenderPage or DynaPDF.GeneratePreview function.

Examples

Render page 2 of a PDF into a picture

MBS( "PDFKit.GetPDFPageImage"; $ref; 1; "jpeg"; "test.pdf"; 300; 1 )

Render first page of a PDF in a container:

MBS( "PDFKit.GetPDFPageImage"; TableName::ContainerFieldName; 0; "jpeg"; "image.jpg" )

See also

Example Databases


PDFKit.GetPDFPageFormattedText   -   PDFKit.GetPDFPagePDF

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins