PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 7:06 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Japanese chars
PostPosted: Thu Nov 27, 2014 5:31 pm 
Offline
Supporter

Joined: Sat Oct 18, 2008 4:15 pm
Posts: 50
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
Screenshot 2014-11-27 18.30.35.png [ 18.91 KiB | Viewed 5376 times ]
File comment: OK PDF
Screenshot 2014-11-27 18.29.09.png
Screenshot 2014-11-27 18.29.09.png [ 20.3 KiB | Viewed 5376 times ]
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 144 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group