Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Renders a page in current PDF to an image.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 3.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference returned from DynaPDF.New. | |||
PageIndex | The page number between 1 and DynaPDF.GetPageCount. | 1 | |
Resolution | The resolution you'd like to have for the image. If you pass zero, we use default resolution (72). | 150 | Optional |
Width | The width of the output image. Can be zero to use page width or to scale based on height. | 800 | Optional |
Height | The height of the output image. Can be zero to use page height or to scale based on width. | 600 | Optional |
Flags | Flags for rendering. Use 0 for the default flags. For other values, please look into dynapdf manual. With version 6.4 of our plugin, you can also specify this by passing in text string, e.g. "Rotate90¶ClipToTrimBox" Valid flags: Default, ScaleToMediaBox, IgnoreCropBox, ClipToArtBox, ClipToBleedBox, ClipToTrimBox, ExclAnnotations, ExclFormFields, SkipUpdateBG, Rotate90, Rotate180, Rotate270, InitBlack, CompositeWhite, ExclPageContent, ExclButtons, ExclCheckBoxes, ExclComboBoxes, ExclListBoxes, ExclTextFields, ExclSigFields, ScaleToBBox, DisableAAClipping, DisableAAText, DisableAAVector, DisableAntiAliasing, DisableBiLinearFilter, ClipBoxMask, RenderInvisibleText. |
0 | Optional |
PixelFormat | The pixel format. Can be 1bit, gray, RGB, BGR, RGBA, BGRA, ARGB, ABGR, CMYK, CMYKA and GrayA. Default is RGB. | "RGB" | Optional |
Filter | The compression filter to use. Can be Flate, JPEG, CCITT3, CCITT4, LZW or JP2K. Default is JPEG. | "JPEG" | Optional |
Format | The image format to use. Can be TIFF, JPEG, PNG, BMP or JPC. Default is JPEG. | "JPEG" | Optional |
Filename | The file name to use for the container value. Default is page with right file extensions for image. Pass any value if you use DestPath parameter. | $name | Optional |
DestPath | Optional, a file path for storing image instead of a container. | "/Users/cs/Desktop/test.jpg" | Optional |
Returns container value with image or error message.
Render page 5 with default options:
$ImageData = MBS( "DynaPDF.RenderPage"; $PDF; 5 )
Render page 5 with higher resolution:
$ImageData = MBS( "DynaPDF.RenderPage"; $PDF; 5; 150 )
Render page 5 to file:
$result = MBS( "DynaPDF.RenderPage"; $PDF; 5; 150; 0; 0; 0; "RGB"; "JPEG"; "JPEG"; ""; "/Users/cs/Desktop/test.jpg" )
Open PDF and render page as image to container:
# Start new PDF workspace
Set Variable [$pdf; Value:MBS("DynaPDF.New")]
# Load PDF from container
Set Variable [$r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Test::data)]
# Import all pages
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf)]
# Render one page as Picture
Set Variable [$r; Value:MBS("DynaPDF.RenderPage"; $pdf; Test::PageIndex)]
# Put in Container
Set Field [Test::PageImage; $r]
# cleanup
Set Variable [$r; Value:MBS("DynaPDF.Release"; $pdf)]
Render in one formula:
// input: PDFDocumentContainer
Let (
[
~PDFObject = MBS("DynaPDF.New");
~error = MBS("IsError");
~x = MBS("DynaPDF.OpenPDFFromContainer"; ~PDFObject; PDFDocumentContainer);
~error = ~error OR MBS("IsError");
~x = MBS("DynaPDF.ImportPDFPage"; ~PDFObject; 1);
~error = ~error OR MBS("IsError");
~PageIndex = 1;
~Resolution = 150 ;
~Width = 0;
~Height = 0;
~Flags = 0;
~PixelFormat = "RGB";
~Filter = "JPEG";
~Format = "PNG";
~Result = MBS("DynaPDF.RenderPage"; ~PDFObject; ~PageIndex ; ~Resolution; ~Width; ~Height; ~Flags; ~PixelFormat; ~Filter; ~Format);
~error = ~error OR MBS("IsError");
~x = MBS("DynaPDF.Release"; ~PDFObject)];
If(~error; ""; ~Result))
Created 18th August 2014, last changed 2nd November 2020
DynaPDF.RenderPDFFileEx - DynaPDF.ReplaceImage
Feedback: Report problem or ask question.