EldoS | Feel safer!

Software components for data protection, secure storage and transfer

RemoveSignature in TElPDFDocument

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#37089
Posted: 06/23/2016 09:07:39
by Toni Santa (Standard support level)
Joined: 05/27/2013
Posts: 57

Hi,
how can I completely remove a PAdES signature from a file containing multiple signatures? I've such file:

--
1. pdf_stream
2. signature 0
3. some_pdf_modification (new comment, new page ..)
4. signature 1
--
How can I get the stream till step 3? With RemoveSignature(count-1, sroAll) and close(true), checking the resulting pdf in Adobe Reader I see a "Rev. 2, signed by .. Signature removed, field Signature2 on page 1..". I would like to have the file without this "annotations". I cannot do a ..Signature(i-1).GetSignedVersion because in this case the modifications appylied in step 3 would be missing. So I would need something like a Signature.GetUnsignedVersion

best regards
Toni
#37097
Posted: 06/23/2016 13:47:41
by Dmytro Bogatskyy (EldoS Corp.)

Thank you for contacting us,

Quote
How can I get the stream till step 3? With RemoveSignature(count-1, sroAll) and close(true), checking the resulting pdf in Adobe Reader I see a "Rev. 2, signed by .. Signature removed, field Signature2 on page 1..". I would like to have the file without this "annotations". I cannot do a ..Signature(i-1).GetSignedVersion because in this case the modifications appylied in step 3 would be missing. So I would need something like a Signature.GetUnsignedVersion

Unfortunately, there is no such method.
But, as all signatures and all modifications to the signed document are appended, you can easily remove them by trimming the pdf file till the end-of-file marker, "%%EOF". To do this, you can use internal method TElPDFDocument.PDFFile.SearchForEOFOffset(stream, file_offset) to search backward for the next %%EOF occurrence and then trim the pdf file to it.

Reply

Statistics

Topic viewed 540 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!