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

Free Support Forum - aspose.com

PDF to Word Exception: 'Object reference not set to an instance of an object.'

SamplePdf.pdf (168.3 KB)

We cannot save attached pdf to word with below code.

  static void SavePDF2Docx()
    {
        Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(@"C:\Users\User1\Desktop\PDF\sample.pdf");

        // Save the file into MS document format
      pdfDocument.Save(@"C:\Users\User1\Desktop\PDF\sample.docx", Aspose.Pdf.SaveFormat.DocX);
        Aspose.Pdf.XpsSaveOptions saveOptions = new Aspose.Pdf.XpsSaveOptions();
    }

@kp39

Thanks for contacting support.

We have checked the PDF document which you have shared and it seems that it is corrupted. While opening with Adobe Reader, we have observed an error dialog saying “Bad Font or Font Descriptor Object”. For your reference, I have also attached an screenshot of prompt dialog.

BadFont_FontDescriptor.png (8.3 KB)

Would you please share a valid PDF document with us, so that we can test the scenario in our environment and address it accordingly.

Ohh we have used chrome and edge to view file and it is opened corretly and also this file is generated via aspose api only, can you please check file in chrome?

@kp39

Thanks for writing back.

The document was viewed correctly in chrome over our end, though we have also observed the issue, which you have mentioned earlier, while converting it to DOCX. However, we have logged an issue as PDFNET-43308 in our issue tracking system, along with the document. We will further investigate the reasons behind this issue and keep you updated with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

PS: Meanwhile, would you please share a sample code snippet, with which you are generating PDF document.