Hi Aspose Team
We have a document with Un-ordered List which has a number format as “”.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 “” 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");
}
}
}