Esempio n. 1
0
 public function indexAction()
 {
     try {
         $arrmixUrlInfo = parse_url($_REQUEST['url']);
         $client = new PdfCrowd("abhishekb", "224e0bb48a3569047a6858cca800be8c");
         $pdf = $client->convertURI($_REQUEST['url']);
         $file = RELATIVE_PATH . 'session-logs/' . time() . '_' . $arrmixUrlInfo['host'] . '.pdf';
         file_put_contents($file, $pdf);
         echo 'converted';
     } catch (PdfcrowdException $why) {
         echo "Pdfcrowd Error: " . $why;
     }
     exit;
 }
Esempio n. 2
0
 public function createPdf($webpage)
 {
     try {
         // create an API client instance
         $client = new PdfCrowd("api", "apikey");
         // convert a web page and store the generated PDF into a $pdf variable
         $pdf = $client->convertURI($webpage);
         // set HTTP response headers
         header("Content-Type: application/pdf");
         header("Cache-Control: max-age=0");
         header("Accept-Ranges: none");
         header("Content-Disposition: attachment; filename=\"google_com.pdf\"");
         // send the generated PDF
         echo $pdf;
     } catch (PdfcrowdException $why) {
         echo "Pdfcrowd Error: " . $why;
     }
 }
Esempio n. 3
0
<?php

require 'includes/classes/PdfCrowd.php';
try {
    // create an API client instance
    $client = new PdfCrowd("c3412026", "3dd233b785200757fae797c3c8ca418c");
    // convert a web page and store the generated PDF into a $pdf variable
    $pdf = $client->convertURI('http://ebay.co.uk');
    // set HTTP response headers
    header("Content-Type: application/pdf");
    header("Cache-Control: max-age=0");
    header("Accept-Ranges: none");
    header("Content-Disposition: attachment; filename=\"ebay.pdf\"");
    // send the generated PDF
    echo $pdf;
} catch (PdfcrowdException $why) {
    echo "Pdfcrowd Error: " . $why;
}