Convert eps to pdf

Contents
[ ]

Using Aspose.Imaging we can convert eps file to Pdf.

The following code snippet shows you how to convert Eps to Pdf.

import aspose.pycore as aspycore
from aspose.imaging import Image, PdfComplianceVersion
from aspose.imaging.imageoptions import PdfOptions
from aspose.imaging.fileformats.eps import EpsImage
from aspose.imaging.fileformats.pdf import PdfCoreOptions
import os
if 'TEMPLATE_DIR' in os.environ:
templates_folder = os.environ['TEMPLATE_DIR']
else:
templates_folder = r"C:\Users\USER\Downloads\templates"
delete_output = 'SAVE_OUTPUT' not in os.environ
data_dir = templates_folder
with aspycore.as_of(Image.load(os.path.join(data_dir, "template.eps")), EpsImage) as image:
pdf_core_options = PdfCoreOptions()
pdf_core_options.pdf_compliance = PdfComplianceVersion.PDF_A1B
options = PdfOptions()
options.pdf_core_options = pdf_core_options
image.save(os.path.join(data_dir, "result.pdf"), options)
if delete_output:
os.remove(os.path.join(data_dir, "result.pdf"))