Page 1 of 1

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

Posted: Tue Jun 18, 2019 2:48 pm
by coblejesse
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

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

Posted: Wed Jun 19, 2019 7:54 am
by Sasha - Tracker Dev Team
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