PHP での PDF ファイルからの特定ページの取得

Aspose.PDF - ページ取得

Aspose.PDF Java for Ruby を使用して PDF ドキュメントの特定のページを取得するには、GetPage クラスを呼び出してください。

Ruby コード


# Open the target document
$pdf = new Document($dataDir . 'input1.pdf');

# get the page at particular index of Page Collection
$pdf_page = $pdf->getPages()->get_Item(1);

# create a new Document object
$new_document = new Document();

# add page to pages collection of new document object
$new_document->getPages()->add($pdf_page);

# save the newly generated PDF file
$new_document->save($dataDir . "output.pdf");

print "Process completed successfully!";

実行コードのダウンロード

Get Page (Aspose.PDF) を以下のいずれかのソーシャルコーディングサイトからダウンロードしてください。