Welcome Guest Search | Active Topics | Sign In | Register

document permissions with htmltopdf Options
Jojo
Posted: Tuesday, July 1, 2014 6:50:37 AM
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
eo_support
Posted: Tuesday, July 1, 2014 8:29:39 AM
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.aspx

The 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
Jojo
Posted: Tuesday, July 1, 2014 8:43:07 AM
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);
Jojo
Posted: Tuesday, July 1, 2014 9:07:49 AM
Rank: Newbie
Groups: Member

Joined: 2/22/2013
Posts: 7
yeah that worked :)


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.