Convert OTG files
Contents
[
Hide
]
Convert OTG files
Aspose.Imaging for Python via .NET now supports converting images from OTG to PDF and other image formats. Following code snippet demonstrates the said functionality.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.pycore as aspycore | |
from aspose.imaging import Image | |
from aspose.imaging.fileformats.opendocument import OtgImage | |
from aspose.imaging.imageoptions import PdfOptions | |
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.otg")), OtgImage) as image: | |
image.save(os.path.join(data_dir, "result.pdf"), PdfOptions()) | |
if delete_output: | |
os.remove(os.path.join(data_dir, "result.pdf")) |