Platforms to show: All Mac Windows Linux Cross-Platform

DynaPDFRasterImageMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class DynaPDF MBS DynaPDF Plugin 11.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The class for advanced rendering options.
Example
dim pdf as new DynaPDFMBS // make subclass to catch error event

dim f as FolderItem = SpecialFolder.Desktop.Child("dynapdf_help.pdf")

// create PDF
call pdf.CreateNewPDF(nil)
// set import flags
call pdf.SetImportFlags(pdf.kifImportAll + pdf.kifImportAsPage)

// open import file
call pdf.OpenImportFile(f, 0, "")

// import all pdf pages
call pdf.ImportPDFFile(1, 1.0, 1.0)

dim PageCount as Integer = pdf.GetPageCount

// create rasterizer.
dim r as new DynaPDFRasterizerMBS(pdf, 1000,1000)

// create options
dim o as new DynaPDFRasterImageMBS

// fill white
o.InitWhite = true

// scale to fit
o.DefScale = o.kpsFitBest

// rotate
o.Flags = o.krfRotate90

// render all pages
for i as Integer = 1 to PageCount

dim p as DynaPDFPageMBS = pdf.GetPage(i)
if r.RenderPage(p, o) then
// save to disc
dim outfile as FolderItem = SpecialFolder.Desktop.Child("page "+Format(i,"0")+".jpg")
call outfile.SaveAsJPEGMBS(r.Pic, 75)
end
next

This class is named RasterImage due to the name in the underlying DynaPDF library. A better name would be RasterizerOptions as it includes options for the rasterizer engine.

Picture Scaling Constants

Constant Value Description
kpsFitBest 2 Scale the page so that it fits fully into the image buffer.
kpsFitHeight 1 Scale the page to the height of the image buffer.
kpsFitWidth 0 Scale the page to the width of the image buffer.

Raster Flag Constants

Constant Value Description
krfClipToArtBox 4 Clip the page to the art box if any.

Only one of these clip flags must be set at time!
krfClipToBleedBox 8 Clip the page to the bleed box if any.

Only one of these clip flags must be set at time!
krfClipToTrimBox 16 Clip the page to the bleed box if any.

Only one of these clip flags must be set at time!
krfCompositeWhite &h00001000 Composite pixel formats with an alpha channel finally with a white background. The alpha channel is 255 everywhere after composition. This flag is mainly provided for debug purposes but it can also be useful if the image must be copied on screen with a function that doesn't support alpha blending.
krfDefault 0 Render the page as usual
krfDisableAAClipping &h00200000 Disable Anti-Aliasing for clipping paths. This flag is the most important one since clipping paths cause often visible artefacts in PDF files with flattened transparency.
krfDisableAAText &h00400000 Disable Anti-Aliasing for text.
krfDisableAAVector &h00800000 Disable Anti-Aliasing for vector graphics.
krfDisableAntiAliasing &h00E00000 Fully disable Anti-Aliasing.
krfDisableBiLinearFilter &h01000000 Disable the BiLevel filter for images. Sometetimes useful if sharp images are needed, e.g. for barcodes.
krfEnableBlendCS &h10000000 If set, the page is rendered in the color space of the page group, soft proof color space, or output intent (if set), and finally converted to the destination colorspace.
krfExclAnnotations 32 Don't render annotations.
krfExclButtons &h00004000 If you want to render specific field types with RenderAnnotOrField() then use this flag to exclude buttons.
If all fields should be skipped then set the flag rfExclFormFields instead.
krfExclCheckBoxes &h00008000 Exclude check boxes. more
krfExclComboBoxes &h00010000 Exclude combo boxes. more
krfExclFormFields 64 Don't render form fields.
krfExclListBoxes &h00020000 Exclude listbox fields. more
krfExclPageContent &h00002000 If set, only annotations and form fields will be rendered (if any).
krfExclSigFields &h00080000 Exclude signature fields. more
krfExclTextFields &h00040000 Exclude text fields. more
krfForceInterpolation &h40000000 If set, image interpolation will be applied.
krfIgnoreCropBox 2 Ignore the crop box and render anything inside the media box without clipping.
krfInitBlack &h00000800 Initialize the image buffer to black before rendering (RGBA or GrayA must be initialized to black)
krfRenderInvisibleText &h02000000 If set, treat text rendering mode Invisible as Normal.
krfRenderPrintState &h20000000 If set, the print state of layers, annotations, and form fields will be rendered.
krfRotate180 &h00000200 Rotate the page 180 degress.
krfRotate270 &h00000400 Rotate the page 270 degress.
krfRotate90 &h00000100 Rotate the page 90 degress.
Example
krfScaleToBBox &h00100000 Considered only, if the flag rfClipToArtBox, rfClipToBleedBox, or rfClipToTrimBox is set.
If set, the picture size is set to the size of the whished bounding box.
krfScaleToMediaBox 1 Render the real paper format. Contents outside the crop box is clipped.
krfSkipUpdateBG &h00000080 Don't generate an update event after initializing the background to white.

This class has no sub classes.

Some methods using this class:

Some examples using this class:

Blog Entries

Release notes


The items on this page are in the following plugins: MBS DynaPDF Plugin.


DynaPDFPrintSettingsMBS   -   DynaPDFRasterizerMBS


The biggest plugin in space...