} echo nl2br("Done.\n"); // Examples 3-5 // Common code for remaining samples. $tiger_doc = new PDFDoc($input_path . "tiger.pdf"); // Initialize the security handler, in case the PDF is encrypted. $tiger_doc->InitSecurityHandler(); $page = $tiger_doc->GetPage(1); //-------------------------------------------------------------------------------- // Example 3) Convert the first page to raw bitmap. Also, rotate the // page 90 degrees and save the result as RAW. $draw->SetDPI(100); // Set the output resolution is to 100 DPI. $draw->SetRotate(Page::e_90); // Rotate all pages 90 degrees clockwise. $bmp = $draw->GetBitmap($page, PDFDraw::e_rgb); // Save the raw RGB data to disk. file_put_contents($output_path . "tiger_100dpi_rot90.raw", $bmp->GetBuffer()); echo nl2br("Example 3: " . $output_path . "tiger_100dpi_rot90.raw. Done.\n"); $draw->SetRotate(Page::e_0); // Disable image rotation for remaining samples. //-------------------------------------------------------------------------------- // Example 4) Convert PDF page to a fixed image size. Also illustrates some // other features in PDFDraw class such as rotation, image stretching, exporting // to grayscale, or monochrome. // Initialize render 'gray_hint' parameter, that is used to control the // rendering process. In this case we tell the rasterizer to export the image as // 1 Bit Per Component (BPC) image. $mono_hint = $hint_set->CreateDict(); $mono_hint->PutNumber("BPC", 1); // SetImageSize can be used instead of SetDPI() to adjust page scaling