Saving signature when pdf is loaded in memory and not from file

PDF-XChange Editor SDK for Developers

Moderators: Tracker Support, TrackerSupp-Daniel, Paul - Tracker Supp, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan, Ivan - Tracker Software

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
coblejesse
User
Posts: 30
Joined: Thu May 16, 2019 7:44 pm

Saving signature when pdf is loaded in memory and not from file

Post by coblejesse » Tue Jun 18, 2019 2:48 pm

Hi Alex,

We load our PDF's directly from our db into memory and then directly into the pdf editor sdk without first creating a file. Everything has been working great except signatures. It wants to save to a file on disk and will not allow me to save back to the file in memory. I've tried this code to prevent the Save As window from showing and having it save back to it's original in memory source:

Code: Select all

else if (e.nEventID == nIDS[(int)IDS.e_operBeforeExecute])
            {
                PDFXEdit.IOperation oper = (PDFXEdit.IOperation)e.pFrom;
                int opAddSig = PDFXEditor.Inst.Str2ID("op.document.addDigitalSignature", false);
                if (opAddSig == oper.ID && PDFXEditor.Doc != null)
                {
                    PDFXEdit.ICabNode options = oper.Params.Root["Options"];
                    options["AskDestinationFileName"].v = false;
                    options["DestinationFileName"].v = ""; //Saving to the same document
                }
            }
but it gives me a Parameter is invalid error always. I've figured out a workaround to saving it to a file and then loading that file back into memory after the signature is added, but we would rather not have to create the file. Is there any way to do this?

Thanks again for all your support.
-Jesse

User avatar
Sasha - Tracker Dev Team
User
Posts: 4087
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Saving signature when pdf is loaded in memory and not from file

Post by Sasha - Tracker Dev Team » Wed Jun 19, 2019 7:54 am

Hello Jesse,

This will work like this for the Editor SDK for now. The problem is that the signing process is being done when the document is being saved - that's the nature of it.
You can try opening the document via the IPXC level and then you can use the deferred signing via the IPXC_Document::DeferedDigitalSign method and save the document where you want (in your case - into the memory).

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply