« Load PDF from MS SQL … | Home | Windows PDF Classes »

Windows PDF Functions

Since Microsoft added some PDF functions to their frameworks in Windows 10, we can now implement this to our MBS FileMaker Plugin. That got possible since we dropped Windows 7 and require newer functions for component management in Windows 8. For MBS FileMaker Plugin 13.2, we add the new functions for you to try out:

WinPDF.GeneratePreview
Adds preview to an existing PDF container.
WinPDF.IsPasswordProtected
Whether this document is password-protected.
WinPDF.LoadContainer
Loads a PDF document from data in container.
WinPDF.LoadFile
Loads a PDF document from file synchronously.
WinPDF.PageBox
Queries page dimensions.
WinPDF.PageCount
Gets the number of pages in the Portable Document Format (PDF) document.
WinPDF.PageHeight
Queries page height.
WinPDF.PageImage
Renders a page to an image.
WinPDF.PageImageAtSize
Renders a page to an image.
WinPDF.PagePreferredZoom
Gets the Portable Document Format (PDF) page's preferred magnification factor.
WinPDF.PageRotation
Queries rotation for a page.
WinPDF.PageWidth
Queries page width.
WinPDF.Release
Releases an object reference.

The key feature is to open PDF documents and render preview pictures for individual pages. The functions do not things like merge and split, form controls or creating of new PDF documents. For that, please use our DynaPDF functions.

The WinPDF.LoadContainer function can load a PDF from a container while WinPDF.LoadFile takes a native file path. The loading is synchronously, so this may take a second for bigger documents.

Once the document is loaded, you can query page count with WinPDF.PageCount functions. Then you can loop over the pages and query page size for each page, the preferred zoom level or the rotation. Dimensions can be queried for all page boxes:

  • Media Box, the size of the paper
  • Art Box, the size of the content, which should not be covered later.
  • Bleed Box, the area to draw to, usually bigger than trim box.
  • Trim Box, where to cut the paper after printing.
  • Crop Box, the area to show or print.

Most of them are optional we usually just use Media Box to show whole page. Or on processing the pages, we may use crop box (if exists) to only show the cropped part.

You can render the page to a picture. The WinPDF.PageImage function returns a container with picture data encoded in either JPEG, PNG, TIFF or BMP. This can be configured with the parameters to request a specific image type or DPI level. If you need a specific width or height, you can use WinPDF.PageImageAtSize function instead.

Finally we have a function called WinPDF.GeneratePreview to add a preview to a PDF container after importing it. The function uses PDFKit on macOS and Windows PDF functions on Windows and is an alias for PDFKit.GeneratePreview function. If you need something cross platform (with Linux), you can use DynaPDF.GeneratePreview function and enjoy better rendering.

Another thing we could make it a comparison of the preview graphics and check how much Microsoft implemented on the more special cases. Like checking for gradients, spot colors, CMYK colors and embedded image formats. PDFKit functions on macOS also has a few limits there, so if you need full coverage, you may want to check out DynaPDF functions.

Please don't hesitate to contact us if you have questions.

11 04 23 - 07:38