Webpage/HTML to PDF Online API

Webpage/HTML to PDF converting is easy with our RESTFull API. PDF Converting API is professional solution that facilitates you to create PDF from webpage and HTML.This API is easy to integration and it produce lightweight PDFs without compromising PDFs quality.

Installation

  1. Download PDF_CONVERTER client Library.
  2. Unpack the downloaded .zip file and copy pdf_converter.php to your source tree.

Getting Started

<?php 
  require('pdf_converter.php');

// To use the API you have to set valid USERNAME and API KEY.                
  $pdf = new PDF_Converter("USERNAME","API KEY"); 

// Set the PDf file name.   
  $pdf->setName($FILE_NAME);

  $FILE_NAME:- PDF file name

// Convert URL to PDF Using   
  $pdf->convertURI($URL_KEY,$URL_VALUE);

  $URL_KEY:- Any key for URL value .. e.g ('url',....) // useful when generating forms

  $URL_VALUE:- The actual value of URL to be converted

// Convert URL to PDF Using   
    $pdf->convertFILE($FILE_KEY,$FILE_PATH);

    $FILE_KEY:- Any key for the value .. e.g ('file_path',....) // useful when generating forms

    $FILE_PATH:- The actual path of the file to be converted ..  // accepts file URL too.
?>

Error Handling

<?php 
  try {
      /* Your Code ... */
  } catch(pdfConverterException $msg) {
      $msg->GET_MSG()
  }
?>

Functions Usage

Setting File Name

$pdf->setName($FILE_NAME);

Sets the name of PDF File (e.g ‘myPDF’)

Setting Width

$pdf->setWidth($WIDTH);

Sets PDF Width in mm unit (e.g ’30mm’)

Setting Height

$pdf->setHeight($Height);

Sets PDF Height in mm unit (e.g ’30mm’)

Setting Margins

$pdf->setMargins($margin_top,$margin_right,$margin_bottom,$margin_left);

Sets PDF Margins in mm unit (e.g ’10mm’)

Setting PDF HTML-Header

$pdf->setHTMLHeader($URL_OF_HTML);

Sets header using external HTML URL, Default value ( –no-header- )

Setting PDF HTML-Footer

$pdf->setHTMLFooter($URL_OF_HTML); //Sets footer using external HTML URL, Default value ( --no-footer- )

Setting PDF Encoding

$pdf->setEncoding($ENCODING); //Sets PDF Encoding, default value 'utf8'

PDF Images

$pdf->disableImages();

PDF Background

$pdf->disableBackground(); //Background is Enabled By Default

PDF Javascript

$pdf->disableJS(); //Disable web pages to run javascript

PDF LINKS

$pdf->disableLINKS(); //Disable links to remote web pages

PDF Print Media

$pdf->disablePrintMedia(); //Use print media-type instead of screen

8636 121st St,
Richmond Hill, NY 11418, USA

Skype: php.lead

×