ios preClose pdf document - prepare for signing, compute hash, save to memory

Hi,

has PDFTron for iOS something like preparing the document before signing? Something like the method document.preClose()?

I will explain. I have a pdf document that has filled the form data. Just before signing, I want to calculate the hash pdf document, prepare the signature ("Contents" in the signature field in "V" - dictionary parameter).

My questions:
1. How to prepare a document for signing, that means it will no longer change, and the hash must always be the same?

2. How to save the document as a byte array?

3. How to calculate a document hash (SHA256) using PDFTron?

Thanks,
LP

Something like the method document.preClose()?
Can you please elaborate on where you see this method?

1. How to prepare a document for signing, that means it will no longer change, and the hash must always be the same?

You will need to add or create a digital signature.

This sample shows you how to generate hash for the document. You don’t have to calculate it yourself, the PDFTron SDK does it for you.
DigitalSignatures: https://www.pdftron.com/documentation/samples#digitalsignatures

Please also look at the following samples:
For adding (InteractiveForms): https://www.pdftron.com/documentation/samples#interactiveforms

2. How to save the document as a byte array?

Please check Save and SaveToBuf method descriptions from the link below:
https://www.pdftron.com/api/ios/pdftron/Classes/PTPDFDoc.html#/c:objc(cs)PTPDFDoc(im)Save:flags:
https://www.pdftron.com/api/ios/pdftron/Classes/PTPDFDoc.html#/c:objc(cs)PTPDFDoc(im)SaveToBuf:

Read & Write a PDF File From/To Memory Buffer:
https://www.pdftron.com/documentation/samples#pdfdocmemory

3. How to calculate a document hash (SHA256) using PDFTron?

Please see the following forum post: https://groups.google.com/forum/#!searchin/pdfnet-sdk/hash|sort:date/pdfnet-sdk/H9tGP4Z9TW4/rNdk3SjABwAJ
Also, DigitalSignature sample https://www.pdftron.com/documentation/samples#digitalsignatures

-Yasser