Rank: Newbie Groups: Member
Joined: 10/17/2016 Posts: 1
|
Hello,
I recently purchased a license for your EO.PDF product and am using it to convert HTML to PDF.
Everything works fine when running locally on IIS express, however, when i went to deploy my project live, i am getting the following error when trying to convert the HTML to PDF:
Access to the path 'c:\windows\system32\inetsrv\<documentTitle>' is denied.
Couple of questions:
Is there a way to fix this issue? Why does EO.PDF need to access the root folder that contains the files necessary to run IIS? Does EO.PDF require read / write access to a temp folder? If so, can i specify that folder with appropriate permissions?
We are using the following C# code to convert the HTML to PDF that is causing this error:
public static byte[] ConvertAsPdf(string html, string documentTitle = "") { var pdfOptions = new EO.Pdf.HtmlToPdfOptions(){ PageSize = new SizeF(8.5f, 11f), OutputArea = new RectangleF(0.25f, 0.25f, 8f, 10.5f), MinLoadWaitTime = 2000, };
var result = EO.Pdf.HtmlToPdf.ConvertHtml(html, documentTitle, pdfOptions);
using (var pdfStream = new MemoryStream()) { result.PdfDocument.Save(pdfStream);
return pdfStream.ToArray(); } }
Your prompt help in this matter would be greatly appreciated, thanks!
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, The second argument for ConvertHtml is the result PDF file name. Make sure you pass the full path to that argument. If you do not pass the full path, then it will be assumed to be in the "current" path, which can be your IIS folder. Alternatively, you can pass a PdfDocument object. For example:
Code: C#
PdfDocument doc = new PdfDocument();
HtmlToPdf.ConvertHtml(html, doc, pdfOptions);
doc.Save(pdfStream);
This way it won't try to save the PDF file to disk at all. Thanks!
|