Page 1 of 1

PXC_Watermark

Posted: Wed Jun 25, 2008 4:27 pm
by docu-track99
Hi, I'm trying to use the Watermark method to add different images to different pages of a pdf (so none of the constants will work), the problem is I can't use a page number for m_PlaceType that corresponds to one of the constants.

How am I suppose to watermark something onto the second page of a PDF?


m_PlaceType definition:
Specifies on which page(s) the watermark will be placed. May be a valid page number or one of the following constants:

Re: PXC_Watermark

Posted: Thu Jun 26, 2008 7:16 am
by Lzcat - Tracker Supp
Just read help file and do as described:
m_PlaceType should be PlaceType_Range
m_NumRanges should be 1 if you want to place only to ine page range.
m_Range should point to array of m_NumRanges * 2 DWORDs. They are treated as pairs, first two correspond first range and so on. First DWORD in pair is start page number, second - last included page, so if you need just one page in rage - start and last page numbers should be equal. Also note that page numbers are zero-based.

Re: PXC_Watermark

Posted: Thu Jun 26, 2008 2:07 pm
by docu-track99
I've added the range properties to my watermark code as seen below, but it always returns an error of -2113404927 - Invalid Argument. I'm pretty sure it isn't any of the other values since when I say the m_PlaceType = PlaceType_AllPages it works. Any pointers you have on translating your examples into VB6 would be very helpful. (I've looked through the VB6 Examples provided, none of them use a range for watermarking.)

VB6 Code:

Dim nPageRange(0 To 1) As Long
'Ranges
Watermark.m_NumRanges = 1
nPageRange(0) = 0
nPageRange(1) = 0
Watermark.m_Range = VarPtrArray(nPageRange())

Re: PXC_Watermark

Posted: Fri Jun 27, 2008 6:10 pm
by Lzcat - Tracker Supp
Here is updated Watermark sample which places watermark always for first page (or any other if you modify code) using page ranges. See comments in Sub OKButton_Click() in WatermarkDlg form. Not so simple, but for now I don't know better way to handle this.

Re: PXC_Watermark

Posted: Fri Jun 27, 2008 6:23 pm
by docu-track99
Thank you very much! Works perfectly.

Re: PXC_Watermark

Posted: Wed Jul 02, 2008 8:54 am
by John - Tracker Supp
Pleased all is now well.