When I generate pdf from , it generates SECURED pdf by default. So when I check the security of the pdf, it says Security Method = Password .
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.
11 Answers, 1 is accepted
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
Hi Rumen, Thanks for the suggestion.
I set the property Pdf-AllowAdd="true" in the export settings. I also removed " which I could not update 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?
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:
<%@ 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 +=
new
EditorExportContentEventHandler(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
;
}
}
}
Rumen
Telerik by Progress
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.
Rumen
Telerik by Progress
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.
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 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
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"
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?
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 a newer version:
http://www.telerik.com/forums/security-method-issue-in-export-to-pdf-issue-in-iphone-ipad
Best regards,
Rumen
Telerik by Progress
Hi all,
I'm using telerik radeditor now. I want to convert from html code to pdf file in my web service project. I had tried it. It's ok. It was out pdf file with image and text order by html code. But it was stopped next loop again within foreach. And then it is showing 'Object reference not set to an instance of an object.' at breakpoint Radeditor.ExportToPdf(). Here is my code:
RadEditor editor = new RadEditor();
editor.RegisterWithScriptManager = false;
editor.ContentFilters = EditorFilters.PdfExportFilter;
editor.EditModes = EditModes.Html;
editor.ExportSettings.OpenInNewWindow = false;
editor.ExportSettings.FileName = _DocNo;
editor.ExportSettings.Pdf.PageWidth = new System.Web.UI.WebControls.Unit(210, System.Web.UI.WebControls.UnitType.Mm);
editor.ExportSettings.Pdf.PageHeight = new System.Web.UI.WebControls.Unit(292, System.Web.UI.WebControls.UnitType.Mm);
editor.ExportSettings.Pdf.PageBottomMargin = new System.Web.UI.WebControls.Unit(5, System.Web.UI.WebControls.UnitType.Mm);
editor.ExportSettings.Pdf.PageTopMargin = new System.Web.UI.WebControls.Unit(5, System.Web.UI.WebControls.UnitType.Mm);
editor.ExportSettings.Pdf.PageLeftMargin = new System.Web.UI.WebControls.Unit(5, System.Web.UI.WebControls.UnitType.Mm);
editor.ExportSettings.Pdf.PageRightMargin = new System.Web.UI.WebControls.Unit(5, System.Web.UI.WebControls.UnitType.Mm);
editor.Content = MergeData(templateLetter, res.ReservationKey.ToString());
editor.ExportContent += new EditorExportContentEventHandler(editor_ExportContent);
editor.ExportToPdf();
private static void editor_ExportContent(object sender, EditorExportingArgs e)
{
string url = string.Format(@"~/CReport/Sent/{0}{1}","_"+ _DocNo,".pdf");
string path = HostingEnvironment.MapPath(url);
if (File.Exists(path))
{
File.Delete(path);
}
using (FileStream fs = File.Create(path))
{
Byte[] info = System.Text.Encoding.Default.GetBytes(e.ExportOutput);
fs.Write(info, 0, info.Length);
}
}
MergeData(templateLetter, res.ReservationKey.ToString()) function return html codes (include image link).
What's wrong, sir? please help me.
Thanks all