I'm trying to write some code to hook the printing events and then (say on certain new page events) write bookmarks/watermarks to that page of the PDF document being printed
But try as I might, I cant get this to work, and none of the samples address whether it is possible to write to the PDF output or do ookmarks/watermarks as it is being printed!
In particular, I can't find any way to get the hDC in use - this is shown in a VB example (where it's easy to get, from the VB Printer object) but I'm not using VB (Python actually!)!
Could you tell me whether this is possible, and ideally point me at some code - especially how to get the hDC from a non-VB event handler?
Drawing/bookarking/watermarking on print events
Hello,
I never used phython so unfotunately, i can't be of great help with this.
But definitely, you can add bookmarks and hyperlinks when printing the document.
For further information or samples please send an e-mail to support@amyuni.com
Thanks.
I never used phython so unfotunately, i can't be of great help with this.
But definitely, you can add bookmarks and hyperlinks when printing the document.
For further information or samples please send an e-mail to support@amyuni.com
Thanks.
Thanks Joan - I already did email them, but haven't heard anything yet.
You get the hDC from the printing events, but I simply cannot get anything to affect the output when using it (eg. printing some lines, setting bookmarks, etc).
BTW the fact that I'm using Python doesn't really matter - it's just receiving the same messages and calling the same Windows APIs as if it were done in any other language.
There really should be some sample code showing how to modify printing PDFs on-the-fly like this - there isn't one anywhere that I can find, which does make one wonder a little bit if it is supposed to work!
You get the hDC from the printing events, but I simply cannot get anything to affect the output when using it (eg. printing some lines, setting bookmarks, etc).
BTW the fact that I'm using Python doesn't really matter - it's just receiving the same messages and calling the same Windows APIs as if it were done in any other language.
There really should be some sample code showing how to modify printing PDFs on-the-fly like this - there isn't one anywhere that I can find, which does make one wonder a little bit if it is supposed to work!

Hello
If I understand your post correctly, it seems that you will like to add a bookmark for the page when the StartPage() event is fired. However, this unfortunately is nor possible.
The SetBookmark function will create a bookmark on the current printing page and location that is being generated. In your situation I suspect that you are actually not adding any text to the page as it is being generated. This will also be the case to the sethypelink() function.
Hope this helps?
If I understand your post correctly, it seems that you will like to add a bookmark for the page when the StartPage() event is fired. However, this unfortunately is nor possible.
The SetBookmark function will create a bookmark on the current printing page and location that is being generated. In your situation I suspect that you are actually not adding any text to the page as it is being generated. This will also be the case to the sethypelink() function.
Hope this helps?