Free Support Forum - aspose.com

Document Displays Different character in List label on saving DOCX as PDF

Hi Aspose Team
We have a document with Un-ordered List which has a number format as “:heavy_check_mark:”.When we deliver it as DOCX it is rendering correctly But when we save the same as PDF(saving DOCX as PDF) we are encountering a special character instead of “:heavy_check_mark:” in PDF.Please assist us further on this.
Provided a sample Snippet to showcase the issue:

using Aspose.Words;
using Aspose.Words.Lists;
using System.IO;
using Aspose.Words.Saving;

namespace AsposeWordPOC
{

class Program
{

    static void Main(string[] args)
    {
        // License
        InitAsposeLicense();
        // method to show the Listlabel sample in PDF
        PocForListlabelPDF();
        // method to show the Listlabel sample in Docx
        PocForListlabelDocx();
    }


    public static void PocForListlabelPDF()
    {
        try
        {
            Document Doc = new Document();
            Section sec = new Section(Doc);
            Body body = new Body(Doc);
            Paragraph List = ListCreation(Doc);
            body.AppendChild(List);
            sec.AppendChild(body);
            Doc.RemoveAllChildren();
            Doc.AppendChild(sec);
            // saving the output as Pdf.
            SaveAsPDF(Doc);
        }
        catch
        {

        }
    }
    public static void PocForListlabelDocx()
    {
        try
        {
            Document Doc = new Document();
            Section sec = new Section(Doc);
            Body body = new Body(Doc);
            Paragraph List = ListCreation(Doc);
            body.AppendChild(List);
            sec.AppendChild(body);
            Doc.RemoveAllChildren();
            Doc.AppendChild(sec);
            Doc.Save("Document.docx");
        }
        catch
        {

        }
    }

    public static void SaveAsPDF(Document Doc)
    {
        try
        {
            using (MemoryStream ms = new MemoryStream())
            {
                Doc.Save(ms, SaveFormat.Docx);
                PdfSaveOptions options = new PdfSaveOptions();
                options.SaveFormat = SaveFormat.Pdf;
                Document document = new Document(ms);
                string outFile = "PDF.pdf";
                document.Save(outFile, options);
            }
        }
        catch
        {

        }
    }

    public static Paragraph ListCreation(Document doc)
    {
        Paragraph para = new Paragraph(doc);
        List list = null;
        ListLevel lstLevel = null;
        try
        {
            list = doc.Lists.Add(ListTemplate.NumberDefault);
            lstLevel = list.ListLevels[0];
            // this list number format is not supported in aspose when we save Docx as PDF
            lstLevel.NumberFormat = "✔";
            Run run = new Run(doc);
            run.Text = "This is a sample application on the Aspose. ";
            para.AppendChild(run);
            para.ListFormat.List = list;
        }
        catch
        {

        }
        return para;
    }
   
    public static void InitAsposeLicense()
    {
        Aspose.Words.License WordsLicense = new Aspose.Words.License();
        WordsLicense.SetLicense("Aspose.Total.lic");

    }
   
}

}

@Divyakailash,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15687. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@Divyakailash,

The issues you have found earlier (filed as WORDSNET-15687) have been fixed in this Aspose.Words for .NET 17.9 update and this Aspose.Words for Java 17.9 update.