Fonts not applied in Winnovative HTML to PDF Converter

2.1k views Asked by At

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

1

There are 1 answers

0
Winnovative On

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.