Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5   8.6    Statistic  

PDFKit.GeneratePreview

Adds preview to an existing PDF container.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
PDFKit 7.5 Yes No Yes, macOS only No Yes
MBS( "PDFKit.GeneratePreview"; Container )   More

Parameters

Parameter Description Example value
Container A media value containing PDF data.

Result

Returns OK or error.

Description

Adds preview to an existing PDF container.
For Windows or Linux, please use DynaPDF.GeneratePreview.

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

Blog Entries

Created 17th October 2017, last changed 11st February 2018


PDFKit.CombineRef   -   PDFKit.GetCurrentFilter

Feedback: Report problem or ask question.




Links
MBS Xojo PDF Plugins