Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
PDFKit.GeneratePreview
Adds preview to an existing PDF container.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
PDFKit | 7.5 | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
Container | A media value containing PDF data. |
Result
Returns updated container value or error.
Description
Adds preview to an existing PDF container.For Windows or Linux, please use DynaPDF.GeneratePreview.
See Plugin.SetPreviewSize for setting resolution of previews.
If called on Windows, will internally run WinPDF.GeneratePreview function.
Examples
Generate preview:
Set Field [ Merge PDFs::FinalPDF ; MBS("PDFKit.GeneratePreview"; Merge PDFs::InputPDF) ]
Add a preview to PDF container if needed:
# get a PDF somewhere
Set Variable [ $PDF ; Value: MBS( "Files.ReadFile"; "C:\Users\Christian\Desktop\test.pdf"; "auto") ]
# Does have PDF and no image?
Set Variable [ $types ; Value: MBS( "Container.GetTypes"; $PDF) ]
# PDF included?
If [ Position ( $types ; "PDF " ; 1 ; 1 ) > 0 ]
# Image preview missing?
If [ Position ( $types ; "JPEG" ; 1 ; 1 ) < 1 and Position ( $types ; "PNGf" ; 1 ; 1 ) < 1 ]
# Use DynaPDF if initialized, we can use it
If [ MBS( "DynaPDF.IsInitialized" ) ]
Set Variable [ $PDF2 ; Value: MBS( "DynaPDF.GeneratePreview"; $PDF) ]
If [ MBS("IsError") = 0 ]
# Success, so use the new PDF
Set Variable [ $PDF ; Value: $PDF2 ]
End If
Else If [ MBS( "IsMacOSX" ) = 1 ]
# On Mac use PDFKit
Set Variable [ $PDF2 ; Value: MBS( "PDFKit.GeneratePreview"; $PDF) ]
If [ MBS("IsError") = 0 ]
# Success, so use the new PDF
Set Variable [ $PDF ; Value: $PDF2 ]
End If
End If
End If
End If
# Store PDF with preview
Set Field [ test::Image ; $PDF ]
See also
- Container.GetType
- Container.GetTypes
- DynaPDF.GeneratePreview
- DynaPDF.IsInitialized
- Files.ReadFile
- IsError
- Plugin.SetPreviewSize
- WinPDF.GeneratePreview
Release notes
- Version 13.2
- Implemented PDFKit.GeneratePreview for Windows by using WinPDF functions.
- Version 11.2
- Improved memory usage of Container.ReadImage, PDFKit.GeneratePreview and PDFKit.GetPDFPageImage functions, especially for server.
- Version 7.5
- Added PDFKit.GeneratePreview.
Blog Entries
- Windows PDF Functions
- MBS FileMaker Plugin, version 13.2pr1
- Render pictures from PDF
- MBS FileMaker Plugin, version 11.2pr4
- MBS FileMaker Plugin, version 7.5pr3
This function checks for a license.
Created 17th October 2017, last changed 3th May 2023