Example #1
0
 public static function create_thumbnail_in_notes_slides_view($dataDir = null)
 {
     # Instantiate Presentation class that represents the presentation file
     $pres = new Presentation($dataDir . 'demo.pptx');
     # Access the first slide
     $slide = $pres->getSlides()->get_Item(0);
     # User defined dimension
     $desired_x = 1200;
     $desired_y = 800;
     # Getting scaled value  of X and Y
     $scale_x = 1.0 / java_values($pres->getSlideSize()->getSize()->getWidth()) * $desired_x;
     $scale_y = 1.0 / java_values($pres->getSlideSize()->getSize()->getHeight()) * $desired_y;
     # Create a full scale image
     $image = $slide->getNotesSlide()->getThumbnail($scale_x, $scale_y);
     # Save the image to disk in JPEG format
     $imageIO = new ImageIO();
     $imageIO->write($image, "jpeg", new File($dataDir . "ContentBG_tnail.jpg"));
     print "Created thumbnail in notes slides view, please check the output file." . PHP_EOL;
 }
 public static function set_page_size_for_pdf($dataDir = null)
 {
     # Instantiate Presentation class that represents the presentation file
     $pres = new Presentation();
     # Set SlideSize.Type Property
     $slideSizeType = new SlideSizeType();
     $pres->getSlideSize()->setType($slideSizeType->A4Paper);
     # Set different properties of PDF Options
     $opts = new PdfOptions();
     $opts->setSufficientResolution(600);
     # Saving the presentation
     $save_format = new SaveFormat();
     $pres->save($dataDir . "Export.pdf", $save_format->Pdf, $opts);
     print "Set page size for pdf, please check the output file." . PHP_EOL;
 }