Supply.docx (14.2 KB)
qww.pdf (84.7 KB)
Hi Team, When we try to convert word to PDF we get error on Document. Please see attached word and PDF. Please let me know how can I remove this.
Supply.docx (14.2 KB)
qww.pdf (84.7 KB)
Hi Team, When we try to convert word to PDF we get error on Document. Please see attached word and PDF. Please let me know how can I remove this.
@Vipin_Paliwal The problem occurs because your document contains REF fields, but does not contain bookmarks the REF fields refer to. Aspose.Words by default updates fields in the document before conversion to PDF, just like MS Word does. And since there are no referenced bookmarks, errors are shown instead of field value. This is an expected behavior.
You can resolve the issue either by disabling updating fields:
Document doc = new Document(@"C:\Temp\in.docx");
PdfSaveOptions options = new PdfSaveOptions();
options.UpdateFields = false;
doc.Save(@"C:\Temp\out.pdf", options);
or by unlinking REF fields in your document before conversion:
Document doc = new Document(@"C:\Temp\in.docx");
List<Field> refs = doc.Range.Fields.Where(f => f.Type == FieldType.FieldRef).ToList();
foreach (Field f in refs)
f.Unlink();
doc.Save(@"C:\Temp\out.pdf");
Thanks for Reply.
I have aspose.word(22.6) and Aspose.PDF (22.5). I not find property your shared in code
PdfSaveOptions options = new PdfSaveOptions();
options.UpdateFields = false;
List refs = doc.Range.Fields.Where(f => f.Type == FieldType.FieldRef).ToList();
foreach (Field f in refs)
f.Unlink();
@Vipin_Paliwal Looks like you are using PdfSaveOptions from Aspose.PDF, but you should use Aspose.Words.Saving.PdfSaveOptions. Try using fully qualified name:
Document doc = new Document(@"C:\Temp\in.docx");
Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
options.UpdateFields = false;
doc.Save(@"C:\Temp\out.pdf", options);