PDF API for PHP

Create, edit, protect and convert PDF documents to multiple formats within PHP via Java applications.

Overview

Aspose.PDF for PHP via Java is a native library that enables the developers to add PDF processing capabilities to their applications. API can be used to build any type of 32-bit and 64-bit applications to generate or read, convert and manipulate PDF files without the use of Adobe Acrobat.

Aspose.PDF for PHP via Java API allows to perform a range of document processing tasks such as form processing, get and set metadata information, text and page manipulation, management of annotations, add or remove bookmarks and watermarks, attachments, custom font handling and much more.

Advanced Aspose.PDF for PHP Library Features

Manipulate PDF Files On the Fly

Aspose.PDF for PHP via Java is a good choice for modifying or manipulating existing PDF files within your applications. This library allows you to open or load PDF file, extract pages, insert pages at a particular location in the file or create N-up’s (number of pages over single page) and booklets. You may also use the API to add, update and delete images, attachments, bookmarks, annotations, hyperlinks, watermarks and form fields from an existing PDF.

Split and Merge PDF Files

Aspose.PDF for PHP via Java via its API, allows splitting one PDF file into two or more PDF documents. You may also use it to concatenate two or more files in a single document or append PDF pages as per application requirements.

Convert PDF to HTML, DOCX and ODS Formats

Aspose.PDF for PHP via Java allows you to render and transform each page of a PDF file into conventional image formats such as BMP, JPG and PNG, with the highest possible fidelity. Other than images, one can easily save PDF to DOC and DOCX formats.

Save PDF pages in JPG format - PHP

load an existing PDF document. convert PDF pages to images save each page in JPG format

Convert PDF to JPG on PHP

// Open the target document
$document = new Document($inputFile);
$pages = $document->getPages();
$count = java_values($pages->size());

// Create a Resolution object with a resolution of 300 dpi
$resolution = new devices_Resolution(300);

// Create a JpegDevice object with the specified resolution
$imageDevice = new devices_JpegDevice($resolution);

// Loop through each page of the document
for ($pageCount = 1; $pageCount <= $count; $pageCount++) {
    // Convert a particular page and save the image to a file
    $imageFileName = $imageFileNameTemplate . $pageCount . '.jpg';
    $page = $document->getPages()->get_Item($pageCount);
    $imageDevice->process($page, $imageFileName);

    // Append a success message to the response data
    $responseData = "Document has been converted successfully. Filesize: " . filesize($imageFileName);
}

Form Field Processing

Aspose.PDF for PHP via Java offers the capabilities to add form fields to the PDF document, that is; you can dynamically generate form fields in PDF documents. Just order the position of the form fields as per a table or by custom positioning, and the form fields will be placed in the exact position every time.

Format PDF Contents on Most Granular Level

Aspose.PDF for PHP via Java allows to apply horizontal text alignment like place content in right-to-left, preserve white space in the text, create left hanging text paragraphs and set custom tab stops.

Along with horizontal alignment of the text, one can also adjust the vertical alignment for text segments such as baseline or topline as well as more formatting features like setting text foreground and background colors.