Hi
I was able to achieve Japanese characters with PDFSharp based on sample provided here. Problem s, it only works when called from .NET 2 console application If I call same routine from asp.net app, it will return much shorter PDF without working japanese chars Unfortunately I cannot attach PDFF themselves. but good one has 69kB bad one 12kB
Document document = new Document(); //141127 Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph(); document.Styles[StyleNames.Normal].Font.Name = "Arial Unicode MS"; paragraph.AddFormattedText("GenerateIDIReport: "); paragraph.AddFormattedText("编辑"); paragraph.AddFormattedText("Japanese:末永萌絵子");
MigraDoc.Rendering.DocumentRenderer docRenderer = new DocumentRenderer(document); docRenderer.PrepareDocument(); PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always); renderer.Document = document;
if (bSaveFile) { renderer.RenderDocument();
// Save the document... String WebDir = System.AppDomain.CurrentDomain.BaseDirectory; string filename = Guid.NewGuid().ToString("D").ToUpper() + ".pdf"; string filenameDisk = WebDir + "..\\Temp\\" + filename; renderer.PdfDocument.Save(filenameDisk);
Process.Start(filenameDisk); }
Attachments: |
File comment: BAD PDF
Screenshot 2014-11-27 18.30.35.png [ 18.91 KiB | Viewed 7977 times ]
|
File comment: OK PDF
Screenshot 2014-11-27 18.29.09.png [ 20.3 KiB | Viewed 7977 times ]
|
|