Hello team,
While converting word to PDF some of the texts are not rendering correctly in PDF instead i am getting below error message in pdf
Error! No text of specified style in document
Please find the attached input and output filecurrentQueue_out.zip (83.7 KB)
I am using below code to convert word to pdf
public bool WordToPdf(Aspose.Words.Document doc, string outPdfPath, out string errorMessage)
{
bool res = false;
errorMessage = string.Empty;
try
{
Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
options.DmlRenderingMode = Aspose.Words.Saving.DmlRenderingMode.Fallback;
options.UpdateFields = true;
options.DmlEffectsRenderingMode = Aspose.Words.Saving.DmlEffectsRenderingMode.Simplified;
// options.Compliance = Aspose.Words.Saving.PdfCompliance.PdfA1b;
options.UseBookFoldPrintingSettings = true;
options.ImageCompression = Aspose.Words.Saving.PdfImageCompression.Auto;
options.ZoomBehavior = Aspose.Words.Saving.PdfZoomBehavior.FitPage;
options.UseHighQualityRendering = true;
options.OptimizeOutput = true;
options.MemoryOptimization = true;
//options.UpdateSdtContent = true;
doc.AcceptAllRevisions();
doc.Revisions.AcceptAll();
RemoveComments(doc);
doc.UpdateFields();
doc.Save(outPdfPath, options);
// doc.Save(outPdfPath + ".docx");
res = true;
}
catch (Exception ex)
{
errorMessage = ex.Message;
try
{
Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
options.DmlRenderingMode = Aspose.Words.Saving.DmlRenderingMode.DrawingML;
options.ImageCompression = Aspose.Words.Saving.PdfImageCompression.Auto;
//options.MemoryOptimization = true;
options.TempFolder = Path.Combine(Path.GetTempPath(), "astmp");
try
{
Directory.CreateDirectory(options.TempFolder);
}
catch
{
}
doc.AcceptAllRevisions();
doc.Revisions.AcceptAll();
RemoveComments(doc);
doc.Save(outPdfPath, options);
res = true;
}
catch (Exception e)
{
}
}
return res;
}
Any help on this will be much appericiated