Welcome Guest Search | Active Topics | Sign In | Register

Header and Footer style font family Options
Thong Ngo
Posted: Wednesday, March 23, 2016 11:40:38 PM
Rank: Newbie
Groups: Member

Joined: 3/23/2016
Posts: 3
Hi,
I want to add font family and link to footer pdf, but it not apply
This is my code
Quote:
HtmlToPdfOptions opts = new HtmlToPdfOptions();
opts.PreserveHighResImages = true;
opts.PageSize = EO.Pdf.PdfPageSizes.A4;
opts.OutputArea = new RectangleF(0, 0.4f, opts.PageSize.Width, opts.PageSize.Height - 1f);
opts.FooterHtmlPosition = opts.PageSize.Height - 0.5f;
opts.SaveImageAsJpeg = true;
opts.JpegQualityLevel = 100;
opts.FooterHtmlFormat = "<!DOCTYPE html><html><head><link href=\"http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic\" rel=\"stylesheet\" type=\"text/css\"/></head><body><div style=\"width;100%;padding:5px 0;text-align:center;background-color: #00467f;color:#fff;\"><p style=\"font-size:25px;font-family: \"Open Sans\",sans-serif;\">Export pdf | <a style=\"color:#fff;text-decoration: none;\" href=\"https://www.google.com.vn/?gws_rd=ssl\">Test link</a></p></div></body></html>";
PdfDocument doc = new PdfDocument();
HtmlToPdf.ConvertUrl(url, doc, opts);
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.AddHeader("Content-Type", "application/pdf");
response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}.pdf;", filename));
doc.Save(response.OutputStream);
response.End();

How can i resolved this issue?
Thanks
eo_support
Posted: Thursday, March 24, 2016 10:27:23 AM
Rank: Administration
Groups: Administration

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

Please change the following part in your code:

Code: C#
" ... style=\"font-size:25px;font-family: \"Open Sans\",sans-serif;\" ... "


To:

Code: C#
" ... style=\"font-size:25px;font-family: 'Open Sans',sans-serif;\" ..."


Note the escaped double quote around "Open Sans" has been replaced to single quotes. The reason your double quote would not work because it would produce the following invalid HTML:

Code: HTML/ASPX
style="font-size:25px;font-family: "Open Sans",sans-serif;"


Here the value of your style property incorrectly ended immediately after font-family.

Hope this helps.

Thanks!
Thong Ngo
Posted: Thursday, March 24, 2016 9:24:42 PM
Rank: Newbie
Groups: Member

Joined: 3/23/2016
Posts: 3
Thank for your help.

opts.FooterHtmlFormat, I have a link, but when i export pdf it just a simple text not link

Code: C#
opts.FooterHtmlFormat = "&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;link href=\"http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic\" rel=\"stylesheet\" type=\"text/css\"/&gt;&lt;/head&gt;&lt;body&gt;&lt;div style=\"width;100%;padding:5px 0;text-align:center;background-color: #00467f;color:#fff;\"&gt;&lt;p style=\"font-size:25px;font-family: \"Open Sans\",sans-serif;\"&gt;Export pdf | &lt;a style=\"color:#fff;text-decoration: none;\" href=\"https://www.google.com.vn/?gws_rd=ssl\"&gt;Test link&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;";


How can i resolved this issue?
Thanks
eo_support
Posted: Friday, March 25, 2016 8:16:33 AM
Rank: Administration
Groups: Administration

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

Link is not currently supported in header and footer area. We will look into this and see if we can support it in future builds.

Thanks!
Thong Ngo
Posted: Friday, March 25, 2016 9:58:18 PM
Rank: Newbie
Groups: Member

Joined: 3/23/2016
Posts: 3
OK, thank you very much. Angel
eo_support
Posted: Saturday, April 2, 2016 8:19:37 AM
Rank: Administration
Groups: Administration

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

This is just to let you know that we have posted a new build that added support to links in the header and footer. You can download the new build from our download page.

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.