We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Chunk data shows in the PDF Export from Docx

Hi
When we export docx to PDF, PDF shows chunk data in the top of the Page. The following files are attached

  1. Docx to Exported in PDF.doc - Differnce between docx and PDF
  2. RMP Discharge summary.pdf - Exported PDF
  3. Discharge summary.Docx - Original docx

Regards
Rathinam

Hi Rathinam,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your document to Pdf using MS Word, you will get the same output.

In the header of your document there are mail merge fields. Please see the attached image for detail. You can check these fields my pressing the Alt + F9 button. Hope this answers your query. Please let us know if you have any more queries.

Hi,
Thanks for your reply.
We are using the merge fields in Body also. but its showing properly after exported to PDF. Only <> is getting displayed in header and footer. So is there any settings or any way to achieve the correct data is header and footer also.
Awaiting for your reply.
Regards and Thanks
Rathinam

Hi Rathinam,

Thanks for your inquiry.
Please note that Aspose.Words mimics the same behavior as MS Word does.
If you convert your document to Pdf using MS Word, you will get the
same output.
Please update the mail merge fields using MS Word (select all fields and press F9) and check the output.

Please use the following workaround to convert your document to Pdf. Hope this helps you.

Document doc = new Document(MyDir + "Discharge+summary.Docx");
DocumentBuilder builder = new DocumentBuilder(doc);
foreach (Field field in doc.Range.Fields)
{
    if (field.Type == FieldType.FieldMergeField)
    {
        builder.MoveToField(field, true);
        if (field.Result.Trim() != "")
            builder.Write(field.Result);
    }
}
doc.MailMerge.DeleteFields();
doc.Save(MyDir + "Out.pdf");