Watermarks on specific page ranges

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.

Moderators: Tracker Support, TrackerSupp-Daniel, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Andrew - Tracker Support, Tracker - Clarion Support, John - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Support Staff, moderators

Post Reply
KBell
User
Posts: 3
Joined: Wed Jun 28, 2006 3:52 pm

Watermarks on specific page ranges

Post by KBell » Sun Jul 09, 2006 4:11 pm

I’m using Microsoft Access (VBA) to print a set of reports to individual PDF files, merge them into one single file, add an outline, add a version watermark to all pages, and add a watermark to each page as page numbers.

Everything works fine except for adding watermarks to each page. When trying to add a watermark to a page range, Access takes a catastrophic error and crashes.

I’m using the latest SDK Pro build (v.3.6102) and I have no problems with placing text using the following code:

Code: Select all

Watermark.m_PlaceType = PlaceType_AllPages
res = PXCp_AddWatermark(pdf, Watermark)
When I change the code to this:

Code: Select all

Dim wmPages(1) As Long
Watermark.m_PlaceType = PlaceType_Range
Watermark.m_NumRanges = 1
wmPages(0) = 3
wmPages(1) = 3
Watermark.m_Range = wmPages(0)        
res = PXCp_AddWatermark(pdf, Watermark)
The code compiles fine but when PXCp_AddWatermark executes, Access crashes. I’m hopping that I have something wrong in the way I’m declaring the range of pages. Any ideas what I’m doing wrong?

Thanks,

Kevin

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Mon Jul 10, 2006 11:27 am

Hi Kevin,

we will need to take a closer look at this and come back - your patience is appreciated.

thanks.
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

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Tue Jul 11, 2006 2:19 pm

Hi Kevin,

Sorry - but we need a small sample demo app is possible to test this and come back as we cannot replicate.

thanks
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

KBell
User
Posts: 3
Joined: Wed Jun 28, 2006 3:52 pm

Post by KBell » Wed Jul 12, 2006 1:51 am

No problem, thanks for the help.

I created a very simple Access 2000 database that seems to replicate the problem. There is a simple form with 2 buttons, one will add a watermark to all pages (works fine) and the other will try to put a page number watermark on page 3 (crashes Access). I think all you will need to do is change the paths to the input PDF file and the output file path.

I also tested the code in Visual Basic 6 and it generates a similar error. I’ve attached a JPG of the Access and VB error.

Please let me know if you need anything else.

Kevin
Attachments
WaterMarkTest.zip
(104.56 KiB) Downloaded 149 times

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Thu Jul 13, 2006 12:37 am

Hi Kevin,

thanks - this is with our Projetc dev and will advise as soon as I have his response.

thanks for your patience.
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

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Thu Jul 13, 2006 7:36 am

Hi,


There is a small error in your code
+++

Watermark.m_NumRanges = 1
wmPages(0) = 3
wmPages(1) = 3
Watermark.m_Range = wmPages(0)
+++
the last line should be:

Watermark.m_Range = VarPtr(wmPages(0))

as we need to pass the address, the attached mdb includes this fix and works fine.

HTH
Attachments
WaterMarkTest.zip
Fixed
(139.67 KiB) Downloaded 157 times
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

KBell
User
Posts: 3
Joined: Wed Jun 28, 2006 3:52 pm

Post by KBell » Fri Jul 14, 2006 3:50 pm

Excellent! That’s all that was missing. :D

Thanks for the assistance.

Kevin

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Fri Jul 14, 2006 5:01 pm

Pleasure Kevin :)
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

Post Reply