PS, EPS ve XPS’yi dönüştürün
.NET için PS, EPS ve XPS dönüştürücü API Çözümü.
PostScript PS ve Encapsulated PostScript EPS Dosyalarının yanı sıra XPS belgelerinin programlı olarak dönüştürülmesi gerektiğinde, .NET API bunu sorunsuz bir şekilde yapabilir ve çoklu dosyaları dönüştürür. PS ve EPS için API, Düzey 1-3 PostScript operatörlerini ve EPS başlık yorumlarının çoğunu destekler ve ayrıca birkaç yazı tipi durumu ve Time New Roman gibi yazı tipleriyle API anlaşmaları dışında maksimum uyumluluğa sahip PostScript belgelerini dönüştürür.
Ayrıca, XPS dosyalarının dönüştürülmesi için API, sayfalar ekleyebilir veya kaldırabilir, tuvaller, yollar ve glif öğeleriyle ilgilenebilir, vektör grafik şekilleri, metin dizeleri oluşturabilir, XPS anahat öğelerini dönüştürebilir ve daha fazlasını yapabilir.
Buradaki .NET için API çözümü, PS, EPS ve XPS gibi PDL biçimlerindeki dosyaları programlı olarak dönüştürmenize izin verir, ancak bu yerel API'ler üzerinde geliştirilmiş çapraz platformları görmek ve denemek faydalı olabilir.
C# .NET aracılığıyla PostScript'ten PDF'ye Dönüştürme.
PostScript PS ve Encapsulated PostScript EPS dosyalarını .NET API aracılığıyla PDF'ye dönüştürmek için sonraki adımları uygulamanız gerekir:
- PsDocument Class kullanarak PS veya EPS dosyasını yükleyin.
- PdfSaveOptions Class kullanarak PDF kaydetmeyi ayarlayın.
- Çıktı PDF dosyası için FileStream Class kullanın.
- PdfDevice Class çıktı PDF dosya akışı nesnesiyle başlatarak.
- PDF dönüştürme için PsDocument.Save numaralı telefonu arayın.
PS EPS'den PDF'ye Dönüştürme için C# Kodu
// The path to the documents directory. | |
string dataDir = "definedDirectoryPath"; | |
// Initialize PsDocument with the name of PostScript file. | |
PsDocument document = new PsDocument(dataDir + "input.ps"); | |
// If you want to convert Postscript file despite of minor errors set this flag | |
bool suppressErrors = true; | |
//Initialize options object with necessary parameters. | |
PdfSaveOptions options = new PdfSaveOptions(suppressErrors); | |
// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included. | |
options.AdditionalFontsFolders = new string[] { @"{FONT_FOLDER}" }; | |
// Default page size is 595x842 and it is not mandatory to set it in PdfSaveOptions | |
// But if you need to specify sizeuse following line | |
//PdfSaveOptions options = new PdfSaveOptions(suppressErrorsnew, Aspose.Page.Drawing.Size(595x842)); | |
// or | |
//saveOptions.Size = new Aspose.Page.Drawing.Size(595x842); | |
document.SaveAsPdf(dataDir + "outputPDF_out.pdf", options); | |
//Review errors | |
if (suppressErrors) | |
{ | |
foreach (Exception ex in options.Exceptions) | |
{ | |
Console.WriteLine(ex.Message); | |
} | |
} |
C# .NET aracılığıyla PostScript'ten Görüntülere Dönüştürme.
Herhangi bir EPS/PS PostScript to görüntü dönüştürücü uygulaması için aşağıdaki C# kodu iyi çalışır, bu nedenle sonraki adımları uygulayın:
- Parametre olarak girdi dosyası akışına sahip PsDocument sınıfını kullanarak belgeyi yükleyin.
- ImageSaveOptions Class nesnesini oluşturun ve gerekli ayarlarla başlatın.
- Her giriş dosyası sayfasını PNG, JPG, TIFF, BMP vb. bir resme kaydedin.
PostScript'ten Görüntülere Dönüştürme için C# Kodu
// The path to the documents directory. | |
string dataDir = "definedDirectoryPath"; | |
// Initialize PsDocument with the name of PostScript file. | |
PsDocument document = new PsDocument(dataDir + "inputForImage.ps"); | |
// If you want to convert Postscript file despite of minor errors set this flag | |
bool suppressErrors = true; | |
//Initialize options object with necessary parameters. | |
ImageSaveOptions options = new ImageSaveOptions(); | |
//Set output image format. | |
options.ImageFormat = Aspose.Page.Drawing.Imaging.ImageFormat.Png; | |
// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included. | |
options.AdditionalFontsFolders = new string[] { @"{FONT_FOLDER}" }; | |
// Save PS document as array of image bytes, one bytes array for one page. | |
byte[][] imagesBytes = document.SaveAsImage(options); | |
//Save images bytes arrays as image files. | |
int i = 0; | |
foreach (byte[] imageBytes in imagesBytes) | |
{ | |
string imagePath = Path.GetFullPath(dataDir + "out_image" + i.ToString() +"." + options.ImageFormat.ToString().ToLower()); | |
using (FileStream fs = new FileStream(imagePath, FileMode.Create, FileAccess.Write)) | |
{ | |
fs.Write(imageBytes, 0, imageBytes.Length); | |
} | |
i++; | |
} |
FAQ
1. Bu API çözümüyle Postscript’i dönüştürebilir miyim?
Aspose.Page, PS, XPS ve EPS dosyalarını çevrimiçi veya programlı olarak diğer biçimlere dönüştürmenize olanak tanıyan işlevselliğe sahiptir. Dosyalarınızı anında çevrimiçi dönüştürmeniz gerekiyorsa, platformlar arası Sayfa Açıklama Dil biçimi dosyaları Dönüştürücü uygulamasını kullanmak isteyebilirsiniz.
2. Dönüştürücü hangi Sayfa açıklama dillerini destekler?
Bu dönüştürme işlevi, .ps, .eps ve .xps uzantılı dosyaları destekler. PDF ve SVG gibi ünlü PDL’ler Aspose.products’ta ayrı çözümler olarak sunulmaktadır.
3. İşlev ücretsiz mi?
Platformlar arası dönüştürücüler ücretsizdir, API çözümü için ücretsiz Deneme sürümü alabilir ve ardından gerekirse ürünü satın alabilirsiniz.
XPS'yi C# .NET aracılığıyla JPG, PNG, BMP Görüntülerine dönüştürün.
.NET API ayrıca BMP, JPG, PNG, TIFF vb. Görüntülere XPS Dönüştürmeyi destekler ve XPS işlemleri için XpsDocument Sınıfı sağlar. XPS'yi Görüntüye dönüştürmek için aşağıdaki adımları izleyin:
- Akıştan XPS dosyasını yükleyin.
- İlgili görüntü kaydetme seçeneklerini başlatın, örneğin XPS’den JPG’ye için bu JpegSaveOptions ve XPS’den PNG’ye için PngSaveOptions . İşte tüm XPS’den Görüntüye kaydetme seçenekleri listesi.
- İşleme için SmoothingMode, Resolution ve PageNumbers vb. gibi ilgili ayarları tanımlayın. Son olarak, bunları görüntülere kaydetmek için belge bölümlerini yineleyin.
XPS'den Görüntüye Dönüştürme için C# Kodu
// The path to the documents directory. | |
string dataDir = "definedDirectoryPath"; | |
//Outut file | |
string outputFileName = dataDir + "XPStoImage_out.jpeg"; | |
// Load XPS document form the XPS file | |
XpsDocument document = new XpsDocument(dataDir + "input.xps", new XpsLoadOptions()); | |
// Initialize options object with necessary parameters. | |
JpegSaveOptions options = new JpegSaveOptions() | |
{ | |
SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality, | |
Resolution = 300, | |
PageNumbers = new int[] { 1, 2, 6 } | |
}; | |
// Save XPS document to the images byte arrays. The first dimension is for inner documents | |
/// and the second one is for pages within inner documents. | |
byte[][][] imagesBytes = document.SaveAsImage(options); | |
// Iterate through document partitions (fixed documents, in XPS terms) | |
for (int i = 0; i < imagesBytes.Length; i++) | |
{ | |
// Iterate through partition pages | |
for (int j = 0; j < imagesBytes[i].Length; j++) | |
{ | |
// Initialize image output stream | |
using (Stream imageStream = System.IO.File.Open(Path.GetDirectoryName(outputFileName) + Path.DirectorySeparatorChar + | |
Path.GetFileNameWithoutExtension(outputFileName) + "_" + (i + 1) + "_" + (j + 1) + | |
Path.GetExtension(outputFileName), System.IO.FileMode.Create, System.IO.FileAccess.Write)) | |
// Write image | |
imageStream.Write(imagesBytes[i][j], 0, imagesBytes[i][j].Length); | |
} | |
} |
Support and Learning Resources
- Öğrenme Kaynakları
- belgeler
- Kaynak kodu
- API Referansları
- Ürün desteği
- Ücretsiz Destek
- Ücretli Destek
- Blog
- Release Notes
- Neden .NET için Aspose.Page?
- Müşteri Listesi
- Başarı Öyküleri