Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.SaveAndSignFileExt1
Saves and signs the current PDF.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 13.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference returned from DynaPDF.New. | |||
ContactInfo | The contact info. | Optional | |
Location | Signers location string | $location | Optional |
Reason | Reason string. | $reason | Optional |
Signer | Signers name string | $signer | Optional |
SignatureSize | The byte size for the signature expected. This is an estimate on how much space to reserve in the PDF. Default is 2048 bytes, enough for a 1024 bit signature. You may sign a dummy text to check how big the signature is before signing the PDF. |
Optional | |
useDetached | Pass 1 to return data to sign instead of SHA1 hash of data to sign. Be aware that the data to sign with detached mode can be several megabytes big depending on the PDF size. |
0 | Optional |
Result
Returns hex text 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).
No preview picture is added. Please use DynaPDF.GeneratePreview function if this is needed.
Same as DynaPDF.SaveAndSignFileExt, you need to create the signature and then call DynaPDF.SaveAndSignFileExt2 function to pass the final signature as hex string.
Returns hex encoded hash to sign.
As of v13.1 we have no MBS function to perform such a signature, but.we may add that if needed. But this function was made for people using external hardware to perform the signature.
If you have an open page, we close it automatically for you before doing the import.
Examples
Start signing process:
Set Variable [ $hash ; Value: MBS("DynaPDF.SaveAndSignFileExt1"; $pdf; "Test User"; "Chicago"; "") ]
Manually sign PDF content:
# manually load certificate and key
Set Variable [ $pkcs12 ; Value: MBS( "PKCS12.ReadFromFile"; "/Users/cs/Desktop/test_cert.pfx"; "123456") ]
# sign a test string to know size in advance
Set Variable [ $SampleSignature ; Value: MBS( "PKCS12.SignData"; $pkcs12; "hex"; "C9097E23869BC9903CE89E9562230C6FDCBC0F06"; ""; "hex"; "" ) ]
Set Variable [ $estimatedSignatureSize ; Value: Length($SampleSignature) / 2 + 5 ]
# now save and produce hash
Set Variable [ $hashToSign ; Value: MBS("DynaPDF.SaveAndSignFileExt1"; $pdf; "My ContactInfo"; "My Location"; "My Reason"; "My Signer"; $estimatedSignatureSize) ]
# sign the hash
Set Variable [ $Signature ; Value: MBS( "PKCS12.SignData"; $pkcs12; "hex"; $HashToSign; ""; "hex"; "" ) ]
# and finish the PDF
Set Field [ Merge PDFs::MergeStatus ; MBS("DynaPDF.SaveAndSignFileExt2"; $pdf; $signature; "Merged.pdf") ]
See also
- DynaPDF.GeneratePreview
- DynaPDF.New
- DynaPDF.Save
- DynaPDF.SaveAndSignFile
- DynaPDF.SaveAndSignFileExt
- DynaPDF.SaveAndSignFileExt2
- DynaPDF.SaveAndSignFileWinCrypt
- PKCS12.ReadFromFile
- PKCS12.SignData
Release notes
- Version 13.4
- Added new parameter useDetached for DynaPDF.SaveAndSignFileExt1 function.
- Version 13.1
- Added DynaPDF.SaveAndSignFileExt1 and DynaPDF.SaveAndSignFileExt2 functions to sign a PDF using external PKCS7 signature provider.
Example Databases
Blog Entries
- Neues MBS Plugin 13.4 für Claris FileMaker
- MBS Plugin 13.4 for Claris FileMaker - More than 7100 Functions In One Plugin
- MBS FileMaker Plugin, version 13.4pr1
- New in MBS FileMaker Plugin 13.1
- Neues MBS Plugin 13.1 für Claris FileMaker
- MBS Plugin 13.1 for Claris FileMaker
- MBS FileMaker Plugin, version 13.1pr1
This function checks for a license.
Created 18th January 2023, last changed 25th September 2024