Export PDF generates SECURED pdf by default

11 posts, 0 answers
  1. Deepa
    Deepa avatar
    7 posts
    Member since:
    Jan 2017

    Posted 13 Jan Link to this post

    When I generate pdf from telerik radeditor, it generates SECURED pdf by default. So when I check the security of the pdf, it says Security Method = Password Prorection.

    Below are my export settings:

     <telerik:RadEditor ID="dummyradEditorExport" ContentFilters="DefaultFilters,PdfExportFilter"  ExportSettings-Pdf-UserPassword=""
                                            Height="500" Skin="Default" Width="685" runat="server" ImageManager-EnableImageEditor="true" NewLineMode="Div">
                                            <ExportSettings FileName="ExporttoPDF" OpenInNewWindow="true" Pdf-PageBottomMargin="1.0 cm"
                                                Pdf-PageLeftMargin="1.5 cm" Pdf-PageRightMargin="1.5 cm" Pdf-PageTopMargin="1.0 cm" 
                                                 Pdf-AllowCopy="true" Pdf-AllowPrinting="true" Pdf-AllowModify="true" >
                                            </ExportSettings>

    Please suggest why its doing this because my users are not able to open this pdf on iOS and Edge. 

  2. Rumen
    Admin
    Rumen avatar
    13202 posts

    Posted 16 Jan Link to this post

    Hello Deepa,

    Are you able to reproduce the issue in the following demo: PDF Export?

    If no, upgrade to the latest version 2016.3.1027.

    If the problem still persists, set the AllowAd property to true and test again.

    Best regards,
    Rumen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Deepa
    Deepa avatar
    7 posts
    Member since:
    Jan 2017

    Posted 16 Jan Link to this post

    Hi Rumen, Thanks for the suggestion.

    I set the property Pdf-AllowAdd="true" in the export settings. I also removed ExportSettings-Pdf-UserPassword="" which I could not update in my post when I posted (It is not there in my code).

    But it still exports the pdf as SECURED. 

    I am using version 2011.2.712.40. I can not upgrade to the latest version due to some of the customizations we did on some controls like date time picker, multi-select dropdown. I have not done any customization on RadEditor. 

    Can you please help if there is any other alternative to solve this problem?

  4. Rumen
    Admin
    Rumen avatar
    13202 posts

    Posted 16 Jan Link to this post

    Hello Deepa,

    You can try this code to fix the password problem:

     byte[] buffer = System.Text.Encoding.GetEncoding(1252).GetBytes(this.output.ToString());
    context.Response.BinaryWrite(buffer);



    as shown in the handler below:
    Copy Code
    <%@ WebHandler Language="C#" Class="PdfExport" %>
         
    using System;
    using System.Web;
    using System.Web.UI;
    using Telerik.Web.UI;
    using System.Web.UI.HtmlControls;
         
    public class PdfExport : IHttpHandler
    {
        public string output;
         
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //context.Response.ContentEncoding = System.Text.Encoding.GetEncoding(1252);
            //context.Response.HeaderEncoding = context.Response.ContentEncoding;
               
            Page pageHolder = new Page();
            HtmlForm f = new HtmlForm();
            pageHolder.Controls.Add(f);
         
            RadEditor editor = new RadEditor();
            editor.Content = "Hello World!";
            editor.RegisterWithScriptManager = false;
            editor.ExportContent += newEditorExportContentEventHandler(RadEditor_ExportContent);
            f.Controls.Add(editor);
            editor.ExportToPdf();
                 
            System.IO.StringWriter writer = new System.IO.StringWriter();
            context.Server.Execute(pageHolder, writer, false);
         
            //here you use pdf output string
            byte[] buffer = System.Text.Encoding.GetEncoding(1252).GetBytes(this.output.ToString());
               
            context.Response.BinaryWrite(buffer);
        }
         
        protected void RadEditor_ExportContent(object sender, Telerik.Web.UI.EditorExportingArgs e)
        {
            //here you set the pdf output string
            this.output = e.ExportOutput;
        }
         
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
    Regards,
    Rumen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. Deepa
    Deepa avatar
    7 posts
    Member since:
    Jan 2017

    Posted 16 Jan Link to this post

    Thanks for the suggested solution. I implemented it in my web application and it still does the same before. Pdf still gets created with SECURED security method. Can you please suggest any other alternative? 
  6. Rumen
    Admin
    Rumen avatar
    13202 posts

    Posted 17 Jan Link to this post

    Hello Deepa,

    The provided handler works fine on my side. For your convenience I have attached my test project here and a video demonstrating how it works: http://screencast.com/t/Rou6htddt

    It is important to say that you are using a very old version of RadEditor, which works with a third party PDF export plugin, which is obsolete and unsupported. If you continue to get the protection error, the only suggestion that I would advise is to upgrade to the latest and greatest version of RadEditor where this problem does not exist.

    Regards,
    Rumen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  7. Deepa
    Deepa avatar
    7 posts
    Member since:
    Jan 2017

    Posted 24 Jan in reply to Rumen Link to this post

    Hi Rumen,

    1. Sorry I missed to check in the link that you have provided if that exports pdf as SECURED or not. 

    So if I export pdf from this link: http://demos.telerik.com/aspnet-ajax/editor/examples/import-export/pdf-export/defaultcs.aspx 

    then it exports as SECURED. 

     

    2. My web application is SSL enabled so do you think that could be the issue? 

    Can you please suggest what could be the reason as I don't have option to upgrade to the latest version as I mentioned earlier.

     

  8. Rumen
    Admin
    Rumen avatar
    13202 posts

    Posted 25 Jan Link to this post

    Hello Deepa,

    1. The Export to PDF demo works fine on my end under both HTTP and HTTPS as you can see in this demo: https://www.screencast.com/t/0xNNwJ0ggsQi

    If you experience the issue on your end and if the generated PDF requires a password than the problem is due to some configuration on your end. It could be a browser, firewall, proxy or other. My advice is to test on another machine outside of your network.

    2. Do you experience the problem under HTTP?

    A solution for an older version as 2011.2.712.40 is not available because the PDF Export there is based on a free third party library which is currently obsolete and unsupported by its creators. I have provided all known means to solve the secure issue that have helped other customers with the same problem in the past. It looks like that the suggested means do not work for your scenario and the only remaining approach is to migrate to the latest R1 2017 version, which uses our own Export to PDF library which we do support.

    Best regards,
    Rumen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  9. Deepa
    Deepa avatar
    7 posts
    Member since:
    Jan 2017

    Posted 25 Jan Link to this post

    Hi Rumen, Thanks for all your help so far. 

    The issue is resolved by adding following to the export settings of the RadEditor,

     Pdf-AllowAdd="true" Pdf-AllowModify="true" Pdf-AllowPrinting="true" Pdf-AllowCopy="true" 

  10. Deepa
    Deepa avatar
    7 posts
    Member since:
    Jan 2017

    Posted 25 Jan Link to this post

    Hi Rumen, 
    I thought SECURED pdf was creating an issue to open it in iPhone/iPad/Apple and I got rid of that as per my previous post.
    But I am still not able to open the PDF in iPhone/iPad. 
    So here I am attaching the HTML in the text file (Content of RadEditor) which produces the PDF. Can you please look at it and see if there is any HTML content that creates the problem? 

  11. Rumen
    Admin
    Rumen avatar
    13202 posts

    Posted 26 Jan Link to this post

    I am glad that the secure issue has been finally resolved!

    As to the new issue, please note that the current version of iOS and the browsers for it are released years after the creation of version 2011.2.712.40 and they are unsupported.

    My advice is to remove the elements one by one from the HTML until you see which tag is causing the issue (if any).

    If the problem still persists, review this forum and blog post which suggest to upgrade to a newer version:

    http://www.telerik.com/forums/security-method-issue-in-export-to-pdf-issue-in-iphone-ipad

    http://www.telerik.com/blogs/telerik-s-export-to-pdf-functionality-for-asp.net-ajax-now-greatly-improved 

     

    Best regards,
    Rumen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top