コード例 #1
0
$draw->Export($page, $output_path . "tiger_200x400_rot180.png", "PNG", $gray_hint);
echo nl2br("Example 4: " . $output_path . "tiger_200x400_rot180.png. Done.\n");
$draw->SetImageSize(400, 200, false);
// The third parameter sets 'preserve-aspect-ratio' to false.
$draw->SetRotate(Page::e_0);
// Disable image rotation.
$draw->Export($page, $output_path . "tiger_400x200_stretch.jpg", "JPEG");
echo nl2br("Example 4: " . $output_path . "tiger_400x200_stretch.jpg. Done.\n");
//--------------------------------------------------------------------------------
// Example 5) Zoom into a specific region of the page and rasterize the
// area at 200 DPI and as a thumbnail (i.e. a 50x50 pixel image).
$zoom_rect = new Rect(216.0, 522.0, 330.0, 600.0);
$page->SetCropBox($zoom_rect);
// Set the page crop box.
// Select the crop region to be used for drawing.
$draw->SetPageBox(Page::e_crop);
$draw->SetDPI(900);
// Set the output image resolution to 900 DPI.
$draw->Export($page, $output_path . "tiger_zoom_900dpi.png", "PNG");
echo nl2br("Example 5: " . $output_path . "tiger_zoom_900dpi.png. Done.\n");
$draw->SetImageSize(50, 50);
// Set the thumbnail to be 50x50 pixel image.
$draw->Export($page, $output_path . "tiger_zoom_50x50.png", "PNG");
echo nl2br("Example 5: " . $output_path . "tiger_zoom_50x50.png. Done.\n");
$cmyk_hint = $hint_set->CreateDict();
$cmyk_hint->PutName("ColorSpace", "CMYK");
//--------------------------------------------------------------------------------
// Example 6) Convert the first PDF page to CMYK TIFF at 92 DPI.
// A three step tutorial to convert PDF page to an image
echo nl2br("Example 6:\n");
// A) Open the PDF document.