Page 1 of 1
Posted: Wed Jun 25, 2008 4:27 pm
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?
Specifies on which page(s) the watermark will be placed. May be a valid page number or one of the following constants:
Posted: Thu Jun 26, 2008 7:16 am
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.
Posted: Thu Jun 26, 2008 2:07 pm
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.)
Dim nPageRange(0 To 1) As Long
Watermark.m_NumRanges = 1
nPageRange(0) = 0
nPageRange(1) = 0
Watermark.m_Range = VarPtrArray(nPageRange())
Posted: Fri Jun 27, 2008 6:10 pm
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.
Posted: Fri Jun 27, 2008 6:23 pm
Thank you very much! Works perfectly.
Posted: Wed Jul 02, 2008 8:54 am
Pleased all is now well.