EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Help with PDF WidgetProps

Posted: 10/23/2006 10:34:08
by brian leach (Basic support level)
Joined: 10/23/2006
Posts: 5


I'm having problems using a custom JPEG2000 image for a digital signature. No errors, it just shows the stock image. Do you have an example in Delphi please?

Posted: 10/23/2006 10:43:13
by Eugene Mayevski (Team)

No samples available due to patented nature of JPEG 2000 format.

Did you check the how-to article in SecureBlackbox knowledgebase?

Sincerely yours
Eugene Mayevski
Posted: 10/23/2006 10:48:54
by Ken Ivanov (Team)

Please check if the image you are using is really a JPEG2000 image (not generic JPEG). Please find attached a sample file in JPEG2000 format.

Please also remember to set TElPDFSignature.WidgetProps.BackgroundStyle to pbsCustom value.

[ Download ]
Posted: 10/24/2006 03:57:24
by brian leach (Basic support level)
Joined: 10/23/2006
Posts: 5

Thanks for your help, but I'm obviously doing something dumb. I've stripped down the code to the following lines, largely ripped from your example:

Index := Document.AddSignature;
Sig := Document.Signatures[Index];
Sig.Handler := PublicKeyHandler;
Sig.AuthorName := SigInfo.Author;
Sig.SigningTime := Now;
Sig.Reason := SigInfo.Reason;

// configuring signature type
Sig.SignatureType := stDocument;
Case SigInfo.SigType of
PDF_SIGTYPE_INVISIBLE : Sig.Invisible := true;
PDF_SIGTYPE_VISIBLE : Sig.Invisible := false;
Sig.SignatureType := stMDP;
Sig.Invisible := false;

// now the image stuff
If Sig.Invisible = False Then Begin
BackgroundImage := 'c:\demo\transpsig.jp2';

If BackgroundImage <> '' Then Begin
Sig.WidgetProps.BackgroundStyle := pbsCustom;
AssignFile(ImageF, BackgroundImage);
Reset(ImageF, 1);
SetLength(Buf, FileSize(ImageF));
BlockRead(ImageF, Buf[0], Length(Buf));

Sig.WidgetProps.Background.ImageType := pitJPEG2000;
Sig.WidgetProps.Background.Data := Buf;
Sig.WidgetProps.Width := 120;
Sig.WidgetProps.Height := 120;

PublicKeyHandler.SignatureType := pstPKCS7SHA1;

But what I see is the default image with the green tick and the pen.

Any ideas?
I've probably been staring at it too long to see the obvious.

Posted: 10/24/2006 05:28:12
by Ken Ivanov (Team)

Please also specify the Width and Height properties of Sig.WidgetProps.Background object.
Posted: 10/26/2006 07:59:01
by brian leach (Basic support level)
Joined: 10/23/2006
Posts: 5

First, thanks for your help. That works, except..

The problem I am still having is the JPEG2000 format. I have tried a number of conversion libraries that produce JPEG2000 images from formats that the rest of the world uses (jpg, bmp etc), but none of these produce an image that renders correctly in the signature.

I attach a very rough image I'm using for testing.


[ Download ]
Posted: 10/26/2006 08:00:43
by brian leach (Basic support level)
Joined: 10/23/2006
Posts: 5

.. and what I meant to ask was:

Can you recommend a conversion utility that would produce the correct format?

Posted: 10/26/2006 09:23:07
by Ken Ivanov (Team)

Hmm, really, your image is not understood by Adobe Reader (however, it is read correctly by IrfanView). We used this utility (IrfanView with JPEG2000 plugin) several times in past for converting images to JPEG2000 format and all the converted images were displayed by Adobe Reader correctly.

Please find attached the original image converted with IrfanView utility.

[ Download ]
Posted: 10/26/2006 09:30:34
by brian leach (Basic support level)
Joined: 10/23/2006
Posts: 5

That's great. Thanks.

I have to say the product and your support are both excellent.

Now if only the docs were as good :)
Posted: 10/26/2006 09:55:44
by Eugene Mayevski (Team)

what's wrong with the documentation?

There's also a knowledgebase with how-to articles available.

Sincerely yours
Eugene Mayevski



Topic viewed 7907 times

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


Back to top

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

Got it!