Rank: Newbie Groups: Member
Joined: 2/22/2013 Posts: 7
|
Hi There
I currently create pdfs from the html (by url) is there a way to set permissions on the file that the users cant modify it?
HtmlToPdf.ConvertUrl() method doesnt seem to have an overload for permissions like say
( PdfDocument doc = new PdfDocument(); doc.Security.Permissions = PdfDocumentPermissions.Printing) has
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, You will need to call this method: http://www.essentialobjects.com/doc/4/eo.pdf.htmltopdf.converturl_overload_1.aspxThe code would be something like this:
Code: C#
PdfDocument doc = new PdfDocument();
//The second argument is a PdfDocument object
HtmlToPdf.ConvertUrl(url, doc);
//Set the security....
doc.Security .....
doc.Save(fileName);
The key is the second argument for the second line. Thanks
|
Rank: Newbie Groups: Member
Joined: 2/22/2013 Posts: 7
|
hiya, thanks i did see that post before im presuming i could do something like
//create new memory stream MemoryStream ms = new MemoryStream();
//lock document - allow only printing PdfDocument doc = new PdfDocument(); doc.Security.Permissions = PdfDocumentPermissions.Printing;
//html convert url and save the stream into the doc HtmlToPdf.ConvertUrl(url, doc);
//then push doc into ms doc.Save(ms);
|
Rank: Newbie Groups: Member
Joined: 2/22/2013 Posts: 7
|
yeah that worked :)
|