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: 9.5   10.0   10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2    Statistic    FMM    Blog  

DynaPDF.SaveAndSignFileExt

Saves and signs the current PDF.

Component Version macOS Windows Linux Server FileMaker iOS SDK
DynaPDF 11.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.SaveAndSignFileExt"; PDF; PKCS12 Reference { ; Reason; Location; Signer; FileName; Preview } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
PKCS12 Reference The reference to the PKCS12.
See PKCS12.ReadFromContainer or PKCS12.ReadFromFile to load a PKCS#12 file.
$pkcs12
Reason Reason string. $reason Optional
Location Signers location string $location Optional
Signer Signers name string $signer Optional
FileName The file name to be associated with the container value.
The file name should include pdf file extension.
"hello.pdf" Optional
Preview Whether to include a preview JPEG.
Default is 1 for including one. Pass zero to disable preview.
1 Optional

Result

Returns OK or error.

Description

Saves and signs the current PDF.
On success you either get back the PDF as container value (in memory PDF) or it returns OK after writing PDF to file (file based PDF).
The plugin also renders a JPEG for preview and includes it within the container value (with DynaPDF Pro).

Same as DynaPDF.SaveAndSignFile, but the signing is done by MBS plugin itself instead of DynaPDF. You pass the PKCS#12 key and certificate by reference number. This way we can support more keys than DynaPDF directly, e.g. with 2048 or 4096 bits.

Examples

Sign a PDF with PKCS#12 key:

# Initialize DynaPDF if needed
If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
    Perform Script [ Specified: From list ; “InitDynaPDF” ; Parameter: ]
End If
# New PDF
Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
#
# output to file
Set Variable [ $destPath ; Value: MBS("Folders.UserDesktop") & "/test.pdf" ]
Set Variable [ $r ; Value: MBS("DynaPDF.OpenOutputFile"; $pdf; $destPath) ]
#
# Load PDF from container
Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Merge PDFs::InputPDF) ]
Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
#
# or sign it on saving
Set Variable [ $pkey ; Value: MBS( "PKCS12.ReadFromFile"; "/Users/cs/Desktop/test_cert.pfx"; "123456" ) ]
Set Field [ Merge PDFs::MergeStatus ; MBS("DynaPDF.SaveAndSignFileExt"; $pdf; $pkey; "Hello"; "World"; ""; "Merged.pdf") ]
#
# cleanup
Set Variable [ $r ; Value: MBS( "PKCS12.Release"; $pkey) ]
Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ]

See also

Release notes

Blog Entries

Created 8th January 2021, last changed 8th January 2021


DynaPDF.SaveAndSignFile   -   DynaPDF.SaveAndSignFileWinCrypt

Feedback: Report problem or ask question.




Links
MBS FileMaker Plugins

Start Chat