Transparent Watermark

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

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

g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Transparent Watermark

Post by g.politi »

Hi,

I'm using the latest version PDF Tools SDK 4.0195 with Delphi 2009 and we're able to add a transparent image watermark.
I tried both with PNG and GIF files but the watermark is rendered without any transparency.
We started from your example PXCProSample and didn't worked either. Attached the PNG used.

Here an extract of the code used:

dwResult := PXCp_ReadDocumentW(hDoc, PWChar(WideString(sPdfFilename)), 0);

if IS_DS_FAILED(dwResult) then
begin
PXCp_Delete(hDoc);
hDoc := 0;
exit;
end;

dwResult := PXC_AddImageA(hDoc, PAnsiChar(AnsiString(sSignFilename)), @pImage);
if IS_DS_FAILED(dwResult) then
begin
PXCp_Delete(hDoc);
hDoc := 0;
exit;
end;

dwResult := PXC_GetImageDimension(hDoc, pImage, @iw, @ih);
if IS_DS_FAILED(dwResult) then
begin
PXCp_Delete(hDoc);
hDoc := 0;
exit;
end;

ZeroMemory(@theWatermark, sizeof(theWatermark));
theWatermark.m_Size := SizeOf(theWatermark);
theWatermark.m_Angle := iAnglePosition;
theWatermark.m_PlaceOrder := PlaceOrder_Foreground;

theWatermark.m_PlaceType := PlaceType_Range;
theWatermark.m_NumRanges := 1;
SetLength(aRange, 2);
aRange[0] := 0;
aRange[1] := 0;
theWatermark.m_Range := PDWORD(aRange);

theWatermark.m_Align := 0;
case (iVerticalAlign) of
0: theWatermark.m_Align := TextAlign_Top;
1: theWatermark.m_Align := TextAlign_VCenter;
2: theWatermark.m_Align := TextAlign_Bottom;
end;

case (iHorizontalAlign) of
0: theWatermark.m_Align := theWatermark.m_Align or TextAlign_Left;
1: theWatermark.m_Align := theWatermark.m_Align or TextAlign_Center;
2: theWatermark.m_Align := theWatermark.m_Align or TextAlign_Right;
end;

if (iShiftUp > 0) then
theWatermark.m_YOffset := iShiftUp
else
theWatermark.m_YOffset := 0;

if (iShiftRight > 0) then
theWatermark.m_XOffset := iShiftRight
else
theWatermark.m_XOffset := 0;

theWatermark.m_Type := WaterType_Image;
StringToWideChar(sSignFilename, theWatermark.m_FileName, MAX_PATH);
theWatermark.m_ImagePageNumber := 0;
theWatermark.m_Width := 0;
theWatermark.m_Height := 0;
theWatermark.m_bKeepAspect := TRUE;

theWatermark.m_Opacity := 255;

dwResult := PXCp_AddWatermark(hDoc, @theWatermark);

if IS_DS_FAILED(dwResult) then
begin
PXCp_Delete(hDoc);
hDoc := 0;
exit;
end;

dwResult := PXCp_WriteDocumentW(hDoc, PWChar(WideString(sDestDir + '\' + ExtractFilename(sPdfFilename))), PXCp_CreationDisposition_Overwrite, PXCp_Write_NoRelease);


Any idea ?

Best regards

G
You do not have the required permissions to view the files attached to this post.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom

Re: Transparent Watermark

Post by John - Tracker Supp »

Hi,

The current build does not support transparency in the way you require when overlaying a watermark on a coloured background etc - build 196 which will be released in the next 14 days or so will add such support for PNG files for sure and possibly GIF also - though this cannot be guarenteed for all GIF files.

Hope that helps...
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Thanks John for your reply,

unfortunatly my program should be delivered early, 14 days (or so) is too far. There's any other way to place a scanned sign on a Pdf using transparency ?

Best regards

G
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom

Re: Transparent Watermark

Post by John - Tracker Supp »

Hi,

The only possible 'semi' solution is if the image background is the same colour as your paper - try reducing the opacity value (from say 255 to around 120 or so) - this may provide an acceptable solution.

HTH
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Thanks, I already tried and the results are not accepted by the customer.

I'll wait for the new version, hope within 2 weeks. Where I can find the official scheduled date ?

Best regards

G
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom

Re: Transparent Watermark

Post by John - Tracker Supp »

There is no official date for the release at this point - strictly speaking we are not making any changes to the current releases as we prepare for new Major Versions of all products - we are only making critical bug fixes - however, this has been done as a 'special' to assist.

So for now approx 14 days is the best estimate I can offer.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Thanks! I really appreciate it

G
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Transparent Watermark

Post by Tracker Supp-Stefan »

:)
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Hi, any news ? any new schedule available ?

Best regards

G
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Transparent Watermark

Post by Tracker Supp-Stefan »

Hello G. Politi,

Yes - we are expecting build 196 to be released either tomorrow or on Friday.

Best,
Stefan
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Ohh cool!!! thanks :)

Have a nice day

G
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Transparent Watermark

Post by Tracker Supp-Stefan »

:)
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Seems the issue persist: no PNG transparency is supported .... I'm using the file attached with no luck :(
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6901
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada

Re: Transparent Watermark

Post by Paul - Tracker Supp »

Hi g.politi,

there was no file attached. Did you zip it into an archive first? If not the forum software will strip the attachment.

Regards the issue, I think I understand you saying that it is still not working i build 196. Can you confirm that I have that right and that you are definitly using all the 196 DLLs etc?

Paul
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

you can find the file attached to the first thread's message.

I confirm I have the latest DLL installed and placed in the application directory

Regards

G
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Pls can somebody answer my previous question ?

Best Regards

G
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6901
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada

Re: Transparent Watermark

Post by Paul - Tracker Supp »

Hi g.politi,

sorry for the delay. The dev team member that needs to look at this has been away from the office and should return tomorrow.
Your patience is appreciated here.

:-)
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Ok, so did you tested too and found it is a bug, right ?

I'll wait hopefully 'couse Monday I should release my projct to the customer .... :(

Best regards

G
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: Transparent Watermark

Post by Ivan - Tracker Software »

Ok, so did you tested too and found it is a bug, right ?
Sorry, no. I have tested and it works fine - see attached file generated by by CExamp from samples which are provided with SDK.
(I used your image for image watermarks)
You do not have the required permissions to view the files attached to this post.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Thanks Ivan for you reply but looking at you pdf looks that the watermark was set with an opacity around 127, infact the color of the text is not "blue" nut a transparent blue, as you can see from the sample PNG the blu is not a light blue ...

What I expect, maybe I'm wrong, is that the watermark when applied show the full blue and the background that is set as transparent in PNG file show the rest of the document

Regards

G
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: Transparent Watermark

Post by Ivan - Tracker Software »

Please check attached PDF file which contains watermarks with your images and without additional transparency.
Just turn on "Show transparency grid" in your PDF viewer to check that your image is inserted as transparent.
You do not have the required permissions to view the files attached to this post.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
g.politi
User
Posts: 27
Joined: Wed Sep 15, 2010 3:05 pm

Re: Transparent Watermark

Post by g.politi »

Sorry, you're completely right!! everything works fine :)

Best regards

G
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17949
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: Transparent Watermark

Post by Tracker Supp-Stefan »

:)