EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Prop_build in PDF signature

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#31874
Posted: 01/13/2015 03:47:52
by David Eršil (Standard support level)
Joined: 01/15/2013
Posts: 34

Hello,

I would like to add signing application name and version to the PDF signature, so Adobe Reader could display it in signature properties.
This information is written in signature's Prop_build sub-dictionary, e.g.:

Code
/Prop_Build <<
  /App <<
    /Name (MyApp)
    /REx (1.0)
  >>
>>


I don't seem to be able to achieve this as TElPDFSignature class does not have such a property. Is there any other way (I use SBB 12.0.258 for .NET)?
#31879
Posted: 01/13/2015 06:01:59
by Dmytro Bogatskyy (EldoS Corp.)

Hello,

Quote
I don't seem to be able to achieve this as TElPDFSignature class does not have such a property. Is there any other way (I use SBB 12.0.258 for .NET)?

There is no such property at the moment. But it could be done using OnBeforeSign event handler and PDF core methods, for example:
Code
Document.OnBeforeSign += new TSBPDFBeforeSignEvent(Document_OnBeforeSign);

        void Document_OnBeforeSign(object Sender, TElPDFSignature Signature)
        {
            TElPDFDocument Document = (TElPDFDocument)Sender;
            TElPDFDictionary V = SBPDFCore.Unit.GetDictionaryObjectFromDictionary(((TElPDFDictionary)Signature.PDFObject), "V");
            if (V == null)
                return;

            TElPDFDictionary PropBuild = new TElPDFDictionary(Document.PDFFile);
            PropBuild.Render = true;
            V.Add("Prop_Build", PropBuild);
            TElPDFDictionary App = new TElPDFDictionary(Document.PDFFile);
            App.Render = true;
            PropBuild.Add("App", App);
            SBPDFCore.Unit.AddStringObjectToDictionary(App, "Name", SBUtils.Unit.BytesOfString("MyApp"));
            SBPDFCore.Unit.AddStringObjectToDictionary(App, "REx", SBUtils.Unit.BytesOfString("1.0"));
        }
#31885
Posted: 01/13/2015 07:04:06
by David Eršil (Standard support level)
Joined: 01/15/2013
Posts: 34

Thank you very much for your help.

This leads to expected result with just one small note (because of my erroneous question):

It turns out that Adobe (10.1.3 Pro) cannot resolve the application name if it is written as "String Object" (no matter if binary, hex, or octal), so the key is to use "Name Object" instead:

Code
...
SBPDFCore.Unit.AddNameObjectToDictionary(App, "Name", "MyApp", false);
...
#31887
Posted: 01/13/2015 07:14:39
by Dmytro Bogatskyy (EldoS Corp.)

Hello,

Quote
It turns out that Adobe (10.1.3 Pro) cannot resolve the application name if it is written as "String Object" (no matter if binary, hex, or octal), so the key is to use "Name Object" instead:

Yes, you are correct, according to the specification http://www.adobe.com/content/dam/Adob...ldDict.pdf it should be a name object.

Reply

Statistics

Topic viewed 518 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!