empira / MigraDoc-1.5

MigraDoc Foundation - Creating documents on the fly
MIT License
218 stars 125 forks source link

Emoji doesn't render correctly in PDF #29

Open moataseem opened 5 years ago

moataseem commented 5 years ago

If you think there is a bug in MigraDoc then please use the IssueSubmissionTemplate to make the issue replicable.
http://www.pdfsharp.net/wiki/IssueSubmissions.ashx

Thanks.

Resources

The official project web site:
http://pdfsharp.net/

The official peer-to-peer support forum:
http://forum.pdfsharp.net/

Reporting an Issue Here

I'm unable to get the Emoji to appear in a pdf

Expected Behavior

to have such an icons to appear in the generated pdf as follow 👀 😀 💨 ♡

Actual Behavior

�� �� �� ♡

Steps to Reproduce the Behavior

`

         // Create a new MigraDoc document
        Document document = new Document();
        //document.UseCmykColor = true;

        // Add a section to the document
        Section section = document.AddSection();

        // Add a paragraph to the section
        Paragraph paragraph = section.AddParagraph();

        paragraph.Format.Font.Color = Color.FromCmyk(100, 30, 20, 50);

        // Add some text to the paragraph
        paragraph.AddFormattedText("Hello, World!", TextFormat.Bold);
        paragraph.AddFormattedText("👀 😀 💨 ♡", new Font("Segoe UI Emoji"));

        // Create a renderer for the MigraDoc document.
        PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);

        // Associate the MigraDoc document with a renderer
        pdfRenderer.Document = document;

        // Layout and render document to PDF
        pdfRenderer.RenderDocument();

        // Save the document...
        const string filename = "HelloWorld.pdf";
        pdfRenderer.PdfDocument.Save(filename);
        // ...and start a viewer.
        Process.Start(filename);

` IssueSubmission.zip

ThomasHoevel commented 5 years ago

This is a known limitation of PDFsharp. Surrogate pairs do not work yet and Unicode chars that require two 16-bit values (above 0xffff) will not show correctly.

ThomasHoevel commented 5 years ago

See also:
https://github.com/empira/PDFsharp/issues/63

Zeek2 commented 2 years ago

Any progress; Has this been fixed yet? This is major blocking issue for me :(

NeilPearson73 commented 1 year ago

This is a major blocking issue for me too