PHP Classes

SelectPdf PHP HTML to PDF REST API: Convert HTML to PDF using the SelectPdf API

Recommend this page to a friend!
  Info   View files Documentation   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 345 All time: 7,039 This week: 673Up
Version License PHP version Categories
selectpdf-api 1.0.1Proprietary License5Text processing, Libraries, Content m...
Description 

Author

This class can convert HTML to PDF using the SelectPdf API.

It can take the URL of a given HTML page and sends it to the SelectPdf API Web server to convert the page contents to a PDF document.

The class can also send raw HTML code for converting it into a PDF document.

It features:

- Full html5/css3/javascript support.
- Set PDF options such as page size and orientation, margins, security, web page settings.
- Set PDF viewer options and PDF document information.
- Create custom headers and footers for the pdf document.
- Hide web page elements during the conversion.
- Automatically generate bookmarks during the html to pdf conversion.
- Support for partial page conversion.

Picture of Select Pdf
Name: Select Pdf <contact>
Classes: 2 packages by
Country: United States United States
Age: ???
All time rank: 3596475 in United States United States
Week rank: 311 Up38 in United States United States Up

Documentation

HTML To PDF API

SelectPdf HTML To PDF Online REST API is a professional solution that lets you create PDF from web pages and raw HTML code in your applications. The API is easy to use and the integration takes only a few lines of code.

Features

  • Create PDF from any web page or html string.
  • Full html5/css3/javascript support.
  • Set PDF options such as page size and orientation, margins, security, web page settings.
  • Set PDF viewer options and PDF document information.
  • Create custom headers and footers for the pdf document.
  • Hide web page elements during the conversion.
  • Automatically generate bookmarks during the html to pdf conversion.
  • Support for partial page conversion.
  • Easy integration, no third party libraries needed.
  • Works in all programming languages.
  • No installation required.

Sign up for for free to get instant API access to SelectPdf HTML to PDF API.

PHP Client Library

This code converts a web page and sends the generated PDF as an HTTP response:

<?php
require 'selectpdf.php';

try
{   
    // create a SelectPdf API client instance
    $client = new SelectPdf("Your API key here");

    /*
    // get the number of conversions available in the current month
    $conv = $client->availableConversions();
    echo("Available conversions: $conv");
    exit();
    */

    /*
    // get service usage details
    $usage = $client->usageDetails(true);
    echo("<pre>");
    var_dump($usage);
    echo("</pre>");
    exit();
    */

    // set some conversion parameters
    $client->setPageSize("A4");
    $client->setPageOrientation("Portrait");
    $client->setAllMargins(10);

    // convert a web page and store the generated PDF into a $pdf variable
    $pdf = $client->convertUrl('https://selectpdf.com/');
    //$pdf = $client->convertHtmlString('<b>Hello!</b>');

    // set HTTP response headers
    header("Content-Type: application/pdf");
    header("Cache-Control: max-age=0");
    header("Content-Disposition: attachment; filename=\"Document.pdf\"");

    // send the generated PDF 
    echo $pdf;
}
catch(SelectPdfException $ex)
{
    echo "SelectPdf API Error: " . $ex;
}
?>

  Files folder image Files  
File Role Description
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Plain text file selectpdf.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:345
This week:0
All time:7,039
This week:673Up