Generate read-only pdf RRS feed

  • Question

  • Hi I have generated a pdf file using wkhtmltopdf exe file  and it is successfully created, but my client request is should created pdf a read - only (Copy and paste permissions should be restrict ). I did not get proper solution,and any help us instead of using html to image and image to pdf. Can I restrict the pdf strict mode to write permission?

    Here is my code:

     var generator = new PdfGenerator.HtmlToPdf();
    var myHtml = '<html><head></head><body><p> Lorem lipsum klfdksfjsdjf </p></body></html>';
    var pdfByte = generator.GeneratePdf(guideline);
    File.WriteAllBytes(FileName, pdfByte); 

    It is urgent, please help us to solve the solution.

    thanks & Regards

    Ramesh Tigapuram

    • Edited by Ramesh Tigapuram Saturday, January 6, 2018 6:04 AM
    • Moved by CoolDadTx Monday, January 8, 2018 3:54 PM Third party product
    Saturday, January 6, 2018 5:53 AM

All replies

  • Hello,

    If you are making money off your product I would suggest looking at Gembox PDF or Aspose PDF. There is also iTextSharp.

    I have used all two of these libraries (but have not done read-only) and can say that Apose PDF is expensive but worth every penny. Have not tried Gembox PDF yet if it's anything like Gembox Spreadsheet library it's got to be awesome too. iTextSharp, from what I remember it was not easy to work with without a decent amount of time invested in learning the library.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Proposed as answer by pituachMVP Monday, January 8, 2018 7:43 PM
    Saturday, January 6, 2018 11:05 PM
  • These forums are for MS products only. Please post questions related to the use of third party products in their forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Monday, January 8, 2018 3:54 PM
  • Free PDF Tools will do what you want at no cost with your existing pdf files.

    Use its Encrypyt and Decrypt option.

    Monday, January 8, 2018 4:15 PM
  • Hi, 

    Using PDFSharp you can use the setting bellow. I did not test it but according to what I found online this should work

    * PDFsharp is published as Open Source and under the MIT License and is free to use.

    securitySettings.PermitAccessibilityExtractContent = false;
    securitySettings.PermitAnnotations = false;
    securitySettings.PermitAssembleDocument = false;
    securitySettings.PermitExtractContent = false;
    securitySettings.PermitFormsFill = true;
    securitySettings.PermitFullQualityPrint = false;
    securitySettings.PermitModifyDocument = true;
    securitySettings.PermitPrint = false;

    Another option is to add password

    securitySettings.OwnerPassword = "owner";

    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]    [Linkedin]

    Monday, January 8, 2018 8:19 PM