PS에서 JPEG로

Java용 API 솔루션을 통해 PS를 JPEG로 변환합니다.

 

Aspose.Page for PS to JPEG 변환기는 Java에서 지원하는 모든 언어를 사용하여 PS 파일을 JPEG 이미지로 변환합니다.

여기에서 볼 수 있는 API를 사용하여 자체 플랫폼 간 애플리케이션을 만들거나 Java 프로젝트에 통합할 수 있습니다.

XPS를 JPEG로 변환하려면 다음을 사용합니다.

  • 기능이 풍부하고 강력하며 사용하기 쉬운 Java 플랫폼용 문서 조작 및 변환 API인 Aspose.Page for Java API입니다. Maven에서 직접 최신 버전을 다운로드하고 pom.xml에 다음 구성을 추가하여 Maven 기반 프로젝트에 설치할 수 있습니다.

  • NuGet 패키지 관리자를 열고 Aspose.Page를 검색하여 설치합니다. 패키지 관리자 콘솔에서 다음 명령을 사용할 수도 있습니다.

Repository


    <repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
    </repository>

Dependency

    <dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-page</artifactId>
    <version>version of aspose-page API</version>
    <classifier>jdk17</classifier>
    </dependency>

Java를 통해 PS를 JPEG로 변환하는 단계

Aspose.Page를 사용하면 개발자가 몇 줄의 코드로 PS 파일을 쉽게 로드하고 JPEG로 변환할 수 있습니다.

  1. 원본 파일을 PsDocument 인스턴스로 로드합니다.
  2. 대상 이미지 형식에 맞는 ImageSaveOptions 인스턴스를 만듭니다.
  3. 옵션 개체, 출력 폴더, 파일 이름을 사용하여 psDocument.saveAsImage()을(를) 호출합니다.

시스템 요구 사항

Aspose.Page for Java는 모든 주요 운영 체제에서 지원됩니다. 그러나 작업을 시작하기 전에 다음 전제 조건이 있는지 확인하십시오.

  • Microsoft Windows 또는 JSP/JSF 응용 프로그램 및 데스크탑 응용 프로그램용 Java Runtime Environment와 호환되는 OS.
  • Microsoft Visual Studio와 같은 개발 환경.
  • Maven에서 직접 Java용 Aspose.PSD의 최신 버전을 받으십시오.
이 샘플 코드는 PS에서 JPEG Java로의 변환을 보여줍니다.
// Convert PS file to JPEG image.
// Learn more: https://docs.aspose.com/page/java/convert-ps/

//Outut file 
String outputFileName = "output_image.jpg";

// Initialize PsDocument with the name of PostScript file.
PsDocument document = new PsDocument(getDataDir() + "inputForImage.ps");

// If you want to convert Postscript file despite of minor errors set this flag
boolean suppressErrors = true;

//Initialize options object with necessary parameters.
ImageSaveOptions options = new ImageSaveOptions();

//Set output image format.
options.setImageFormat(ImageFormat.JPEG);

// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included.
options.setAdditionalFontsFolders(new String[] { "{FONT_FOLDER}" });

// Save PS document to an image.
document.saveAsImage(options, getOutputDir(), getFileNameWithoutExtension(outputFileName));

//Review errors
if (suppressErrors) {
    for (Exception ex : options.getExceptions()) {
        System.out.println(ex.getMessage());
    }
}

PS What is PS File Format

PS (PostScript) は、テキストとグラフィックを 1 ファイルに統合するページ記述言語です。多くの画像編集・印刷ソフトでサポートされ、プリンタ向けの描画指示を含みます。

JPEG What is JPEG File Format

JPEG は、写真向けの有損圧縮形式で、画質とファイルサイズのバランスが取れています。高圧縮時に画質が低下します。