1. Products
  2.   Spreadsheet
  3.   PHP
  4.   Gotenberg PHP client
 
  

Open Source PHP Library for Converting Microsoft® Spreadsheet Files

Convert Microsoft Spreadsheet Documents to PDF via Free PHP API 

What is Gotenberg PHP Client?

Document conversion is a handy feature to include in your application. If you are working with Microsoft Excel file format, you might need to convert them to PDF programmatically. There is a bunch of open-source and free APIs available in the market to help you achieve that goal. Gotenberg PHP Client is one of them. The API helps you convert XLS, XLSX, and ODS file format to PDF easily inside your PHP applications.

By using the API, you can merge one or more Microsoft Excel file and convert them to a single PDF. It's pretty simple to merge two documents, you can select one or more files and the API will merge them and return the resulting PDF file.

Previous Next

Getting Started with Gotenberg PHP client

The recommended way Gotenberg PHP Client into your project is by using composer. Please use the following command for a smooth installation.

Install Gotenberg PHP Client via Composer

$ composer require thecodingmachine/gotenberg-php-client
                            

Merge Two Excel to PDF via Free PHP API

The Open source library Gotenberg PHP client allows computer programmers to merge Microsoft Excel documents into PDF inside their own PHP applications. In order to merge and convert your XLSX to PDF, you just need to load your documents and convert them using OfficeRequest() method. The following code snippet shows how to convert merge and convert XLSX to PDF in PHP.

Free API to Convert Excel to PDF in PHP

  1. Load two XLSX files using NewDocumentFromPath() method and pass filename and file path as parameters
  2. Convert and merge XlSX to PDF using OfficeRequest() method and pass files objects as parameter
  3. Save PDF document

Merge XLSX to PDF via Free PHP API

$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
$files = [
    DocumentFactory::makeFromPath('document.xlsx', '/path/to/file'),
    DocumentFactory::makeFromPath('document2.xlsx', '/path/to/file'),
];
$request = new OfficeRequest($files);
$dest = 'fileformat.pdf';
$client->store($request, $dest);
                            
 English