Mht to pdf - exception is thrown "Value of 'value' is invalid"

language java 21

library
aspose-html 25.2.2

During conversion from mht to pdf, exception is thrown “Value of ‘value’ is invalid”

input file
127.zip (16.4 KB)

output pdf
127_html.pdf (19.8 KB)

@divine1

The exception “Value of ‘value’ is invalid” during the conversion from MHT to PDF using Aspose.HTML can occur due to various reasons, such as issues with the input MHT file or the configuration of the conversion options.

To troubleshoot this issue, you can follow these steps:

  1. Check the Input File: Ensure that the MHT file you are trying to convert is not corrupted and is properly formatted. You can try opening it in a web browser to verify its content.

  2. Use Proper Conversion Code: Make sure you are using the correct code for the conversion. Here is a sample code snippet that demonstrates how to convert an MHT file to PDF using Aspose.HTML:

    import com.aspose.html.saving.PdfSaveOptions;
    import com.aspose.html.converters.Converter;
    
    public class MHTMLToPDFConverter {
        public static void main(String[] args) {
            try (java.io.FileInputStream fileInputStream = new java.io.FileInputStream("path/to/your/input.mht")) {
                // Initialize PdfSaveOptions
                PdfSaveOptions options = new PdfSaveOptions();
                options.setJpegQuality(100); // Set JPEG quality if needed
    
                // Convert MHTML to PDF
                Converter.convertMHTML(fileInputStream, options, "path/to/your/output.pdf");
            } catch (Exception e) {
                e.printStackTrace(); // Handle exceptions appropriately
            }
        }
    }
    
  3. Update Library: Ensure that you are using the latest version of the Aspose.HTML library. Sometimes, bugs are fixed in newer releases, so updating to the latest version may resolve the issue.

  4. Review Documentation: Check the official Aspose documentation for any specific requirements or limitations regarding MHT to PDF conversion.

If the problem persists after following these steps, consider reaching out to Aspose support with details about your input file and the exact error message for further assistance.

Feel free to share any additional information or error logs that might help in diagnosing the issue.

Sources:
[1]: Examples_Java_Conversion_MHTMLtoPDF_1.java
[2]: Examples_Java_ConvertingBetweenFormats_ConvertMHTMLToPDF_ConvertMHTMLFileToPDF.java

@divine1

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): HTMLJAVA-2007

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

this issue is not fixed in aspose-html 25.3. please fix this

@divine1

Sadly, the ticket hasn’t been yet resolved that is why you are noticing it still in 25.3 version. We will let you know as soon as it is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.