1. Products
  2.   PDF
  3.   PHP
  4.   Aspose.PDF Cloud PHP SDK

Aspose.PDF Cloud PHP SDK

 
 

PDF Documents Creation & Conversion via PHP SDK

A useful PHP REST SDK Supports Creating, Editing, Rendering, Manipulating, & Converting PDF Documents to DOCX, XLSX, HTML, PCL & Many More without using Adobe Acrobat.

What is Aspose.PDF Cloud PHP SDK?

Aspose.PDF Cloud PHP SDK is a robust toolkit designed for developers who need to work with PDF files via a PHP REST API. Built on top of the powerful Aspose.PDF Cloud platform, this SDK enables users to manipulate PDF online effortlessly—whether you're looking to generate new documents, modify existing files, or convert PDFs to other formats. With this PHP REST API, developers can create PDF documents from scratch or from pre-designed templates. The SDK offers an extensive range of PDF editing features, including adding or modifying text, inserting images and tables, applying annotations and stamps, and even merging or splitting PDF files.

Aspose.PDF Cloud PHP SDK also functions as a highly flexible Convert PDF API, allowing seamless conversion of PDF files to formats such as Microsoft Word, Excel, PowerPoint, HTML, SVG, EPUB, XPS, and various image types. It supports both import and export of multiple file types, offering full compatibility with formats like PDF, XML, FDF, XFDF, and TeX. For developers who need to optimize and secure documents, this SDK includes tools for compressing images, reducing file size, cleaning up unused resources, and managing fonts. It also provides advanced security features—set passwords, restrict access permissions, and apply digital signatures—to keep your PDFs safe. In short, Aspose.PDF Cloud PHP SDK offers a complete solution to create, convert, and manipulate PDF documents online using a scalable and reliable PHP REST API.

Previous Next

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.

How to Create 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.

How to 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.

How to 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.

How to 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();
?>

 English