Getting "Invalid parameter used" While converting pdf From msg File

Hi team,

We are trying to convert msg file into pdf file by using below mentioned code snippet.

Please note this code is not working after aspose-word and aspose-pdf version upgrade to 23.10, earlier we were using aspose-word - 22.11 version and aspose-pdf version -22.2

public void saveTempPdf(byte[] docByteData) throws Exception 
{
    InputStream inputStream = new ByteArrayInputStream(docByteData);
    File file = this.saveTempPDFFromMailMsg(inputStream);
    inputStream = new FileInputStream(file);
    com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(inputStream);
    String docPrefix = UUID.randomUUID() + "temp_file";
    File tempFile = File.createTempFile(docPrefix, ".docx");
    com.aspose.pdf.DocSaveOptions saveOptions = new com.aspose.pdf.DocSaveOptions();
    saveOptions.setFormat(com.aspose.pdf.DocSaveOptions.DocFormat.DocX);
    saveOptions.setRelativeHorizontalProximity(2.5f);
    saveOptions.setRecognizeBullets(true);
    pdfDocument.save(tempFile.getAbsolutePath(), saveOptions);
}

public File saveTempPDFFromMailMsg(InputStream inputStream) throws Exception {
    MailMessage eml = MailMessage.load(inputStream);

    //Saving the Message to output stream in MHTML format
    ByteArrayOutputStream emlStream = getByteArrayOutputStream();
    eml.save(emlStream, com.aspose.email.SaveOptions.getDefaultMhtml ());

    //Loading the stream in Word document
    LoadOptions lo = new LoadOptions (  );
    lo.setLoadFormat ( com.aspose.pdf.LoadFormat.MHT.getValue());
    lo.setPreserveIncludePictureField(true);
    Document doc = new Document(getByteArrayInputStream(emlStream.toByteArray()), lo);

    File file = File.createTempFile(UUID.randomUUID().toString(), ".pdf");

    doc.save(file.getAbsolutePath(), SaveFormat.PDF);
    return file;
}

Getting below mentioned exception:

 FullName = com.aspose.pdf.internal.foundation.rendering.lv : Name = l2if, FullName = com.aspose.pdf.internal.foundation.rendering.l2if : **Invalid parameter used.**[ [Ljava.lang.StackTraceElement;@544ed978][ [Ljava.lang.StackTraceElement;@56707ce8]","error.stack_trace":"class com.aspose.pdf.internal.ms.System.lh: Name = lv, FullName = com.aspose.pdf.internal.foundation.rendering.lv : Name = l2if, FullName = com.aspose.pdf.internal.foundation.rendering.l2if : Invalid parameter used.[ [Ljava.lang.StackTraceElement;@544ed978][ [Ljava.lang.StackTraceElement;@56707ce8]
com.aspose.pdf.internal.foundation.rendering.l0if.accept(Unknown Source)
com.aspose.pdf.internal.foundation.rendering.lv.accept(Unknown Source)
com.aspose.pdf.internal.l24u.lj.lI(Unknown Source)
com.aspose.pdf.internal.l96j.le.lI(Unknown Source)
com.aspose.pdf.internal.l16j.ld.lI(Unknown Source)
com.aspose.pdf.internal.l16j.lv.lI(Unknown Source)
com.aspose.pdf.internal.l16j.lb.lf(Unknown Source)
com.aspose.pdf.internal.l16p.lj.lI(Unknown Source)
com.aspose.pdf.internal.l2v.lf.lI(Unknown Source)
com.aspose.pdf.l5t.lI(Unknown Source)
com.aspose.pdf.l5t.lI(Unknown Source)
com.aspose.pdf.ADocument.lj(Unknown Source)
com.aspose.pdf.ADocument.lI(Unknown Source)
com.aspose.pdf.Document.lI(Unknown Source)
com.aspose.pdf.ADocument.lI(Unknown Source)
com.aspose.pdf.ADocument.save(Unknown Source)
com.aspose.pdf.Document.save(Unknown Source)
com.sirionlabs.asposeParser.service.helper.AsposeParserHelper.saveTempPdf(AsposeParserHelper.java:225)
com.sirionlabs.asposeParser.service.helper.AsposeParserHelper$$FastClassBySpringCGLIB$$d2b4765a.invoke(<generated>)
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java

@ashu_agrawal_sirionlabs_com Your saveTempPDFFromMailMsg method convert MSG to PDF, and saveTempPdf method converts PDF to DOCX. So do you need to convert MSG to both PDF and DOCX documents? If so, you can simply used Aspose.Words to save the document as PDF and as DOCX.

According to stack trace the exception occurs upon processing PDF document using Aspose.PDF.

Anyways, please attach the problematic documents here for testing. We will check the issue and provide you more information.