Insert .eps file into word document

Dear Team,

We need to insert .eps format file into word document using Aspose java.
I will try this source code Source.zip (325 Bytes) for inserting images into word document but I’ve below exception.

Exception in thread “main” java.lang.IllegalArgumentException: Parameter is not valid. FileFormat=0

I’ve attached sample .eps file for attached into word document. Img.zip (5.8 MB)

Expected OP : Expected OP.zip (9.5 MB)

Please give solution for this scenario.

Thank you

1 Like

@ssvel,
I am afraid, you would not be able to insert these EPS images directly inside Word document by using Aspose.Words for Java. Reading EPS image files is out of the scope of Aspose.Words for Java.
We have recently introduced a new API named Aspose.EPS that can read an EPS file first and then save it into other graphic format (such as PNG/JPEG) that is recognized by Aspose.Words and thus can be inserted via standard Aspose.Words’ InsertImage method.
But unlike Aspose.EPS for .NET, unfortunately, Aspose.EPS for Java currently does not support EPS to PNG or JPEG conversions. We have logged this issue (provide ability to convert .eps to .png or .jpg) in our bug tracking system. Your thread has been linked to the appropriate issues (EPSJAVA-36 and EPSJAVA-37) and you will be notified via this thread as soon as Aspose.EPS for Java supports EPS to PNG conversion. Sorry for the inconvenience.

Dear @awais.hafeez
awais.hafeez:

But unlike Aspose.EPS for .NET , unfortunately, Aspose.EPS for Java currently does not support EPS to PNG or JPEG conversions. We have logged this issue ( provide ability to convert .eps to .png or .jpg ) in our bug tracking system. Your thread has been linked to the appropriate issues ( EPSJAVA-36 and EPSJAVA-37 ) and you will be notified via this thread as soon as Aspose.EPS for Java supports EPS to PNG conversion. Sorry for the inconvenience

Is their any update in the mentioned issue EPSJAVA-36 and EPSJAVA-37?
Thanks…

@resh05
We would like to share with you that Aspose.EPS for Java and Aspose.XPS for Java have been merged into single API i.e. Aspose.Page for Java and now EPS/PS to Image conversion feature is available in merged version. Please feel free to let us know in case you have further inquiry or you face any issue.

Hi @asad.ali
Thank you for the update. Could you please share the link/ workaround solution where eps files converted to pdf file format.
Thanks …

@resh05
Please check Postscript to PDF conversion article in API documentation.

Hi @asad.ali

https://docs.aspose.com/page/java/convert/ps-to-pdf/

I used the above method but null pointer exception occurs.Kindly check the below screenshot.
null pointer error.jpg (322.9 KB)
Thanks…

@resh05
Would you please share your source file as ZIP so that we may try to reproduce and investigate it in our environment.

Hi @Farhan.Raza
Im able to reproduce the expected pdf with the conversion from ps to pdf, but a null pointer exception occurs during the conversion from eps to pdf file format.
Attached an input sample of eps file and source code.
Source code:
src.zip (805 Bytes)

Input sample:
Sample.zip (2.5 KB)

Thanks…

@resh05
Thank you for sharing requested data.
We have been able to reproduce NullPointerException and have logged it in our issue management system for further investigation and resolution. We will let you know as soon as any update will be available in this regard.

Dear @Farhan.Raza
Thank you