Pdf.save() keeps working inflating the size upto 1G and works forever

Hello,
In some cases where we add word documents, using the following code
ByteArrayInputStream bais = new ByteArrayInputStream(docToString(fo).getBytes(“UTF-8”));

Pdf pdf = new Pdf();
pdf.bindFO(bais);

pdf.save(out);

save hangs and keep downloading to OutputStream out for ever, ending with corrupted pdf.

Actually the file is 42kb, but why we end up 500MB or 1G and end up corrupted pdf?

We don’t have source code, may be you have some suggestions.

Thanks.
Selim.

Hi Selim,


Thanks for your inquiry. I have tested the scenario with a sample file using Aspose.Pdf for Java 9.1.0, but unable to replicate the issue. We will appreciate if you please share your sample source file here so we will test the scenario and will provide you more information accordingly.

We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal,

I can attach a sample case file privately if you can advice me how to do it.
Thanks for your response.

Selim.

HI Selim,


Thanks for your feedback. Please share your sample file via email as suggested here. So we will test it and will share our findings accordingly.

Best Regards,

Ok will do so.
Current version we have is aspose.pdf_3.0.1.
Seems our license agreement allows us to upgrade to the latest version 9.1.
Planning to upgrade.
Just playing with 9.1 version, ending up,
"
class com.aspose.pdf.internal.hv.f: Illegal characters in path.
"

What the path refers here?
This does not seem an IO or some other file issue. Appreciate your advices if you may have some suggestion for me during your testing.

HI Selim,


We are sorry for the inconvenience caused. Can you please share you sample code here, so we will try to replicate the issue at our end and will provide you more information accordingly.

Best Regards,

Hi Selim,


Please ignore my previous reply. I have received your email related to the issue. I am looking into it and will update you soon.

We are sorry for the inconvenience caused.

Best Regards,

Hi Selim,


Thanks for sharing the feedback.

Before the release of Aspose.Pdf for Java 9.1.0 was published, it went through a series of Unit tests and we did not notice any issue while converting XSL-FO files to PDF format. Can you please share following details so we may try replicating the problem at our end.

  • Operating System version.
  • JDK version
  • Source code which you are using.

Thanks for your responses.

I already sent Tilal a sample test java code with necessary documents including information you may need.
Appreciate your timely help.
Selim.

Hi Selim,


Thanks for sharing the source files and code. We have managed to replicate the issue and logged it as PDFNEWJAVA-34253 in our issue tracking system for further investigation and resolution. We will keep you updated about the issue resolution progress via this forum thread.

Moreover in reference to the exception you found with new version, please note you are using an old license with the latest release so the exception is being raised.

We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal,

Thanks for quick response.

Is there any chance to resolve this issue by upgrading to 9.1?
I am not sure if you have tested the scenario with the version 9.1.

On our side it is advantageous to get Byte Stream:

ByteArrayInputStream bStream = new ByteArrayInputStream(XSL-FOToString.getBytes(“UTF-8”));

Then Pass it to bindingFO:
pdf.bindFO(bStream );

I don’t see it is available in version 9.1 any more.

What would be the best approach to get the same result using 9.1?

Hi Selim,


Thanks for your feedback. We had already tested your scenario with Aspose.Pdf for Java 9.1.0 and found its also not working with it. So already logged it above. We will notify you as soon as it is resolved.

Best Regards,
Hi Selim,

Thanks for your inquiry.

selo:
On our side it is advantageous to get Byte Stream:

ByteArrayInputStream bStream = new ByteArrayInputStream(XSL-FOToString.getBytes(“UTF-8”));

Then Pass it to bindingFO:
pdf.bindFO(bStream );

I don’t see it is available in version 9.1 any more.

What would be the best approach to get the same result using 9.1?


I have used file path for testing in Aspose.Pdf for Java 9.1.0. You are right bindFO() signature with ByteArrayInputStream is not available in 9.1.0. We have logged an enhancement ticket PDFNEWJAVA-34254 for same. We will keep you updated about the issue resolution.

We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal,
Any update is appreciated.
Thanks,
sELIM.

Hi Selim,


Thanks for your inquiry. I am afraid as we have logged the issues recently, these are pending for investigation in queue with other priority task. As soon as investigation of these issues is completed then we will be in a good position to share an ETA with you.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-34254) have been fixed in Aspose.Pdf for Java 9.3.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Both issues, save and Stream byte enhancement?
Just double checking.
Thanks for your update.
Selim.

Hi Selim,


Thanks for your inquiry. Please note your ByteArrayInputStream enhancement issue is resolved now you may use ByteArrayInputStream in method bindFO(InputStream xmlStream).

Moreover, other issue(PDFNEWJAVA-34253) related to save method is not resolved yet. We will update you as soon as it is resolved.

Thanks for your patience and cooperation.

Best Regards,

Hi Salim,


Thanks for your inquiry. In reference toPDFNEWJAVA-34253, please use new DOM approach for XML to PDF conversion as following with latest release of Aspose.Pdf for Java, it will resolve the issue.

XslFoLoadOptions xslFoLoadOptions = new XslFoLoadOptions();<o:p></o:p>

xslFoLoadOptions.setUseOldXslFoEngine(false);

Document doc = new Document(testdata + "PDFNEWJAVA_34253_good.xml", xslFoLoadOptions);

doc.save(testout + "PDFNEWJAVA_34253.pdf");


Please feel free to contact us for any further assistance.


Best Regards,