Cannot convert pdf to docx

Hello,

I used java code below to convert pdf to docx then the program throw error “Argument width[0] or height[0] cannot be less or equal to zero”.
Can you please assist to fix this issue?

aspose-pdf version: 22.3
Java Code:
String InputFilePath = “/mnt/data/Work/test.pdf”;
String OutputFilePath = “/mnt/data/Work/test.pdf.docx”;
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(InputFilePath);
com.aspose.pdf.DocSaveOptions saveOptions = new com.aspose.pdf.DocSaveOptions();
saveOptions.setFormat(com.aspose.pdf.DocSaveOptions.DocFormat.DocX);
pdfDocument.save(OutputFilePath, saveOptions);

Error message:
com.aspose.pdf.internal.ms.System.lh: Argument width[0] or height[0] cannot be less or equal to zero
at com.aspose.pdf.internal.l182u.lj.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.internal.l155n.lf.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.internal.l155n.lf.(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.internal.l202n.le.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.internal.l17if.ld.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.internal.l17if.lv.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.internal.l17if.lb.lf(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.internal.l16k.lj.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.internal.l2l.lf.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.l5if.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.l5if.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.ADocument.lj(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.ADocument.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.Document.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.ADocument.lI(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.ADocument.save(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]
at com.aspose.pdf.Document.save(Unknown Source) ~[aspose-pdf-22.8.jar:22.8]

Best regards,
Waranya

@Rammoslee

Could you please attach your input PDF here for testing? We will investigate the issue and provide you information on it.

Input pdf in attached.test.pdf (4.4 MB)

@Rammoslee

We have tested the scenario using the latest version of Aspose.PDF for Java 22.9 and have not found the shared issue. So, please use Aspose.PDF for Java 22.9.

We have attached the output DOCX with this post for your kind reference. out DOCX.zip (9.2 MB)

I have tested conversion using the latest version of Aspose.PDF for Java 22.9 and still found same the error message. Can you please send your testing java code?

Error:
com.aspose.pdf.internal.ms.System.lh: Argument width[0] or height[0] cannot be less or equal to zero
at com.aspose.pdf.internal.l182u.lj.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.internal.l155n.lf.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.internal.l155n.lf.(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.internal.l202n.le.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.internal.l17if.ld.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.internal.l17if.lv.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.internal.l17if.lb.lf(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.internal.l16k.lj.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.internal.l2l.lf.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.l5if.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.l5if.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.ADocument.lj(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.ADocument.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.Document.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.ADocument.lI(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.ADocument.save(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]
at com.aspose.pdf.Document.save(Unknown Source) ~[aspose-pdf-22.9.jar:22.9]

@Rammoslee

We tested the scenario and it takes time for PDF to DOCX conversion. However, exception is not thrown.

Could you please share your working environment e.g. operating system, Java version etc.?

We working environment.

  • ubuntu version: 20.04
  • dev tools: Eclipse
  • framework: spring boot, maven
  • java version: 1.8
  • aspose version: 22.9

@Rammoslee

We have logged this problem in our issue tracking system as PDFJAVA-42139. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.