Aspose Imaging for Java - Convert EPS to PDF


#1

Hi I am looking for example to convert eps file to PDF using Aspose Imaging for Java. Can’t find any direct example
Attaching a simple EPS file for reference.

I tried to update sample code from https://docs.aspose.com/display/imagingjava/Manipulating+Photoshop+Formats#ManipulatingPhotoshopFormats-SupportforEPSFormat

here is the code im using

EpsImage epsImage = (EpsImage) EpsImage.load(imagePath);
	if(epsImage.hasRasterPreview()) {
		
		if (epsImage.getPhotoshopThumbnail() != null)
		{
			// process Photoshop thumbnail if it's present
		}

		if (epsImage.getEpsType() == EpsType.Interchange)
		{
			// Get EPS Interchange subformat instance
			EpsInterchangeImage epsInterchangeImage = (EpsInterchangeImage)epsImage;

			if (epsInterchangeImage.getRasterPreview() != null)
			{
				// process black-and-white Interchange raster preview if it's present
			}
		}
		else
		{
			// Get EPS Binary subformat instance
			EpsBinaryImage epsBinaryImage = (EpsBinaryImage)epsImage;

			if (epsBinaryImage.getTiffPreview() != null)
			{
				// process TIFF preview if it's present
			}

			if (epsBinaryImage.getWmfPreview() != null)
			{
				// process WMF preview if it's present
			}
		}
		
		
		String pdfPath = imagePath + ".pdf";
		 PdfOptions exportOptions = new PdfOptions();
		 exportOptions.setPdfDocumentInfo(new com.aspose.imaging.fileformats.pdf.PdfDocumentInfo());
		 epsImage.save(pdfPath, exportOptions);
		System.out.println("Converted to PDF");
	}
	else {
		System.out.println("Raster Preview not available");
	}

. 38233Y.EPS.zip (9.8 KB)


#2

@sachin1988

Thank you for contacting support.

We would like to update you that you may convert EPS files to PDF with Aspose.EPS for Java as explained in Convert PostScript File to PDF Document. However, size of your sample file is around 10KB so you need to Apply License in order to avoid 1KB Evaluation Version Limitation. You may request free temporary license and evaluate latest version of the API as per your requirements.

Furthermore, we have noticed a file specific problem while rendering your EPS file to PDF document. A ticket with ID EPSJAVA-25 has been logged in our issue management system for further investigation and resolution. We will let you know as soon as some updates will be available in this regard.