Rank: Newbie Groups: Member
Joined: 6/21/2013 Posts: 2
|
Hi
I'm trying to convert a aspx page to pdf where I have a image tag whose src is set via handler file. The image doesn't render on the converted pdf.
Below is my code anything I'm missing here? aspx ==== <eo:ASPXToPDF runat="server" ID="eo" /> <div id="content"> <img src="ImageHandler.ashx?ImageId=0" alt="" /> <asp:Literal runat="server" ID="litHtml" /> </div>
cs code ======
string baseUrl = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/"; HtmlToPdf.Options.BaseUrl = baseUrl; HtmlToPdf.Options.VisibleElementIds = "content"; //HtmlToPdf.Options.InvisibleElementIds = "invisible"; SizeF pageSize = PdfPageSizes.FromName("Letter"); float marginLeft = 0.5F; float marginTop = 0.5F; float marginRight = 0.5F; float marginBottom = 0.5F; bool autoFitWidth = true;
//Set page layout arguments EO.Pdf.HtmlToPdf.Options.PageSize = pageSize; HtmlToPdf.Options.OutputArea = new RectangleF( marginLeft, marginTop, pageSize.Width - marginLeft - marginRight, pageSize.Height - marginTop - marginBottom);
if (autoFitWidth) { HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.ShrinkToFit; } else { HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.None; } eo.RenderAsPDF();
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
Your code looks fine. We have tried the sample code you sent to us with a static image and it works fine. So you will want to debug your handler code and see if the handler code throws an error.
Thanks!
|