Page 1 of 1

PDF Watermarking

Posted: Tue Aug 08, 2006 1:40 am
by glima
I am having a problem watermarking some PDF files with a text watermark using the 3.6.0.102 libraries.

These files can be watermarked by a version of software 3.4.0.80.

The strange thing is that the 3.6.0.102 libraries do stamp document made by Adobe Acrobat 7.0. This was the main reason for the move to 3.5+

A couple of things I have noticed.
1. The coordinates for the older version PDF files have a decimal while the new PDF's do not. (i.e. Media Box 0,0,612.24,791.76)
2. There are no errors reported. all function pass
3. Does not display an image watermark either.
4. If I scale the original using PXCp_TransformPage, the watermarks show up.

I have tried to place them in the foreground and background. Neither works.

Once again I cannot attach any files.

Posted: Tue Aug 08, 2006 8:36 am
by John - Tracker Supp
Hi,

I am afraid without sample files you are making it all but impossible for us to assist you in this issue.

The problem may or may not be with our libraries - but without the following information - we have nowhere to start looking.

Project source file(s) - or a small sample project that recreates the issue + before and after/resulting PDF file(s).

Can you not reproduce the issue with some files that are not confidential or supply the files to us direct via email - rather than publically here ?

Posted: Tue Aug 08, 2006 1:10 pm
by glima
I have come up with a workaround. I transform the page at 100%. This puts all the content behind the watermark.


BTW: I have PDF's that we created and would like to send but the add attachement of this forum is not working. I get "Connection Reset by server" errors.

Posted: Tue Aug 08, 2006 1:18 pm
by John - Tracker Supp
Ok - I suspect the issue is in your code - so this will be important to see your project too- at least for that portion of your application as a minimum.

Any files you wish to upload must be archived as a ZIP, RAR or 7z attachment - you cannot upload PDF's or images, code etc directly

Are you doing this ?

Thanks

Posted: Tue Aug 08, 2006 6:14 pm
by glima
The strange thing is that PDF V7.0 files work fine while the older files don't. If it was my code would it not work for either.

I have tried ZIP files that are ~800KB. Can I e-mail them to someone?

Here is a sampe of the Clarion Code. ( I do not use the templates)

Clear(Watermark)

W:m_Type = WTYPE_TEXT
W:m_FontSize = ITMQ:Size
W:m_Mode = 0 ! TextRenderingMode_Fill
W:m_FColor = ITMQ:Color
W:m_SColor = ITMQ:Color
W:m_LineWidth = 1000
W:m_FontName = clip(ITMQ:Typeface) & chr(0)
BATES_CVT_A2U(W:m_FontName) ! Converts to UNICODE
If Band(ITMQ:Style,1000H)
W:m_bItalic = TRUE
end
W:m_FontWeight = BAND(ITMQ:Style,FONT:Weight)
W:m_Align = TextAlign_Left + TextAlign_Bottom
W:m_PlaceType = L:CurrentPage

W:m_Text = clip(L:OutString) & chr(0)
BATES_CVT_A2U(W:m_Text)
W:m_Opacity = 240

W:m_Angle = L:Angle
W:m_PlaceOrder = WPLACE_FOREGROUND
W:m_YOffset = -1 * (W:m_YOffset - BR:Bottom)
W:m_size = size(Watermark)
W:m_NumRanges = 1
W:m_Range = Address(WMRange)
W:m_PlaceType = 5 !
WMRange.StartPage = L:CurrentPage
WMRange.EndPage = L:CurrentPage
L:WatermarkError = PXCp_AddWatermark(L:FileHandle, Address(WaterMark))
ErrorLog(' BATESENG - TextWatermarkError = '&L:WatermarkError)

Posted: Tue Aug 08, 2006 8:51 pm
by John - Tracker Supp
Hi,

You can email the files to usrfiles@tracker-software.com - please also include a link back to this forum message to avoid any confusion as to what the files relate.

One small point - please note I have moved your problem to the 'Clarion' forum as you posted in the non Clarion forum and I am afraid this has delayed an answer until tomorrow when our Clarion support developer again available.

Please use this forum in the futire to avoid delays.

Thanks.

Posted: Thu Aug 10, 2006 1:15 am
by Tracker - Clarion Support
Hi!

I've looked at your code but don't see anything immediately amiss.

I will look at it again in the morning.

One question: How is the variable "Watermark" defined? There was a change in that definition some time ago.

Posted: Fri Aug 11, 2006 3:47 pm
by glima
This is how it is define. Right from your include files.


PXC_Watermark GROUP,TYPE
m_Size DWORD
m_Type LONG ! PXC_WaterType: 0 - text 1 - image
!Part Text
m_FontName CSTRING(128)
m_FontWeight DWORD
m_bItalic BOOL
m_FontSize REAL
m_Mode LONG ! PXC_TextRenderingMode
m_LineWidth REAL
m_FColor COLORREF
m_SColor COLORREF
m_Text CSTRING(512)
!Part Image
m_FileName CSTRING(520)
m_TransColor COLORREF
m_Width REAL
m_Height REAL
m_bKeepAspect BOOL
!Part Commmon
m_Align DWORD
m_XOffset REAL
m_YOffset REAL
!
m_Angle REAL
m_Opacity DWORD
!Info Place
m_PlaceOrder LONG ! PXC_WaterPlaceOrder
m_PlaceType LONG ! PXC_WaterPlaceType WPLACE_XXX value,page or number
! Ranges
m_NumRanges DWORD
m_Range LONG
! Image File Page Number
m_ImagePageNumber DWORD
END

Posted: Fri Aug 11, 2006 5:58 pm
by Tracker - Clarion Support
Hi George!

I've looked at your problem.

One thing that puzzles me is that the "good" PDF shows a color image and the problem PDF's show B&W ones - as if the page had been run through some conversion process that reduced them to black & white.

Depending on the process, the conversion may have created the page as one large B&W image that is OPAQUE; hence the watermark may not show thorugh if attempting to place it as background.

I am going to send your files on to the xcpro35 project manager for perusal. Also please be aware that the Adobe Acrobat Reader has some known issues with transparencies and other related image displays.

1 other possible cause - Acrobat Reader does not like 1 bit mono images in watermarks - try using an 8 bit grayscale image - this may well help.

Posted: Mon Aug 14, 2006 2:26 pm
by John - Tracker Supp
Hi George,

We have indeed found a problem in the libraries using this feature and an update will be released in the next 24 hours correcting.

thanks for bringing it to out attention and for your patience whilst we resolved.

Thanks

Posted: Mon Aug 14, 2006 9:45 pm
by John - Tracker Supp
The promised fix is now available from :

http://www.tracker-software.com/downloads/dev/

Please do let us know if you have any further problems.

Thanks !