EldoS | Feel safer!

Software components for data protection, secure storage and transfer

PDF signature widget with transparent image

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#25245
Posted: 06/10/2013 09:30:43
by David ErÅ¡il (Standard support level)
Joined: 01/15/2013
Posts: 34

Hello,

I would like to use my own transparent background image for PDF signature widget. When I use the attached JPEG2000 image (with transparency channel, I had to change its extension from JPF to TXT before posting), the image gets scrammbled in Adobe Reader (although it seems right using pdftron pdf viewer in our application).

On the other hand, when I try to use an image without alpha channel (just with a white background), I need to specify it's mask. Although the documentation says this could be possible using TElPdfImage.MaskImage property (Use this property to specify the mask image when ImageType has value pitMask or pitMaskInverted.), I get an error in Visual Studio saying this property is read-only.

So my question is - how can I make the widget background image properly transparent?

I use SBB 10.0.233.0 for Windows Store Applications.

Thank you for any ideas.


[ Download ]
#25247
Posted: 06/10/2013 10:02:54
by Dmytro Bogatskyy (EldoS Corp.)

Thank you for contacting us.

Quote
When I use the attached JPEG2000 image (with transparency channel, I had to change its extension from JPF to TXT before posting), the image gets scrammbled in Adobe Reader (although it seems right using pdftron pdf viewer in our application).

According to PDF standard transparent and opaque channels in JPEG2000 image should be ignored. Also Adobe does not understand JPEG-2000 Code Stream bitmap format (.jpc). It understands only JPEG-2000 JP2 bitmap.

Here is a sample code that generates a random RGB image and mask half of it:
Code
SetLength(Buf, 240 * 144 * 3);
for i := 0 to Length(Buf) div 3 - 1 do
begin
  Buf[i * 3] := Byte(i mod 256);
  Buf[i * 3 + 1] := Byte(i mod 256);
  Buf[i * 3 + 2] := Byte(0);
end;
Sig.WidgetProps.Background.Data := Buf;
Sig.WidgetProps.Background.ImageType := pitCustom;
Sig.WidgetProps.Background.ColorSpaceType := pcstRGB;
Sig.WidgetProps.Background.Width := 240;
Sig.WidgetProps.Background.Height := 144;

Buf := nil;
SetLength(Buf, 240 * 144 shr 3);
FillChar(Buf[0], Length(Buf) shr 1, $FF); // mask half, 1 bit per pixel
Sig.WidgetProps.Background.MaskImage.Data := Buf;
Sig.WidgetProps.Background.MaskImage.Width := 240;
Sig.WidgetProps.Background.MaskImage.Height := 144;
Sig.WidgetProps.Background.MaskImage.ImageType := pitMaskInverted;

Reply

Statistics

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