Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
13.5
Statistic
FMM
Blog
Adds a preview picture to a PDF container.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 4.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
PDFContainer | The input PDF container value. Must contain a PDF file. | MyTable::PDFContainer | |
OnlyImage | Default is 0. But if you pass 1, the plugin does not return the PDF data in the result, but only the preview. | 0 | Optional |
ImageName | If OnlyImage is 1, you can specify a file name for the image result. | "preview.jpg" | Optional |
Password | Available in MBS FileMaker Plugin 11.4 or newer. The password to decrypt the file. |
$password | Optional |
Returns updated container value or error.
See also GeneratePreview function in DynaPDF manual.
Add a preview to PDF container
# does container have jpeg preview?
If [MBS( "Container.GetTypeSize" ; test::pdf; "JPEG") <= 0]
# Add preview to PDF in container
Set Field [test::pdf; MBS("DynaPDF.GeneratePreview"; test::pdf)]
End If
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 ]
Make preview picture from PDF with password:
Set Field [ Contacts::Photo Container ; MBS( "DynaPDF.GeneratePreview"; Contacts::PDFFile; 1; "test.jpg"; "secret" ) ]
This function checks for a license.
Created 18th August 2014, last changed 24th March 2022