Hi Peter!
Attached is a small program demonstrating multiple PDF merging with "Page of Pages" watermarking. You will notice a "Page of Pages Watermark" has been added to the screen. Check that and the Page of Pages Text Watermarks will be generated in the lower left corner of each page.
The interesting bits are in the
MergeFiles ROUTINE, lines 80-84. It's a simple loop counting from 1 to the total number of pages in the merged PDF file. Line 82 is where the really interesting stuff happens:
- 1. PDF1.AddWatermarkAsText(
2. 'Page '&I&' of '&PDF1.PagesNumber()
3. 'Arial'
4. 12
5. TextRenderingMode_Fill
6. 0.0
7. 0
8. 0
9. PlaceType_Range
10. PlaceOrder_Background
11. TextAlign_Left+TextAlign_Bottom
12. 18
13. -18
14. 255
15. I
16. )
I've taken the liberty of splitting it into separate lines for each of the parts and numbering them.
1. Method call
2. The Text String for the Watermark. This is where "Page x of y" is generated; in this case x is I (the page number) and y is the total number of pages in the PDF file.
3. Font name. I chose 'Arial' as it's a common font.
4. Font size, in points - I chose 12-point.
5. Text Rendering Mode - this is from a table in the pxclib35.chm.
6. Font Line Width - only applies to Stroke type Text Rendering Mode.
7. Color - standard COLOREF value, 0 = black.
8. Angle - Text WM can be placed at angles across the page - I chose 0 so it's just standard.
9. Placement Type - PlaceType_Range lets you select page number for Watermarks. Other Placement Types cause other effects, such as all pages, odd pages, even pages, etc.
10. Placement Order - PlaceOrder_Background makes the page text overwrite the watermark is they "collide". PlaceOrder_Foreground puts the watermark "over" the page text.
11. Text Alignment - where the watermark text appears on the page. TextAlign_Left+TextAlign_Bottom means lower left corner.
12-13. Horizontal and Vertical offsets in points (72 points/inch) from the Text Alignment position. I "indented" 18 points (.25 inch) from the left and -18 points from the bottom.
The combination of Text Alignment and Horizontal and Vertical offsets allows you to be quite creative in placing the watermarks as desired.
14. Opacity - runs from 0 (completely transparent=invisible) to 255 (completely opaque).
15. Page Number - only applies when PlaceType_Range is in effect. I is the value from the loop, of course.
16. Closing parenthesis.
Hope this gives you a "leg up" on your application!