Optimize PDF Document for the Web in PHP

Aspose.PDF - Optimize PDF for Web

To optimize PDF document for the web using Aspose.PDF Java for PHP, simply invoke optimize_web method of  Optimize class.

PHP Code


 public static function optimize_web($dataDir=null)

{

    # Open a pdf document.

    $doc = new Document($dataDir . "input1.pdf");

    # Optimize for web

    $doc->optimize();

    #Save output document

    $doc->save($dataDir . "Optimized_Web.pdf");

    print "Optimized PDF for the Web, please check output file." . PHP_EOL;

}   

Download Running Code

Download Optimize PDF for Web (Aspose.PDF) from any of the below mentioned social coding sites: