Welcome Guest Search | Active Topics | Sign In | Register

Reference External Style Sheet Options
kun
Posted: Friday, June 21, 2013 11:51:28 AM
Rank: Newbie
Groups: Member

Joined: 6/21/2013
Posts: 2
I just got started with the tool and I'm looking a way where the converted document would reflect an external css file. Below is my code. Can some one post the code sample please?

Aspx
====
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Literal runat="server" ID="Html" /> <br />
</div>
</form>
</body>

Code
===
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;
}
//HtmlToPdf.Options.BaseUrl = ResolveUrl("~/Styles/test.css"); -- Not working
HtmlToPdf.ConvertHtml(Html.Text, @"C:\pdf\template.pdf");
eo_support
Posted: Friday, June 21, 2013 12:06:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

No. The styles have to be referenced by your HTML.

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.