Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Accented Characters in PDF Files

$
0
0
Hi,

When I try to generate a PDF with the word "Książęce" in it, it comes out with spaces in the place of certain characters.

See a complete, reproducable code listing
 class Program    {        static void Main(string[] args)        {            string testStr = "Książęce";            System.IO.File.WriteAllBytes("TestFile.pdf", SavePdf(testStr));        }        /// <summary>        /// Saves the PDF.        /// </summary>        /// <param name="inputHtml">The input HTML.</param>        /// <returns>A byte array representing the generated PDF</returns>        public static byte[] SavePdf(string inputHtml)        {            Pdf pdf = new Pdf();            Section section = pdf.Sections.Add();            section.PageInfo.Margin.Top = 5;            section.PageInfo.Margin.Left = 5;            section.PageInfo.Margin.Bottom = 5;            section.PageInfo.Margin.Right = 5;            section.PageInfo.PageHeight = Aspose.Pdf.Generator.PageSize.A4Height;            section.PageInfo.PageWidth = Aspose.Pdf.Generator.PageSize.A4Width;            Text text = new Text(section, inputHtml);            text.IsHtmlTagSupported = true;            section.Paragraphs.Add(text);            text.IsFitToPage = true;            byte[] pdfBytes;            using (MemoryStream s = new MemoryStream())            {                pdf.Save(s);                pdfBytes = s.ToArray();            }            return pdfBytes;        }    }
I have attached a generated PDF to this post.

This was reproduced using Aspose.Pdf.dll 8.4.0.0

Many Thanks,
James


Viewing all articles
Browse latest Browse all 3131

Trending Articles