Javaを介してPCLをDICOMに変換する

Adobe ® Acrobat Readerを使用せずに、Java J2SE、J2EE、J2MEアプリケーション内の任意の場所でPCLファイルをDICOMにエクスポートします。

 

2つの簡単なステップでpclファイルをJavaでDICOM画像に変換できます。まず、 Aspose.PDF for Java を使用すると、PCLをJPEGにエクスポートできます。その後、 Aspose.Imaging for Java Image Processing APIを使用して、JPEGをDICOMにレンダリングできます。どちらのAPIも、 Aspose.Total for Java パッケージに含まれています。

Java経由でPCLをDICOMにエクスポート

  1. ドキュメント クラスを使用してPCLファイルを開きます
  2. JpegDeviceクラスオブジェクトを初期化し、 Process を使用してPCLをJPEGにレンダリングします。 aspose.pdf.Page-java.io.OutputStream-)メソッド
  3. Image クラスを使用してJPEGファイルをロードします
  4. save 方法

変換要件

Maven ベースのプロジェクトから直接Aspose.Total for Javaを簡単に使用できますそして、pom.xmlにライブラリを含めます。

または、 ダウンロード からZIPファイルを取得することもできます。

// supports PDF, CGM, EPUB, TeX, PCL, PS, XPS, MD, MHTML, XSLFO, HTML file formats
// load PDF with an instance of Document
Document document = new Document("input.pdf");
// create an object of JpegDevice
JpegDevice renderer = new JpegDevice();
// convert first of a particular PDF page to JPEG format
renderer.process(document.getPages().get_Item(1), "output.jpeg");
// load JPEG file
Image image = Image.Load("output.jpeg");
// supports Dicom, Jpeg2000, Apng, Psd, Dxf, Wmf, Emz, Wmz, Tga, Svgz file formats
// save JPEG to PSD file format
image.save("output.psd", new PsdOptions());

Javaを介して単一ファイルでPCLをDICOMに変換する

APIを使用すると、PCLファイルをDICOMの単一ファイルにエクスポートすることもできます。すべてのページを変換するには、最初にPCLドキュメントを1つのTIFFファイルにレンダリングし、その後、TIFFファイルをDICOMにエクスポートできます。 Document クラスを使用して入力ファイルを開き、Resolution、TiffSettings、およびTIFFデバイスオブジェクトを作成できます。 process を使用して単一のTIFF画像を取得できますjava.io.OutputStream TiffDevice クラスのメソッド。最後に、 Image クラスを使用してTIFFファイルをロードし、 save メソッド。

// supports PDF, CGM, EPUB, TeX, PCL, PS, XPS, MD, MHTML, XSLFO, HTML file formats
// load PDF with an instance of Document
Document pdfDocument = new Document("input.pdf");
// Create Resolution object
Resolution resolution = new Resolution(300);
// Create TiffSettings object
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.setCompression(CompressionType.None);
tiffSettings.setDepth(ColorDepth.Default);
tiffSettings.setShape(ShapeType.Landscape);
// Create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
// Convert a particular page and save the image to stream
tiffDevice.process(pdfDocument, 1, 1, "output.tif");
// load TIFF file
Image image = Image.Load("output.tif");
// supports Dicom, Jpeg2000, Apng, Psd, Dxf, Wmf, Emz, Wmz, Tga, Svgz file formats
// save TIFF to PSD file format
image.save("output.psd", new PsdOptions());

Javaを介して透かし付きのPCLをDICOMに変換する

APIを使用して、DICOMドキュメントに透かしを入れたPCLファイルをDICOMにエクスポートすることもできます。透かしを追加するには、最初にPCLをJPEGに変換し、透かしを追加します。透かしを追加するには、 Image クラスを使用して画像ファイルを読み込み、 Graphics クラスをImageオブジェクトで初期化し、新しい[Matrix]( https://reference.aspose.com/imaging/java/ com.aspose.imaging/Matrix)オブジェクトを作成し、変換と変換を目的の角度に設定し、 Graphics.drawString メソッド。画像に透かしを追加した後、JPEGをDICOM形式で保存できます。

// supports PDF, CGM, EPUB, TeX, PCL, PS, XPS, MD, MHTML, XSLFO, HTML file formats
// load PDF with an instance of Document
Document document = new Document("input.pdf");
// create an object of JpegDevice
JpegDevice renderer = new JpegDevice();
// convert first of a particular PDF page to JPEG format
renderer.process(document.getPages().get_Item(1), "output.jpeg");
// load JPEG
Image image = Image.load("output.jpeg");
// create and initialize an instance of Graphics class
Graphics graphics= new Graphics(image);
// create an instance of Font
Font font = new Font("Times New Roman", 16, FontStyle.Bold);
// create an instance of SolidBrush and set its properties
SolidBrush brush = new SolidBrush();
brush.setColor(Color.getBlack());
brush.setOpacity(100);
Size sz = graphics.getImage().getSize();
// create an object of Matrix class for transformation
Matrix matrix = new Matrix();
// first a translation then a rotation
matrix.translate(sz.getWidth() / 2, sz.getHeight() / 2);
matrix.rotate(-45.0f);
// set the Transformation through Matrix
graphics.setTransform(matrix);
// draw a string using the SolidBrush and Font objects at specific point
graphics.drawString("Watermark by Aspose.Imaging for Java", font, brush, 0, 0);
// supports Dicom, Jpeg2000, Apng, Psd, Dxf, Wmf, Emz, Wmz, Tga, Svgz file formats
// save JPEG to PSD file format
image.save("output.psd", new PsdOptions());

Javaを介してPCLをDICOMファイルに変換および回転

APIを使用すると、必要に応じて出力DICOM画像を回転させることもできます。 Image.rotateFlipメソッドを使用すると、画像を90/180/270度回転し、画像を水平または垂直に反転できます。ライブラリは、すべての醜い詳細をカプセル化しながら、複雑な操作を実行するための簡単なメソッドを提供します。画像に適用する回転と反転のタイプを指定できます。画像を回転および反転するには、 Image クラスを使用して変換されたJPEG画像をロードし、Imageを呼び出すことができます。適切な RotateFlipType を指定しながらrotateFlipメソッド。

// supports PDF, CGM, EPUB, TeX, PCL, PS, XPS, MD, MHTML, XSLFO, HTML file formats
// load PDF with an instance of Document
Document document = new Document("input.pdf");
// create an object of JpegDevice
JpegDevice renderer = new JpegDevice();
// convert first of a particular PDF page to JPEG format
renderer.process(document.getPages().get_Item(1), "output.jpeg");
// load JPEG file
Image image = Image.Load("output.jpeg");
// roate image
image.RotateFlip(RotateFlipType.Rotate270FlipNone);
// supports Dicom, Jpeg2000, Apng, Psd, Dxf, Wmf, Emz, Wmz, Tga, Svgz file formats
// save JPEG to PSD file format
image.save("output.psd", new PsdOptions());

PCL の変換オプションを Java で探索

PCL を APNG に変換 (アニメーション化されたポータブル ネットワーク グラフィックス)
PCL を DXF に変換 (Autodesk 図面交換フォーマット)
PCL を EMZ に変換 (Windows 圧縮拡張メタファイル)
PCL を IMAGE に変換 (画像ファイル)
PCL を JPEG2000 に変換 (J2K画像フォーマット)
PCL を PSD に変換 (Photoshop ドキュメント)
PCL を SVGZ に変換 (圧縮されたスケーラブルなベクター グラフィックス)
PCL を TGA に変換 (Truevision グラフィックス アダプター)
PCL を WMF に変換 (Windows メタファイル)
PCL を WMZ に変換 (圧縮された Windows メタファイル)
PCL を CSV に変換 (カンマ区切りの値)
PCL を DIF に変換 (データ交換フォーマット)
PCL を EXCEL に変換 (スプレッドシートのファイル形式)
PCL を FODS に変換 (OpenDocument フラット XML スプレッドシート)
PCL を MD に変換 (マークダウン言語)
PCL を ODS に変換 (OpenDocument スプレッドシート)
PCL を SXC に変換 (StarOffice Calc スプレッドシート)
PCL を TSV に変換 (タブ区切りの値)
PCL を TXT に変換 (テキストドキュメント)
PCL を XLAM に変換 (Excel マクロ有効アドイン)
PCL を XLSB に変換 (Excel バイナリ ワークブック)
PCL を XLSM に変換 (マクロが有効なスプレッドシート)
PCL を XLTM に変換 (Excel マクロ有効テンプレート)
PCL を XLTX に変換 (Excel テンプレート)
PCL を XLT に変換 (Excel 97 - 2003 テンプレート)
PCL を DOCM に変換 (Microsoft Word 2007 マルコ ファイル)
PCL を DOT に変換 (Microsoft Wordテンプレートファイル)
PCL を DOTM に変換 (Microsoft Word 2007+ テンプレート ファイル)
PCL を DOTX に変換 (Microsoft Wordテンプレートファイル)
PCL を FLATOPC に変換 (Microsoft Word 2003 ワードプロセッサML)
PCL を GIF に変換 (グラフィカル交換フォーマット)
PCL を MARKDOWN に変換 (軽量マークアップ言語)
PCL を ODP に変換 (OpenDocument プレゼンテーション形式)
PCL を ODT に変換 (OpenDocument テキスト ファイル形式)
PCL を OTP に変換 (OpenDocument標準フォーマット)
PCL を OTT に変換 (OpenDocument テンプレート)
PCL を POT に変換 (Microsoft PowerPoint テンプレート ファイル)
PCL を POTM に変換 (Microsoft PowerPoint テンプレート ファイル)
PCL を POTX に変換 (Microsoft PowerPoint テンプレートのプレゼンテーション)