PYTHON'da PS ve EPS Dosyaları Nasıl Çalışırsınız

PYTHON'da PS ve EPS Dosyaları Nasıl Çalışırsınız

PYTHON’da PS ve EPS Dosyaları Nasıl Çalışırsınız

PsDocument PostScript ve EPS dosyalarının yükleme ve ihraç edilmesi için giriş noktasıdır. Kullanım from_file() Bir belgeyi yolda yüklemek için, ya da from_bytes() Bu sayede in-memory bytes ile yükleme yapılır. Tüm ürünler geri dönüştürülür. bytes - Geçici dosyalar disk üzerinde yazılmamıştır.

PS veya EPS dosyası yükleme

from aspose.page.ps.document import PsDocument

ps = PsDocument.from_file("input.ps")
eps = PsDocument.from_file("input.eps")
print("Is EPS:", eps.is_eps)

PDF’ye ihraç etmek

from pathlib import Path
from aspose.page.ps.document import PsDocument

ps = PsDocument.from_file("input.ps")
Path("output.pdf").write_bytes(ps.to_pdf())

PNG’ye ihracat

from pathlib import Path
from aspose.page.ps.document import PsDocument
from aspose.page.ps.output import ImageSaveOptions

eps = PsDocument.from_file("input.eps")
Path("output.png").write_bytes(eps.to_image(ImageSaveOptions(format="png", dpi=150)))

Bytes’ten yükleme

from aspose.page.ps.document import PsDocument

with open("input.ps", "rb") as f:
    doc = PsDocument.from_bytes(f.read())
pdf_bytes = doc.to_pdf()

See Also

 Türkçe