Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

PDFKit.GetPDFDocument

Creates a new PDF Document with the given PDF document.

Component Version macOS Windows Linux Server iOS SDK
PDFKit 2.2 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "PDFKit.GetPDFDocument"; PDF { ; FileName } )   More

Parameters

Parameter Description Example Flags
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.
FileName Optionally, the file name to use for the container value. "output.pdf" Optional

Result

Returns a container with a PDF document. The plugin adds a JPEG picture for preview as well as a file name. You can store it in a media field.

Description

Creates a new PDF Document with the given PDF document.
Filename is optional. When you use an URL for the PDF, you can basically load a new PDF from a server.
See Plugin.SetPreviewSize to control size of preview picture.

PDFKit does not guarantee preservation of the original PDF version. In practice it often rewrites the document as PDF 1.3/1.4 style content and may flatten or discard features it cannot represent in its writer.
Typical things that can be lost when a PDF 1.5/1.6/1.7 document is rewritten include:
  • Transparency groups
  • Optional content layers
  • Object streams (introduced in PDF 1.5)
  • XFA forms
  • Certain annotations
  • Embedded multimedia
  • Advanced compression structures
  • Some vendor-specific extensions
As a result, a PDF that displays correctly when opened can become incomplete after being re-saved through PDFKit.
You may use DynaPDF functions if you need anything from the above.

Examples

Save a PDF in a PDF reference into a container value:

MBS( "PDFKit.GetPDFDocument"; $ref; "test.pdf" )

Create PDF from images:

# Start new document
Set Variable [$doc; Value:MBS("PDFKit.NewPDFDocument")]
# Add image in full size as new page
Set Variable [$r; Value:MBS("PDFKit.AddImagePage"; $doc; test::image)]
# Add empty page in default size
Set Variable [$r; Value:MBS("PDFKit.AddEmptyPage"; $doc)]
# Add image in given size as new page:
Set Variable [$r; Value:MBS("PDFKit.AddImagePage"; $doc; test::image; 400; 300)]
# get PDF document and store in container:
Set Field [test::test; MBS("PDFKit.GetPDFDocument"; $doc)]
# release memory
Set Variable [$r; Value:MBS("PDFKit.Release"; $doc)]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 12nd June 2026


PDFKit.GetPDFAttribute - PDFKit.GetPDFPageCount


MarkDown version: PDFKitGetPDFDocument.md