Index Value Error while converting Words to PDF

While converting Word document to PDF Document using Aspose.words in SUSE Linux Environment, Facing Error like Below

Expected a value between 0 and 0.
Parameter name: index
java.lang.IllegalArgumentException: Expected a value between 0 and 0.
Parameter name: index
at com.aspose.words.internal.zzYS.zzZ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzKF.zzYO(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzKF.get(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzON.zzVF(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzOL.zzY(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzOL.zzZ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zz73.zzZ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zz73.zzZ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzP5.zzQ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzCG.zzQ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzCJ.zzy5(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzBB.zzW(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzC3.zzZ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzD7.zzW(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzD9.zzIN(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.internal.zzBH.zzIN(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.zzYX9.zzZji(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.zzZU2.zzZ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.zzZ8E.zzZ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.Document.zzY(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.Document.zzZ(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]
at com.aspose.words.Document.save(Unknown Source) ~[aspose-words-21.2-jdk17.jar:21.2.0]

Is WORDSNET-10297 issue resolved in Aspose Words for Java?

@Prem_Parmar

The error you are encountering while converting a Word document to PDF using Aspose.Words in a SUSE Linux environment, specifically the java.lang.IllegalArgumentException: Expected a value between 0 and 0, suggests that there may be an issue with the document being processed or the way it is being accessed.

To address this issue, consider the following steps:

  1. Check Document Integrity: Ensure that the Word document you are trying to convert is not corrupted. You can try opening it in Microsoft Word or another compatible application to verify its integrity.

  2. Update Aspose.Words: Make sure you are using the latest version of Aspose.Words for Java. If you are using an older version, it may contain bugs that have been fixed in later releases. The issue you mentioned, identified as WORDSNET-10297, may have been resolved in a more recent version.

  3. Review Code Implementation: Ensure that your code for loading and saving the document is correct. Here’s a basic example of how to convert a Word document to PDF:

    // Load the Word document
    Document doc = new Document("path/to/your/document.docx");
    
    // Save the document as PDF
    doc.save("output.pdf");
    
  4. Check for Specific Document Features: Some features in Word documents may not be supported or may cause issues during conversion. If your document contains complex elements (like certain types of images, embedded objects, or specific formatting), try simplifying the document to see if that resolves the issue.

  5. Consult Documentation: For more detailed guidance on exporting documents to PDF, you can refer to the official Aspose documentation, which provides comprehensive instructions and examples.

If the problem persists after trying these steps, consider reaching out to Aspose support or checking the Aspose forums for similar issues and solutions shared by other users.

For further assistance, you can refer to the following resources:

If you have any more specific details about the document or the code you are using, feel free to share them for more tailored assistance.

// Load the Word document
Document doc = new Document("path/to/your/document.docx");

// Save the document as PDF
doc.save("output.pdf");

We are using the same way like above. Issue seems to be specific to SUSE environment.

@Prem_Parmar Could you please attach the problematic input document here for testing? We will check the issue and provide you more information.

If you try to convert word document having simple bullets [~ symbol font] into PDF using aspose words in SUSE Environment, Issue is happening.

@Prem_Parmar Unfortunately, I cannot reproduce the problem on my side. Could you please attach the problematic input document here for testing?

Is it possible that if SUSE Linux System if don’t have Symbol font installed then This issue can be occurred. Can you please help on this, if your system has this font?

@Prem_Parmar It is not likely the problem might be caused by a missed font. If some font is not available, Aspose.Words simply uses an alternative font among the available ones or the last resort font embedded into Aspose.Words library.

@alexey.noskov, Issue is not for generating word document. Its working… Issue for PDF conversion. Is that thing applicable for Words to PDF conversion?

@Prem_Parmar Fonts are not required for generating MS Word documents. The above information about font is applicable only for document rendering, i.e. conversion to fixed page formats like PDF, XPS, Image etc.

Expected a value between 0 and 0.
Parameter name: index
java.lang.IllegalArgumentException: Expected a value between 0 and 0.

It’s specific to SUSE Linux only. Is it possible we can avoid this by some or other way… Because We can find a part of issue where from whole document only bullet is having issue…

Bullets have symbol fonts. and Our SUSE environment doesn’t have that…

@Prem_Parmar Could you please attach the document that causes the problem on your side here for testing?

Copy_of_WBS_parameter_report.docx (10.0 KB)

Please take a look…

@Prem_Parmar Thank you for additional information. unfortunately, the problem is not reproducible on my side. Code for testing:

Document doc = new Document("/temp/in.docx");
doc.save("/temp/out.pdf");

Dockerfile for testing:

FROM registry.suse.com/bci/openjdk-devel:17
COPY ./out/artifacts/TestJava_jar/ /tmp
WORKDIR /tmp
ENTRYPOINT ["java","-jar","TestJava.jar"]

Here is the produced output: out.pdf (15.8 KB)