PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 2:11 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Jun 06, 2018 5:25 am 
Offline

Joined: Tue Jun 05, 2018 10:39 am
Posts: 3
Hi, how can i add a will print event using pdfsharp? i am trying to add make it so that it can add a watermark if anyone tries to print the pdf. according to pdfreference, i need to add AA catalog but i dont know how to proceed from there. here is my code to try adding the willprint event.


Code:
                string action = "app.alert(\"Hello!\", 3);";
                dict.Elements["/S"] = new PdfName("/O");
                dict.Elements["/JS"] = new PdfStringObject( document , action);

                document.Internals.AddObject(dict);
                document.Internals.Catalog.Elements["/AA"] = PdfSharp.Pdf.Advanced.PdfInternals.GetReference(dict);




any help is appreciated.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 06, 2018 5:36 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Hi!

Maybe you already used this sample as a reference:
http://pdfsharp.net/wiki/WorkOnPdfObjects-sample.ashx

I have no idea what a "will print" event can achieve and how to use it.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 06, 2018 5:49 am 
Offline

Joined: Tue Jun 05, 2018 10:39 am
Posts: 3
TH-Soft wrote:
Hi!

Maybe you already used this sample as a reference:
http://pdfsharp.net/wiki/WorkOnPdfObjects-sample.ashx

I have no idea what a "will print" event can achieve and how to use it.



I already read that wiki. and I did have it working with a openaction event. but i cant use the other event triggers like will print, did save, etc. according to pdfreference "Event triggers" page, it says in order to use the other actions, i need to use "additional actions". but i cant figure out how to add the key for the event and the javascript itself


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 137 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group