Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
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 |
Parameter | Description | Example |
---|---|---|
Container | A media value containing PDF data. |
Returns updated container value or error.
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 ]
This function checks for a license.
Created 17th October 2017, last changed 3th May 2023