|
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
|
|
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!
|
|
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 = "<!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>";
How can i resolved this issue? Thanks
|
|
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!
|
|
Rank: Newbie Groups: Member
Joined: 3/23/2016 Posts: 3
|
OK, thank you very much.
|
|
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!
|
|