Platforms to show: All Mac Windows Linux Cross-Platform

Back to DynaPDFMBS class.

Previous items Next items

DynaPDFMBS.RenderPageToImage(PageNumber as UInt32, OutFile as folderitem, Resolution as UInt32, Width as UInt32, Height as UInt32, Flags as UInt32, PixFmt as UInt32, Filter as UInt32, Format as UInt32) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function renders a PDF page into an image.
Example
dim pdf as new MyDynaPDFMBS // your DynaPDF subclass with Error event filled

// where to get PDF page
dim f as FolderItem = SpecialFolder.Desktop.Child("test.pdf")

// where to write
dim t as FolderItem = SpecialFolder.Desktop.Child("test.jpg")

pdf.SetLicenseKey "Pro" // For this example you can use a Pro or Enterprise License

call pdf.CreateNewPDF nil
call pdf.SetImportFlags(pdf.kifImportAll + pdf.kifImportAsPage)

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

// add page
call pdf.Append

// import the page
call pdf.ImportPageEx(1,1.0,1.0)
call pdf.EndPage

// render the page
call pdf.RenderPageToImage(1, t, 72, ImageView1.Width, ImageView1.Height, DynaPDFRasterImageMBS.krfDefault, DynaPDFRasterizerMBS.kpxfRGB, DynaPDFMBS.kcfJPEG, DynaPDFMBS.kifmJPEG)

PixFmt: pass kpxf* constants like DynaPDFRasterizerMBS.kpxfRGB.
Filter: Pass kcf* constants like DynaPDFMBS.kcfJPEG.
Format: pass kifm* constants like DynaPDFMBS.kifmJPEG.

The page that should be rendered must be closed (Append() or EditPage() open a page and EndPage() closes a page).
If the parameter OutFile is set to nil the image is created in memory. In this case call GetImageBuffer() to retrieve the image buffer and finally FreeImageBuffer() to release it.

The output image size can be calculated in different ways:

  • If Resolution is > 0 the image width and height is calculated according to the specified resolution. On a 32 bit machine it is possible to render pages in up to 1200 DPI depending on the page format. Larger resolutions require special techniques like banding to restrict the memory usage. However, no such feature is available in DynaPDF.
  • If Width > 0 and if Height == 0 the image height is calculated according to the given width to archive an image with exact proportions.
  • If Width == 0 and if Height > 0 then image width is calculated according to the given height to archive an image with exact proportions.
  • If Width > 0 and if Height > 0 the image is scaled to the width and height.

The pixel format and the output image format must be compatible. Because TIFF is the only image format that supports different compression filters, the parameter Filter will be ignored for all other output formats.
If the function succeeds the return value is true. If the function fails the return value is false.
Requires DynaPDF Pro license.

Some examples using this method:

See also RenderPageToImage function in DynaPDF manual.

DynaPDFMBS.RenderPageToImageMT(PageNumber as UInt32, OutFile as folderitem, Resolution as UInt32, Width as UInt32, Height as UInt32, Flags as UInt32, PixFmt as UInt32, Filter as UInt32, Format as UInt32) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 14.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function renders a PDF page into an image.

PixFmt: pass kpxf* constants like DynaPDFRasterizerMBS.kpxfRGB.
Filter: Pass kcf* constants like DynaPDFMBS.kcfJPEG.
Format: pass kifm* constants like DynaPDFMBS.kifmJPEG.

The page that should be rendered must be closed (Append() or EditPage() open a page and EndPage() closes a page).
If the parameter OutFile is set to nil the image is created in memory. In this case call GetImageBuffer() to retrieve the image buffer and finally FreeImageBuffer() to release it.

The output image size can be calculated in different ways:

  • If Resolution is > 0 the image width and height is calculated according to the specified resolution. On a 32 bit machine it is possible to render pages in up to 1200 DPI depending on the page format. Larger resolutions require special techniques like banding to restrict the memory usage. However, no such feature is available in DynaPDF.
  • If Width > 0 and if Height == 0 the image height is calculated according to the given width to archive an image with exact proportions.
  • If Width == 0 and if Height > 0 then image width is calculated according to the given height to archive an image with exact proportions.
  • If Width > 0 and if Height > 0 the image is scaled to the width and height.

The pixel format and the output image format must be compatible. Because TIFF is the only image format that supports different compression filters, the parameter Filter will be ignored for all other output formats.
If the function succeeds the return value is true. If the function fails the return value is false.

Requires DynaPDF Pro license.

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.
If you run several threads calling MT methods, you can get all CPU cores busy while main thread shows GUI with progress window.

Some examples using this method:

DynaPDFMBS.RenderPageToPicture(PageNum as integer, pic as picture, DefScale as integer = 2, matrix as DynaPDFMatrixMBS = nil, RenderWithAlpha as boolean = false) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 11.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Renders the page into the given picture.
Example
dim pdf as new MyDynaPDFMBS

// For this example you can use a Pro or Enterprise License
pdf.SetLicenseKey "Pro"

// create in memory
call pdf.CreateNewPDF nil

// set import flags
call pdf.SetImportFlags pdf.kifImportAsPage

// open the PDF file
dim f as FolderItem = SpecialFolder.Desktop.Child("test.pdf")
call pdf.OpenImportFile(f, 0, "")

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

// create picture
dim out as new Picture(800, 600, 32)

// render first page in the existing picture
call pdf.RenderPageToPicture(1, out)

// display in window
Backdrop = out

Please note that for most cases RenderPageToImage and RenderPDFFile are better choices for rendering. Especially if you plan to compress images later anyway. And you avoid trouble with color matching. For this function to work correct you have to initialize DynaPDF with right color space for screen (Generic RGB on Mac and screen profile for Windows).

This method draws into an existing picture. The PDF page is scaled to fit size. You can use the constants kpsFitBest, kpsFitHeight or kpsFitWidth for the DefScale parameter. The matrix allows you to move, rotate or scale the PDF inside the picture.

Returns nil on any error.

This does not work on Linux desktop targets as the plugin can't write into a picture there.

If you render a lot of pages from the same PDF, consider using DynaPDFRasterizerMBS class as it's faster when you reuse the rasterizer.
Requires DynaPDF Pro license.

Added RenderWithAlpha parameter in plugin version 19.0.
If RenderWithAlpha is true, we render with alpha channel. If the destination is a picture has alpha channel, you should get the alpha there. Otherwise for picture without alpha channel, we only copy RGB channels.

DynaPDFMBS.RenderPDFFile(OutFile as folderitem, Resolution as UInt32, Flags as UInt32, PixFmt as UInt32, Filter as UInt32, Format as UInt32) as boolean   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This item is deprecated and should no longer be used. You can use RenderPDFFileEx instead.
The function renders all PDF pages which are currently in memory and stores the result in a proprietary image format.
Example
dim file as FolderItem = SpecialFolder.Desktop.Child("test.pdf")
dim pdf as new MyDynaPDFMBS

call pdf.CreateNewPDF nil
call pdf.OpenImportFile(file, 0, "")
call pdf.ImportPDFFile(1, 1.0, 1.0)

// create a TIFF file:

dim outfile as FolderItem = SpecialFolder.Desktop.Child("test.tif")

dim Flags as Integer = DynaPDFRasterImageMBS.krfDefault
dim PixFmt as Integer = DynaPDFRasterizerMBS.kpxfRGB
dim Format as Integer = DynaPDFMBS.kifmTIFF // use kifm* constants
dim Filter as Integer = DynaPDFMBS.kcfLZW // pick a compression scheme for the file format

call pdf.RenderPDFFile(outfile, 300, Flags, PixFmt, Filter, Format)

// create a folder of JPEG file:

dim outfolder as FolderItem = SpecialFolder.Desktop.Child("test files")
outfolder.CreateAsFolder

Flags = DynaPDFRasterImageMBS.krfDefault
PixFmt = DynaPDFRasterizerMBS.kpxfRGB
Format = DynaPDFMBS.kifmJPEG // use kifm* constants
Filter = DynaPDFMBS.kcfJPEG

call pdf.RenderPDFFile(outfolder, 300, Flags, PixFmt, Filter, Format)

One page PDF can go to e.g. a JPEG file.
Multi page PDF file can go to a TIFF file with several images.
Or you specify a folder and get a folder of JPEG/PNG/TIFF files.

See also RenderPDFFile function in DynaPDF manual.

DynaPDFMBS.RenderPDFFileEx(OutFile as folderitem, Resolution as UInt32, Width as Integer, Height as Integer, Flags as UInt32, PixFmt as UInt32, Filter as UInt32, Format as UInt32) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 18.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Renders all PDF pages which are currently in memory and stores the result in a proprietary image format.

The pages in memory could be imported from one or more external PDF files, e.g. with ImportPDFFile(), created with DynaPDF functions, or a combination of both.

The parameter OutFile can be a path to an existing directory or the file name of the output image. The latter type can be used with TIFF images because this format supports multi-page output. When a file path is used with a single page image format only the first page will be rendered.

The function checks whether the path is a directory or a file name.
The function can render pages in a specific resolution, or scale them to a given width or height.

Depending on which parameters are set the image size is calculated as follows:

  • Resolution > 0 and Width == 0 and Height == 0: Pages are rendered according to the given resolution. Note that PDF pages can be very large. Therefore, it is maybe not possible to render all pages in the whished resolution.
  • Resolution > 0 and Width < 0 and or Height < 0: Pages are rendered according to the given resolution. Negative values of Width and Height are interpreted as maximum width or height if Resolution is greater zero. Since PDF pages can be very large, it is recommended to set the maximum width and height to a value that is low enough so that no out of memory exception occurs, e.g. 5000 x 5000 pixels.
  • Resolution == 0 and Width > 0 or Height > 0: Pages are scaled to the given Width or Height. If Width and Height are greater zero then pages are scaled to that size independent of the original page format (not recommended). It is usually best to set the width or height to zero so that the function can calculate the missing value to preserve the aspect ratio.

On a 32 bit system it is possible to render PDF pages in RGB with up to around 1200 DPI, depending on the page format and available memory. The resolution of gray images can be higher but the encoder must be able to handle such large images. The PNG and bitmap encoders accept images in almost arbitrary resolutions but all other encoders can fail when the resolution is larger than about 2000 DPI.

The function calls the progress events.
Returns true on success or false on failure.

See also RenderPDFFileEx function in DynaPDF manual.

DynaPDFMBS.RenderPDFFileExMT(OutFile as folderitem, Resolution as UInt32, Width as Integer, Height as Integer, Flags as UInt32, PixFmt as UInt32, Filter as UInt32, Format as UInt32) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 18.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Renders all PDF pages which are currently in memory and stores the result in a proprietary image format.

The pages in memory could be imported from one or more external PDF files, e.g. with ImportPDFFile(), created with DynaPDF functions, or a combination of both.

The parameter OutFile can be a path to an existing directory or the file name of the output image. The latter type can be used with TIFF images because this format supports multi-page output. When a file path is used with a single page image format only the first page will be rendered.

The function checks whether the path is a directory or a file name.
The function can render pages in a specific resolution, or scale them to a given width or height.

Depending on which parameters are set the image size is calculated as follows:

  • Resolution > 0 and Width == 0 and Height == 0: Pages are rendered according to the given resolution. Note that PDF pages can be very large. Therefore, it is maybe not possible to render all pages in the whished resolution.
  • Resolution > 0 and Width < 0 and or Height < 0: Pages are rendered according to the given resolution. Negative values of Width and Height are interpreted as maximum width or height if Resolution is greater zero. Since PDF pages can be very large, it is recommended to set the maximum width and height to a value that is low enough so that no out of memory exception occurs, e.g. 5000 x 5000 pixels.
  • Resolution == 0 and Width > 0 or Height > 0: Pages are scaled to the given Width or Height. If Width and Height are greater zero then pages are scaled to that size independent of the original page format (not recommended). It is usually best to set the width or height to zero so that the function can calculate the missing value to preserve the aspect ratio.

On a 32 bit system it is possible to render PDF pages in RGB with up to around 1200 DPI, depending on the page format and available memory. The resolution of gray images can be higher but the encoder must be able to handle such large images. The PNG and bitmap encoders accept images in almost arbitrary resolutions but all other encoders can fail when the resolution is larger than about 2000 DPI.

The function calls the progress events.
Returns true on success or false on failure.

Same as RenderPDFFile, but multithreaded.

Requires DynaPDF Pro license.

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.
If you run several threads calling MT methods, you can get all CPU cores busy while main thread shows GUI with progress window.

DynaPDFMBS.RenderPDFFileMT(OutFile as folderitem, Resolution as UInt32, Flags as UInt32, PixFmt as UInt32, Filter as UInt32, Format as UInt32) as boolean   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 18.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This item is deprecated and should no longer be used. You can use RenderPDFFileEx instead.
The function renders all PDF pages which are currently in memory and stores the result in a proprietary image format.

Same as RenderPDFFile, but multithreaded.
Also check the dynapdf manual on the pdfRenderPDFFileA function (pdfRenderPDFFileW on Windows).

Requires DynaPDF Pro license.

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.
If you run several threads calling MT methods, you can get all CPU cores busy while main thread shows GUI with progress window.

DynaPDFMBS.ReOpenImportFile(Handle as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 13.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function re-opens a PDf file so that further contents can be imported from it.

The parameter Handle must be a valid file handle that OpenImportFile() or OpenImportBuffer() returned.
When the file is no longer needed close the parser instance with CloseImportFileEx().
If the function succeeds the return value is true. If the function fails the return value is false.

Some examples using this method:

See also ReOpenImportFile function in DynaPDF manual.

DynaPDFMBS.ReplaceFont(PDFFontRef as Integer, Name as string, Style as integer = 0, NameIsFamilyName as boolean = true) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Replaces a PDF font with another one.

The function can be called in the OnFontNotFound event of the function CheckConformance(). The return value of the event should be the return value of this function. The parameter PDFFontRef is a parameter of the event. The font reference is required and must be passed unchanged to the function.

On Linux or Unix system fonts must be loaded with AddFontSearchPath() before this function can be called. This should be done before the first PDF file is imported.

If the function succeeds the return value is zero. If the function fails the return value is a negative error code.

Some examples using this method:

See also ReplaceFont function in DynaPDF manual.

DynaPDFMBS.ReplaceFontAnsi(PDFFontRef as Integer, Name as string, Style as integer = 0, NameIsFamilyName as boolean = true) as integer   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This item is deprecated and should no longer be used. You can use the non ANSI function instead.
Replaces a PDF font with another one.

The function can be called in the OnFontNotFound event of the function CheckConformance(). The return value of the event should be the return value of this function. The parameter PDFFontRef is a parameter of the event. The font reference is required and must be passed unchanged to the function.

On Linux or Unix system fonts must be loaded with AddFontSearchPath() before this function can be called. This should be done before the first PDF file is imported.

If the function succeeds the return value is zero. If the function fails the return value is a negative error code.

See also ReplaceFont function in DynaPDF manual.

DynaPDFMBS.ReplaceFontEx(PDFFontRef as Integer, FontFile as FolderItem, Embed as boolean = true) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Replaces a PDF font with another one.

The font file can be loaded directly. It is not required to install the font on the system. The function can be called in the OnFontNotFound event of the function CheckConformance(). The return value of the event should be the return value of this function. The parameter PDFFontRef is a parameter of the event. The font reference is required and must be passed unchanged to the function.

If the function succeeds the return value is zero. If the function fails the return value is a negative error code.

See also:

See also ReplaceFontEx function in DynaPDF manual.

DynaPDFMBS.ReplaceFontEx(PDFFontRef as Integer, FontFilePath as string, Embed as boolean = true) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Replaces a PDF font with another one.

The font file can be loaded directly. It is not required to install the font on the system. The function can be called in the OnFontNotFound event of the function CheckConformance(). The return value of the event should be the return value of this function. The parameter PDFFontRef is a parameter of the event. The font reference is required and must be passed unchanged to the function.

If the function succeeds the return value is zero. If the function fails the return value is a negative error code.

See also:

See also ReplaceFontEx function in DynaPDF manual.

DynaPDFMBS.ReplaceFontExAnsi(PDFFontRef as Integer, FontFilePath as string, Embed as boolean = true) as integer   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This item is deprecated and should no longer be used. You can use the non ANSI function instead.
Replaces a PDF font with another one.

The font file can be loaded directly. It is not required to install the font on the system. The function can be called in the OnFontNotFound event of the function CheckConformance(). The return value of the event should be the return value of this function. The parameter PDFFontRef is a parameter of the event. The font reference is required and must be passed unchanged to the function.

If the function succeeds the return value is zero. If the function fails the return value is a negative error code.

See also ReplaceFontEx function in DynaPDF manual.

DynaPDFMBS.ReplaceICCProfile(ColorSpace as Integer, ICCFile as folderitem) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This function is used to dynamically create ICC based color spaces within OnReplaceICCProfile event of CheckConformance().

Use in OnReplaceICCProfile event.

Some examples using this method:

See also ReplaceICCProfile function in DynaPDF manual.

DynaPDFMBS.ReplaceICCProfileEx(ColorSpace as integer, ICCFileData as MemoryBlock) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Replaces an ICC profile exactly in the same way as ReplaceICCProfile() but accepts a file buffer as input.

If the function succeeds the return value is zero. If the function fails the return value is a negative error code.
Use in OnReplaceICCProfile event.

See also:

See also ReplaceICCProfileEx function in DynaPDF manual.

DynaPDFMBS.ReplaceICCProfileEx(ColorSpace as integer, ICCFileData as String) as integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Replaces an ICC profile exactly in the same way as ReplaceICCProfile() but accepts a file buffer as input.

If the function succeeds the return value is zero. If the function fails the return value is a negative error code.
Use in OnReplaceICCProfile event.

See also:

See also ReplaceICCProfileEx function in DynaPDF manual.

DynaPDFMBS.ReplaceImage(ImageToReplace as DynaPDFImageMBS, ImageFile as FolderItem, Index as Integer = 1, ColorSpace as Integer = 0, CSHandle as Integer = -1, Flags as Integer = 0) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Replaces an image with another image.

The parameter ImageToReplace must be a valid pointer of an image object which is retrieved by functions like GetImageObj() or ParseContent().
The resolution, aspect ratio, color space and so on can be freely chosen. However, note that this function does not change the output position or size. If the aspect ratio of the new image is different, then it will be stretched or shrinked to fit into the output rectangle.
The parameter ColorSpace specifies the destination color space into which the image should be converted or saved, if the image is already defined in that color space. CSHandle must be the handle of that color space if a non-device space is used. The will be ignored for devices spaces.

The function works in the very same way as InsertImageEx() with the following differences:
• The color of an image mask cannot be set or changed because this would require changes on the content stream in which the image is used. An image mask will be created if the image color depth is 1 bit and if color key masking is enabled (see SetUseTransparency()). SetUseTransparency() should normally be set to false before calling this function.
• The image will never be downscaled, independent of the current resolution, because the size of the output rectangle is not known.

If the image that should be replaced is a soft mask of another base image, then make sure that the destination color space is set to kesDeviceGray, kesCalGray, or to a one channel ICC based color space because a soft mask must not contain more than one color channel.
The flags kgfUseImageColorSpace, kgfIgnoreICCProfiles, kgfRealPassThrough, and kfNoBitmapAlpha are all supported. See SetGStateFlags() for further information.

If the function succeeds the return value is true. If the function fails the return value is false.

See also ReplaceImage function in DynaPDF manual.

DynaPDFMBS.ReplaceImageEx(ImageToReplace as DynaPDFImageMBS, ImageData as MemoryBlock, Index as Integer = 1, ColorSpace as Integer = 0, CSHandle as Integer = -1, Flags as Integer = 0) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Replaces an image with a new image exactly like ReplaceImage() but accepts a file buffer as input.

See ReplaceImage() for further information.

If the function succeeds the return value is 1. If the function fails the return value is 0.

See also:

See also ReplaceImageEx function in DynaPDF manual.

DynaPDFMBS.ReplaceImageEx(ImageToReplace as DynaPDFImageMBS, ImageData as String, Index as Integer = 1, ColorSpace as Integer = 0, CSHandle as Integer = -1, Flags as Integer = 0) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Replaces an image with a new image exactly like ReplaceImage() but accepts a file buffer as input.

See ReplaceImage() for further information.

If the function succeeds the return value is 1. If the function fails the return value is 0.

See also:

See also ReplaceImageEx function in DynaPDF manual.

DynaPDFMBS.ReplacePageText(text as string, stack as DynaPDFStackMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 7.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function deletes or replaces a text string of a content stream that was found by the function GetPageText() beforehand.


Be aware that ReplacePageText can't always replace text as encoding must match and fonts may not have the characters for the new text. For that better use ReplacePageTextEx.

If you have problems with asian characters, please make sure you use SetCMapDir and load the CMAPs.
Requires DynaPDF Pro license.

Some examples using this method:

See also ReplacePageText function in DynaPDF manual.

DynaPDFMBS.ReplacePageTextEx(text as string, stack as DynaPDFStackMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 7.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function deletes or replaces a text string of a content stream that was found by the function GetPageText() beforehand.

The text parameter is converted to unicode.

If you have problems with asian characters, please make sure you use SetCMapDir and load the CMAPs.
Requires DynaPDF Pro license.

See also ReplacePageTextEx function in DynaPDF manual.

DynaPDFMBS.ReplacePageTextExAnsi(text as string, stack as DynaPDFStackMBS) as boolean   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This item is deprecated and should no longer be used. You can use the non ANSI function instead.
The function deletes or replaces a text string of a content stream that was found by the function GetPageText() beforehand.

The text parameter is converted to ANSI.
Requires DynaPDF Pro license.

See also ReplacePageTextEx function in DynaPDF manual.

DynaPDFMBS.ResetAnnotAP(Handle as integer = -1) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 20.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Forces a rebuild of the appearance stream of the specified annotation.

If Handle is set to -1 all annotation appearances will be rebuild. This function be useful if an imported annotation has an invalid or empty appearance stream.

See also ResetAnnotAP function in DynaPDF manual.

DynaPDFMBS.ResetEncryptionSettings as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Resets the encryption settings which were imported from an external PDF file so that the PDF file in memory can be saved unencrypted.

If the function succeeds the return value is true. If the function fails the return value is false.

See also ResetEncryptionSettings function in DynaPDF manual.

DynaPDFMBS.ResetLineDashPattern as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function resets a previously defined line dash pattern to its default value (straight line).

See also ResetLineDashPattern function in DynaPDF manual.

DynaPDFMBS.RestoreGraphicState as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function restores a previously saved graphics state.

See also RestoreGraphicState function in DynaPDF manual.

DynaPDFMBS.RotateCoords(alpha as Double, OriginX as Double, OriginY as Double) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function rotates the coordinate system at the point OriginX, OriginY by applying a transformation matrix.

Please do not try to scale/skew/translate back later. use SaveGraphicState and RestoreGraphicState.

Some examples using this method:

See also RotateCoords function in DynaPDF manual.

DynaPDFMBS.RotateTemplate(OldTemplate as Integer, Rotation as Integer, RotateCoords as boolean = true) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 17.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Rotates a template.

Returns a new template handle.
This is a convenience function which creates a new template and draws the existing template there with rotation.
Returns negative number for errors. The plugin uses -1 for plugin errors like wrong rotation angle.

RotateCoords: Whether to rotate coordinate system.
This is now done by DynaPDF automatically, so for current version of the library, this must be false. But older versions need the true.

Some examples using this method:

DynaPDFMBS.RoundRect(PosX as Double, PosY as Double, Width as Double, Height as Double, Radius as Double, FillMode as Integer) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function draws a rectangle with rounded corners.
Example
dim pdf as new DynaPDFMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("Create PDF with Round Rectangles.pdf")

pdf.SetLicenseKey "Starter" // For this example you can use a Starter, Lite, Pro or Enterprise License

call pdf.CreateNewPDF f
call pdf.Append

dim PosX as Double = 100.0
dim PosY as Double = 100.0
dim Width as Double = 100.0
dim Height as Double = 100.0
dim Radius as Double = 20.0
dim FillMode as Integer = pdf.kfmFill

call pdf.RoundRect(PosX, PosY, Width, Height, Radius, FillMode)

PosX = 300.0
dim RadiusX as Double = 30.0
dim RadiusY as Double = 30.0

call pdf.RoundRectEx(PosX, PosY, Width, Height, RadiusX, RadiusY, FillMode)

call pdf.EndPage
call pdf.CloseFile

f.Launch

Some examples using this method:

See also RoundRect function in DynaPDF manual.

DynaPDFMBS.RoundRectEx(PosX as Double, PosY as Double, Width as Double, Height as Double, rWidth as Double, rHeight as Double, FillMode as Integer) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function draws a rectangle with elliptical corners.
Example
dim pdf as new DynaPDFMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("Create PDF with Round Rectangles.pdf")

pdf.SetLicenseKey "Starter" // For this example you can use a Starter, Lite, Pro or Enterprise License

call pdf.CreateNewPDF f
call pdf.Append

dim PosX as Double = 100.0
dim PosY as Double = 100.0
dim Width as Double = 100.0
dim Height as Double = 100.0
dim Radius as Double = 20.0
dim FillMode as Integer = pdf.kfmFill

call pdf.RoundRect(PosX, PosY, Width, Height, Radius, FillMode)

PosX = 300.0
dim RadiusX as Double = 30.0
dim RadiusY as Double = 30.0

call pdf.RoundRectEx(PosX, PosY, Width, Height, RadiusX, RadiusY, FillMode)

call pdf.EndPage
call pdf.CloseFile

f.Launch

Some examples using this method:

See also RoundRectEx function in DynaPDF manual.

DynaPDFMBS.SaveGraphicState as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function saves the current graphics state.

See also SaveGraphicState function in DynaPDF manual.

DynaPDFMBS.ScaleCoords(sx as Double, sy as Double) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function scales the coordinate system by applying a transformation matrix.

Please do not try to scale/skew/translate back later. use SaveGraphicState and RestoreGraphicState.

Some examples using this method:

See also ScaleCoords function in DynaPDF manual.

DynaPDFMBS.SelfTest as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 8.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The function checks the size of all required data types and checks whether the endian configuration of the library is correct.

See also SelfTest function in DynaPDF manual.

DynaPDFMBS.Set3DAnnotProps(Annot as Integer, ActType as Integer, DeActType as Integer, InstType as Integer, DeInstType as Integer, DisplayToolbar as boolean, DisplayModelTree as boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 9.8 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the properties of a 3D Annotation.

See also Set3DAnnotProps function in DynaPDF manual.

DynaPDFMBS.Set3DAnnotScriptAnsi(Annot as Integer, Value as string) as boolean   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
method DynaPDF MBS DynaPDF Plugin 9.8 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This item is deprecated and should no longer be used. You can use the non ANSI function instead.
Sets the 3D Annoation Script.

See also Set3DAnnotScript function in DynaPDF manual.

Previous items Next items

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


💬 Ask a question or report a problem
The biggest plugin in space...