PDFを単一ページ(または複数ページ)の画像ファイル(またはラスタライズされたPDF)を作成します。
解像度、非可逆画像圧縮の品質、使用する色空間と深度を選択して、PDF を画像に変換する方法を指定します。
FAX変換プロファイルを使用して、PDFをFAX送信に適したTIFF-FAXに変換します。
APIリファレンスはこちらです。
| 入力ファイルの規格 | 出力ファイルの規格 | PDF 1.x, PDF 2.0, PDF/A-1, PDF/A-2, PDF/A-3 | TIFF, PNG, JPEG |
|---|
画像処理
カラー管理
ページ・レイアウト
C#のサンプルプロジェクトではPdftools SDKライブラリ(DLL)をNuGetから自動でダウンロードします。
CのサンプルプロジェクトにはPdftools SDKライブラリ(DLL)が含まれています。
ライセンスキー無し(無償)で試用できます。ただし、結果に「透かし」が入ります。
「透かし」の削除をご希望の場合は問い合わせページまたはメールでお問い合わせください。
License Agreement(利用許諾契約書)が含まれていますので必ず確認してください。
PDF文書の指定されたページをラスタライズされたイメージに変換します。
この例の変換プロファイルは、PDF文書をアーカイブ用の TIFF イメージに変換します。
// 入力PDFファイルを開く
pInStream = _tfopen(szInPath, _T("rb"));
GOTO_CLEANUP_IF_NULL_PRINT_ERROR(pInStream, _T("Failed to open the input file \"%s\" for reading.\n"), szInPath);
TPdfToolsSys_StreamDescriptor inDesc;
PdfToolsSysCreateFILEStreamDescriptor(&inDesc, pInStream, 0);
pInDoc = PdfToolsPdf_Document_Open(&inDesc, _T(""));
GOTO_CLEANUP_IF_NULL_PRINT_ERROR(
pInDoc, _T("Failed to create a document from the input file \"%s\". %s (ErrorCode: 0x%08x).\n"), szInPath,
szErrorBuff, PdfTools_GetLastError());
// 書き込み用の出力ストリームを生成
pOutStream = _tfopen(szOutPath, _T("wb+"));
GOTO_CLEANUP_IF_NULL_PRINT_ERROR(pOutStream, _T("Failed to open the output file \"%s\" for writing.\n"), szOutPath);
TPdfToolsSys_StreamDescriptor outDesc;
PdfToolsSysCreateFILEStreamDescriptor(&outDesc, pOutStream, 0);
// 変換パラメータを定義するプロファイルを生成
// このArchiveプロファイルはPDF文書をアーカイブ用のTIFF画像に変換します。
pProfile = (TPdfToolsPdf2ImageProfiles_Profile*)PdfToolsPdf2ImageProfiles_Archive_New();
// オプション:変換プロセスの要件に応じてプロファイルのパラメータを変更できます。
// PDF文書を画像データに変換
pConverter = PdfToolsPdf2Image_Converter_New();
pOutDoc =
(TPdfToolsImage_Document*)PdfToolsPdf2Image_Converter_ConvertDocument(pConverter, pInDoc, &outDesc, pProfile);
GOTO_CLEANUP_IF_NULL_PRINT_ERROR(pOutDoc, _T("The processing has failed. (ErrorCode: 0x%08x).\n"),
PdfTools_GetLastError());
private static void Pdf2Image(string inPath, string outPath)
{
// 入力PDFファイルを開く
using var inStr = File.OpenRead(inPath);
using PdfTools.Pdf.Document inDoc = Document.Open(inStr);
// 変換パラメータを定義するプロファイルを生成
// このArchiveプロファイルはPDF文書をアーカイブ用のTIFF画像に変換します。
PdfTools.Pdf2Image.Profiles.Archive profile = new Profiles.Archive();
// オプション:変換プロセスの要件に応じてプロファイルのパラメータを変更できます。
// 出力ストリームを生成
using var outStr = File.Create(outPath);
// PDF文書を画像データに変換
using PdfTools.Image.MultiPageDocument outDoc = new PdfTools.Pdf2Image.Converter().ConvertDocument(inDoc, outStr, profile);
}
def pdf_to_image(input_pdf_path: str, output_image_path: str):
# 入力PDFファイルを開く
with io.FileIO(input_pdf_path, 'rb') as input_pdf_stream:
with Document.open(input_pdf_stream) as input_pdf_document:
# 変換パラメータを定義するプロファイルを生成
# このArchiveプロファイルはPDF文書をアーカイブ用のTIFF画像に変換します。
profile = Archive()
# オプション:変換プロセスの要件に応じてプロファイルのパラメータを変更できます。
# 出力ストリームを生成
with io.FileIO(output_image_path, 'wb+') as output_stream:
# PDF文書を画像データに変換
converter = Converter()
converter.convert_document(input_pdf_document, output_stream, profile)
pdf_to_image(input_pdf_path, output_image_path)
他の機能サンプルを参照してください。
質問のページからお送りいただくようお願いします。
または、メールでsupport@trustss.co.jpあてにお送りください。
ご購入前の技術的質問も無償で対応します。サポート受付ページからお願いします。