PS, EPS 및 XPS 변환
.NET용 API 솔루션을 사용한 PS, EPS 및 XPS 변환.
PostScript PS 및 Encapsulated PostScript EPS 파일과 XPS 문서를 프로그래밍 방식으로 변환해야 할 때마다 .NET API는 이를 원활하게 수행하고 여러 파일을 변환할 수 있습니다. PS 및 EPS의 경우 API는 레벨 1-3 PostScript 연산자와 대부분의 EPS 헤더 주석을 지원하며, 몇 가지 글꼴 사례를 제외하고 최대한의 일치성을 유지하며 PostScript 문서를 변환합니다. 또한 API는 Times New Roman과 같은 글꼴을 처리합니다.
또한 XPS 파일 변환의 경우, API는 페이지를 추가하거나 제거할 수 있고, 캔버스, 경로 및 글리프 요소를 처리하며, 벡터 그래픽 모양 및 텍스트 문자열을 생성하고, XPS 아웃라인 항목을 변환하는 등의 작업을 수행할 수 있습니다.
여기에 있는 .NET용 API 솔루션을 사용하면 PS, EPS 및 XPS와 같은 PDL 형식의 파일을 프로그래밍 방식으로 변환할 수 있지만, 이러한 네이티브 API에서 개발된 크로스 플랫폼을 직접 보고 시도해 보는 것도 유용할 것입니다.
C# .NET을 통한 PostScript에서 PDF로 변환.
.NET API를 통해 PostScript PS 및 Encapsulated PostScript EPS 파일을 PDF로 변환하려면 다음 단계를 수행해야 합니다.
- PsDocument 클래스를 사용하여 PS 또는 EPS 파일을 로드합니다.
- PdfSaveOptions 개체를 만들고 필요한 변환 옵션을 설정합니다.
- 출력 파일 경로와 옵션 개체를 사용하여 PsDocument.SaveAsPdf() 을(를) 호출합니다.
PS EPS에서 PDF로 변환을 위한 C# 코드
// Convert PS file to PDF document.
// Learn more: https://docs.aspose.com/page/net/convert-ps/
// 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);
//If PostScript file contains some graphics written as Type3 font glyphs, but it is not actual glyphs
//the resulting PDF may be incorrect because of default value of options.ConvertFontsToTTF = true
//Try to set this
//options.ConvertFontsToTTF = false;
// Save document as PDF
document.SaveAsPdf(OutputDir + "outputPDF_out.pdf", options);
//Review errors
if (suppressErrors)
{
foreach (Exception ex in options.Exceptions)
{
Console.WriteLine(ex.Message);
}
}C# .NET을 통한 PostScript에서 이미지로 변환.
모든 EPS/PS PostScript 이미지 변환기 애플리케이션의 경우 다음 C# 코드가 잘 작동하므로 다음 단계를 수행하십시오.
- PsDocument 클래스를 사용하여 PS 또는 EPS 파일을 로드합니다.
- ImageSaveOptions
개체를 만들고
ImageFormat을 대상 형식으로 설정합니다. - 옵션 개체를 사용하여 PsDocument.SaveAsImage() 을(를) 호출합니다.
PostScript에서 이미지로 변환을 위한 C# 코드
// Convert PS file to PNG image.
// Learn more: https://docs.aspose.com/page/net/convert-ps/
//Outut file
string outputFileName = "output_image.png";
// 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 to an image.
document.SaveAsImage(options, OutputDir, Path.GetFileNameWithoutExtension(outputFileName));
//Review errors
if (suppressErrors)
{
foreach (Exception ex in options.Exceptions)
{
Console.WriteLine(ex.Message);
}
}FAQ
1. 이 API 솔루션으로 Postscript를 변환할 수 있습니까?
Aspose.Page에는 온라인 또는 프로그래밍 방식으로 PS, XPS 및 EPS 파일을 다른 형식으로 변환할 수 있는 기능이 있습니다. 파일을 온라인에서 즉시 변환해야 하는 경우 페이지 설명 언어 형식 파일 변환기 크로스 플랫폼 응용 프로그램을 사용하는 것이 좋습니다.
2. 변환기에서 지원하는 페이지 설명 언어는 무엇입니까?
이 변환 기능은 확장자가 .ps, .eps 및 .xps인 파일을 지원합니다. PDF 및 SVG와 같은 유명한 PDL은 Aspose.products에서 별도의 솔루션으로 표시됩니다.
3. 기능은 무료인가요?
크로스 플랫폼 변환기 는 무료입니다. API 솔루션의 경우 무료 평가판을 받은 다음 필요한 경우 제품을 구매할 수 있습니다.
C# .NET을 통해 XPS를 JPG, PNG, BMP 이미지로 변환.
.NET API는 XPS에서 BMP, JPG, PNG, TIFF 등의 이미지로의 변환도 지원하며 XPS 작업을 위한 XpsDocument 클래스를 제공합니다. XPS를 이미지로 변환하려면 다음 단계를 수행하십시오.
- XpsDocument 클래스를 사용하여 XPS 파일을 로드합니다.
- 대상 형식에 맞는 저장 옵션 클래스( PngSaveOptions , JpegSaveOptions , BmpSaveOptions 또는 TiffSaveOptions )를 만듭니다.
SmoothingMode,Resolution,PageNumbers같은 렌더링 옵션을 설정한 다음 옵션 개체를 사용하여 *XpsDocument.SaveAsImage()*을(를) 호출합니다.
XPS에서 이미지로 변환을 위한 C# 코드
// Convert XPS file to PNG image.
// Learn more: https://docs.aspose.com/page/net/convert-xps/
//Outut file
string outputFileName = "XPStoPNG_out.png";
// Load XPS document form the XPS file
XpsDocument document = new XpsDocument(DataDir + "input.xps", new XpsLoadOptions());
// Initialize options object with necessary parameters.
PngSaveOptions options = new PngSaveOptions()
{
SmoothingMode = SmoothingMode.HighQuality,
Resolution = 300,
PageNumbers = new int[] { 1, 2, 6 }
};
// Save XPS document to the PNG image files.
document.SaveAsImage(options, OutputDir, outputFileName);