1

I have used the Winnovative for converting the HTML to PDF now I am facing the issued related fonts, I have used the different fonts like HelveticaNeueLTStd-Cn.otf and it's looks fine in index.html page but when i tried to create a PDF using following code than Fonts are not applied in PDF.

                    pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
                pdfConverter.PdfDocumentOptions.EmbedFonts = true;
                pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.NoCompression;
                pdfConverter.PdfDocumentOptions.PdfPageOrientation = PdfPageOrientation.Landscape;
                pdfConverter.PdfDocumentOptions.FitWidth = true;
                pdfConverter.PdfDocumentOptions.ShowHeader = false;
                pdfConverter.PdfDocumentOptions.ShowFooter = false;
                pdfConverter.PdfDocumentOptions.JpegCompressionEnabled = true;
                pdfConverter.NavigationTimeout = 3600;
                pdfConverter.AvoidTextBreak = true;
                pdfConverter.ConversionDelay = 3;
                pdfConverter.JavaScriptEnabled = true;
                string url = ConfigurationManager.AppSettings["RedirectUrl"].ToString();
                string URL = url + "index.aspx?" + querystring;
                byte[] pdfBytes = null;
                 System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
                response.Clear();
                response.AddHeader("Content-Type", "application/pdf");
                response.AddHeader("Content-Disposition", "attachment; filename=" + "Testing" + ".pdf; size=" + pdfBytes.Length.ToString());
                response.Flush();
                response.BinaryWrite(pdfBytes);
                response.Flush();
                response.End();

can anyone please guid me how to applied fonts in Winnovative

Dhaval Patel
  • 7,471
  • 6
  • 37
  • 70
  • Sorry I have no idea how to solve your problem, other than to suggest you use a different HTML to PDF converter. I've been using the free (open source) wkhtmltopdf(http://code.google.com/p/wkhtmltopdf/) with very few problems. This outlines how to get it going: http://stackoverflow.com/a/18767473/181771 – DaveDev Jan 24 '14 at 13:16
  • is it computability with High-chat.js because I have used the High Chart.js for plotting a chart in PDF.?? – Dhaval Patel Jan 24 '14 at 14:04

1 Answers1

1

Do you have that font installed on the server where you run the converter? If you just installed the font on server the you also have to restart the server to make it available for converter.

Another option is to not install the font on server but to define a web font in your page using @font-face rules and just recerence the font file. You can check the convert HTML with web fonts to PDF demo for a complete c# and HTML code example.

Winnovative
  • 118
  • 7