|
Rank: Member Groups: Member
Joined: 9/3/2013 Posts: 16
|
Hello, Im using ASPXToPDF but I receive and exception in method "RenderAsPDF". Quote: en EO.Web.ASPXToPDF.RenderAsPDF(Boolean sendToClient) en EO.Web.ASPXToPDF.RenderAsPDF() en UDLAServAlumno.WebControl.UDLAMalla.btnMail_Click(Object sender, EventArgs e) en C:\Trabajo\Desarrollos\ServAlumno_1\ServAlumno\WebControl\Malla.ascx.cs:línea 119
Code: C#
MemoryStream pdfStream = new MemoryStream();
ASPXToPDF oASPXToPDF = new ASPXToPDF();
oASPXToPDF.RenderAsPDF();
HtmlToPdfResult result = (HtmlToPdfResult)oASPXToPDF.Result;
PdfDocument doc = result.PdfDocument;
doc.Save(pdfStream);
pdfStream.Position = 0;
The documentation says "ASPXToPDF1" but that class doesn't exists in my DLL. Can you help me? Fractus - Developer & Consulting
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
do not create ASPXToPDF control dynamically in your code. Declare it statically in your ASPX page. You can take a look of the sample project to see how it works.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 9/3/2013 Posts: 16
|
Hi, Now I'm getting a new error "Please verify whether file eo_web.ashx is on your web application's root directory. That file is required for EO.Web Controls to run in your application. If the file does not exist, please copy it from EO.Web Controls' installation folder." I copied the file in my project root folder. Fractus - Developer & Consulting
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
This usually is a permission issue. It means your Web application does not have sufficient permission to "see" the file. You will need to adjust your application permission so that it can see the file. We use File.Exists to test the existence of the file.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 9/3/2013 Posts: 16
|
Hi, I give "everyone" full permissions to the complete directory and still fails.
Code: C#
protected void btnMail_Click(object sender, EventArgs e)
{
string hanlderLocation = System.Configuration.ConfigurationSettings.AppSettings["eo_HandlerLocation"];
string handlerPath = HttpContext.Current.Request.MapPath(hanlderLocation);
handlerPath = Path.Combine(handlerPath, "eo_web.ashx");
if (!File.Exists(handlerPath))
{
//Never enters here
}//It finds the faile correctly
MemoryStream pdfStream = new MemoryStream();
ASPXToPDF.Instance.RenderAsPDF(false); //Still throwing the missing eo_web.ashx file
I use ypur demo example in other post and can find thefile without problem, but the ASPXToPDF.Instance.RenderAsPDF stills throwing the same exception. Fractus - Developer & Consulting
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
Make sure you statically declare one ASPXToPDF control in your ASPX. If you don't have any ASPXToPDF control declared in your page but you try to call ASPXToPDF.Instance to get the ASPXToPDF instance, then you will get this error.
Thanks!
|
|