Welcome Guest Search | Active Topics | Sign In | Register

ASPXTo Pdf - Image source via handler Options
kun
Posted: Friday, June 28, 2013 2:42:08 PM
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();

eo_support
Posted: Saturday, June 29, 2013 9:07:11 AM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.