Free Support Forum - aspose.com

Word to PDF Conversion Failure using Aspose.Words for Java

Hi,

We are unable to save Word document as PDF file using Aspose.Words version 20.9 for Java.

In our analysis, the references and footnotes in the word file are causing the failure.

Attaching the Word file and Java code snippet along with the Exception below.

Code Snippet:

try
{
	com.aspose.words.Document doc;
	doc = new com.aspose.words.Document("aspose-poc.docx");
	// Save as PDF
	String filename = UUID.randomUUID().toString() + "_wordtopdf.pdf";
	System.out.println("show revisions");
	doc.getLayoutOptions().getRevisionOptions().setShowInBalloons(1);
	System.out.println("save doc");
	doc.save(filename, com.aspose.words.SaveFormat.PDF);
}
catch(Exception e)
{
	e.printStackTrace();
}

Exception:

java.lang.NullPointerException
	at com.aspose.words.zzZAE.isVisible(Unknown Source)
	at com.aspose.words.zzZAI.zzYUc(Unknown Source)
	at com.aspose.words.zzZAG.zzZ(Unknown Source)
	at com.aspose.words.zzXF.zz9p(Unknown Source)
	at com.aspose.words.zzXF.zz9q(Unknown Source)
	at com.aspose.words.zzXF.zzW(Unknown Source)
	at com.aspose.words.zzXF.zzX(Unknown Source)
	at com.aspose.words.zzZ2M.zzB(Unknown Source)
	at com.aspose.words.zzZ2M.zzC(Unknown Source)
	at com.aspose.words.zzZ2M.zzYLi(Unknown Source)
	at com.aspose.words.zzZ2M.zzL(Unknown Source)
	at com.aspose.words.zzZ1Y.zzJ(Unknown Source)
	at com.aspose.words.zzYR7.zza(Unknown Source)
	at com.aspose.words.zz7M.zzJ(Unknown Source)
	at com.aspose.words.zz7N.zzZCx(Unknown Source)
	at com.aspose.words.zzZ2R.zzYLB(Unknown Source)
	at com.aspose.words.Document.updatePageLayout(Unknown Source)
	at com.aspose.words.zz29.zzZw8(Unknown Source)
	at com.aspose.words.zz2A.zzEU(Unknown Source)
	at com.aspose.words.zzZZ1.zzXU(Unknown Source)
	at com.aspose.words.zzZZ1.zzZ(Unknown Source)
	at com.aspose.words.zzZZ1.zzYV(Unknown Source)
	at com.aspose.words.Document.zzZDP(Unknown Source)
	at com.aspose.words.Document.zzY(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.Document.save(Unknown Source)
	at com.aspose.words.Document.save(Unknown Source)
	at poc.main.Main.wordToPDFFilePathReturn(Main.java:451)
	at poc.main.Main.main(Main.java:201)

Word File:

aspose-poc.docx (59.1 KB)

Please guide, thanks in advance!

@mussab,

After an initial test with the licensed latest (21.5) version of Aspose.Words for Java, we were unable to reproduce this exception on our end (see Aspose.Words 21.5 generated output: awjava-21.5.pdf (61.7 KB)). So, we suggest you to please upgrade to the latest (21.5) version of Aspose.Words for Java.