Aspose.PDF Cloud PHP SDK
PHP SDK to Create, Edit & Convert PDF Documents
A powerful PHP REST SDK supports generating, editing, rendering, manipulating, & converting PDF documents without using Adobe Acrobat.
Aspose.PDF Cloud PHP SDK is a comprehensive and powerful software development kit for PHP developers who want to work with PDF documents in the cloud. It is built on top of Aspose.PDF REST API and allowing users to process PDF documents in PHP language quickly and easily in the cloud. Aspose.PDF Cloud is a very useful REST API that enables software developers to perform a wide range of PDF document processing operations including creation, manipulation, conversion and rendering of PDF documents in the cloud.
Aspose.PDF Cloud PHP SDK allows software developers to create new PDF documents from scratch or from templates. It has included support for several important features for PDF documents manipulation, such as adding text to PDFs, inserting images and tables, adding annotations to PDF files, adding comments and stamps, PDF conversion to Microsoft Office file formats, convert PDF to images formats, merge multiple PDF files into a single document, split a PDF document into multiple files and many more. The library fully supports reading and writing numerous file formats, such as PDF, EPUB, HTML, TeX, SVG, XML, XPS, FDF, XFDF and so on.
Aspose.PDF Cloud PHP SDK has included a set of optimization tools that can reduce the size of PDF files by compressing images, removing unused objects, and optimizing fonts. Moreover developers can easily secure PDF documents by setting passwords, restricting printing, copying, and modifying permissions, and adding digital signatures. Overall, Aspose.PDF Cloud PHP SDK is the best choice, allowing PHP developers to work with PDF documents in the cloud.
Getting Started with Aspose.PDF Cloud PHP SDK
The recommend way to install Aspose.PDF Cloud PHP SDK is using Composer. Please use the following command for a smooth installation.
Install Aspose.PDF Cloud PHP SDK via Composer
composer require aspose/pdf-sdk-php
You can also download it directly from Aspose PDF product page.
PDF Files Creation via PHP REST API
Aspose.PDF Cloud PHP SDK gives software developers the capability to create and manage PDF files inside their own cloud applications. The library has included numerous features for working with PDF files such as insert text to PDFs, add images, insert PDF forms, add PDF annotations, insert new pages, add attachments & bookmarks, control the layout and formatting of the content and many more. The following examples demonstrates how to creates a new PDF file with one page, adds the text "Hello, world!" to the page, and saves the file as a TIFF image.
Creates a New PDF File with One Page via PHP API
$tiff_resolution = 72;
$tiff_image_width = 800;
$tiff_image_height = 1000;
$tiff_first_page = 1;
$tiff_last_page = 1;
$tiff_result_file = 'result.tiff';
$response = $api->putSaveDocumentAsTiff($pdf_id, $tiff_resolution, $tiff_image_width, $tiff_image_height, $tiff_first_page, $tiff_last_page, $tiff_result_file);
Convert PDF to Other Formats via PHP API
Aspose.PDF Cloud PHP SDK lets software convert PDF documents to and from various other popular file formats inside their own PHP applications. The SDK supports read and write various popular file formats such as PDF, EPUB, HTML, TeX, SVG, XML, XPS, FDF, XFDF, and so on. The library also supports converting EPUB, HTML, LaTeX, MHT, PCL, DOC, MOBIXML, PDFA, PPTX, SVG, TIFF, XLS, XLSX, XML, XPS, PS, XSLFo, PCL, BMP, EMF, GIF, JPEG, PNG, and TIFF, to PDF with ease. It also allows developers to control how a PDF document is converted into a Word processing document.
Convert PDF document to DOC format via PHP REST API
setAppKey('your_app_key');
$config->setAppSid('your_app_sid');
// create an instance of the API client
$pdfApi = new PdfApi(null, $config);
// set the input file name and path
$fileName = "input.pdf";
$filePath = "/path/to/input.pdf";
// set the output file name and path
$outName = "output.doc";
$outPath = "/path/to/output.doc";
// call the API to convert the PDF to DOC format
$response = $pdfApi->putPdfInRequestToDoc($outName, $filePath, null, null, null, null, null, null, null, null, null, null);
// save the output file to the specified path
file_put_contents($outPath, $response);
echo "PDF document converted to DOC format successfully!";
?>
Image Handling in PDF Files via PHP REST API
Aspose.PDF Cloud PHP SDK REST API enables software developers to handle images inside their PDF documents without using Adobe Acrobat or other third-party software. The library has provided various useful features for handling PDF images, such as inserting images to a particular PDF page, reading all document images, replace Image in a PDF document, image information reading from PDFs, adding a new Images, extract a particular image from PDF, export PDF images to other file formats and many more.
Replace Image in a PDF Document via PHP API
pdfApi = new PdfApi();
}
public function postReplaceImage() {
// Upload file to Aspose Cloud Storage
$fileName = "SampleImage.pdf";
Utils::uploadFile($fileName);
$file = realpath(__DIR__ . '/../../..') . '/Data/aspose-cloud.png';
$result = $this->pdfApi->PostReplaceImage($fileName, $pageNumber = 1, $imageNumber = 1, $imageFile = "", $storage = "", $folder = "", $file);
print_r ( $result );
}
}
$images = new Images();
$images->postReplaceImage();
?>
Pages Handling in PDFs via PHP REST APIs
AAspose.PDF Cloud PHP SDK REST API has provided very useful features for handling pages inside PDF documents. The library allows software developers to add new pages to PDF file, convert PDF document pages to supported image file formats, move PDF pages to a new location inside PDF file, retrieve information about PDF page numbers, delete unwanted pages from PDF file, get PDF word count and so on.
Add a New Page in PDF via PHP REST API
pdfApi = new PdfApi();
}
public function putAddNewPage() {
// Upload file to Aspose Cloud Storage
$fileName = "sample-input.pdf";
Utils::uploadFile($fileName);
$result = $this->pdfApi->PutAddNewPage($fileName, $storage = "", $folder = "");
print_r ( $result );
}
}
$pages = new Pages();
$pages->putAddNewPage();
?>