All Projects → thecodingmachine → Gotenberg Php Client

thecodingmachine / Gotenberg Php Client

Licence: mit
PHP client for the Gotenberg API

Projects that are alternatives of or similar to Gotenberg Php Client

Gotenberg Go Client
Go client for the Gotenberg API
Stars: ✭ 35 (-56.25%)
Mutual labels:  api, excel, powerpoint, markdown, word, pdf, pdf-converter
Gotenberg
A Docker-powered stateless API for PDF files.
Stars: ✭ 3,272 (+3990%)
Mutual labels:  api, markdown, pdf, excel, word
Office365FiddlerExtension
This Fiddler Extension is an Office 365 centric parser to efficiently troubleshoot Office 365 client application connectivity and functionality.
Stars: ✭ 23 (-71.25%)
Mutual labels:  excel, word, powerpoint
OfficeExtractor
Extracts embedded OLE objects from Word, Excel, PowerPoint, Open Office and RTF files without needing the original programs
Stars: ✭ 67 (-16.25%)
Mutual labels:  excel, word, powerpoint
Superfileview
基于腾讯浏览服务Tbs,使用X5Webkit内核,实现文件的展示功能,支持多种文件格式
Stars: ✭ 1,115 (+1293.75%)
Mutual labels:  excel, word, pdf
Office Ribbonx Editor
An overhauled fork of the original Custom UI Editor for Microsoft Office, built with WPF
Stars: ✭ 205 (+156.25%)
Mutual labels:  excel, powerpoint, word
Androiddocumentviewer
Android 文档查看: word、excel、ppt、pdf,使用mupdf及tbs
Stars: ✭ 235 (+193.75%)
Mutual labels:  excel, word, pdf
Rage
Rage allows you to execute any file in a Microsoft Office document.
Stars: ✭ 68 (-15%)
Mutual labels:  excel, word, powerpoint
Remarks
Extract highlights, scribbles, and annotations from PDFs marked with the reMarkable tablet. Export to Markdown, PDF, PNG, and SVG
Stars: ✭ 94 (+17.5%)
Mutual labels:  markdown, pdf, pdf-converter
rgpipe
lesspipe for ripgrep for common new filetypes using few dependencies
Stars: ✭ 21 (-73.75%)
Mutual labels:  excel, word, powerpoint
craXcel-cli
Command line application to unlock Microsoft Office password protected files.
Stars: ✭ 44 (-45%)
Mutual labels:  excel, word, powerpoint
Unioffice
Pure go library for creating and processing Office Word (.docx), Excel (.xlsx) and Powerpoint (.pptx) documents
Stars: ✭ 3,111 (+3788.75%)
Mutual labels:  excel, powerpoint, word
Docxtemplater
Generate docx pptx and xlsx (Microsoft Word, Powerpoint, Excel documents) from templates, from Node.js, the Browser and the command line / Demo: https://www.docxtemplater.com/demo
Stars: ✭ 1,990 (+2387.5%)
Mutual labels:  excel, powerpoint, word
Vbasync
Cross-platform tool to synchronize macros from an Office VBA-enabled file with a version-controlled folder
Stars: ✭ 98 (+22.5%)
Mutual labels:  excel, powerpoint, word
Pandiff
Prose diffs for any document format supported by Pandoc
Stars: ✭ 110 (+37.5%)
Mutual labels:  markdown, word, pdf
Docconv
Converts PDF, DOC, DOCX, XML, HTML, RTF, etc to plain text
Stars: ✭ 735 (+818.75%)
Mutual labels:  word, pdf, pdf-converter
Net Core Docx Html To Pdf Converter
.NET Core library to create custom reports based on Word docx or HTML documents and convert to PDF
Stars: ✭ 133 (+66.25%)
Mutual labels:  word, pdf, pdf-converter
Docs2Pdf
Bulk convert word/powerpoint/excel file to pdf.
Stars: ✭ 27 (-66.25%)
Mutual labels:  excel, word, powerpoint
Mdpdf
Markdown to PDF command line app with support for stylesheets
Stars: ✭ 512 (+540%)
Mutual labels:  markdown, pdf, pdf-converter
Magicodes.ie
Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
Stars: ✭ 1,198 (+1397.5%)
Mutual labels:  excel, word, pdf

Gotenberg PHP client

A simple PHP client for interacting with a Gotenberg API.

Install

Unless your project already have a PSR7 HttpClient, install php-http/guzzle6-adapter:

$ composer require php-http/guzzle6-adapter

Then the PHP client:

$ composer require thecodingmachine/gotenberg-php-client

Usage

use TheCodingMachine\Gotenberg\Client;
use TheCodingMachine\Gotenberg\ClientException;
use TheCodingMachine\Gotenberg\DocumentFactory;
use TheCodingMachine\Gotenberg\HTMLRequest;
use TheCodingMachine\Gotenberg\Request;
use TheCodingMachine\Gotenberg\RequestException;
use GuzzleHttp\Psr7\LazyOpenStream;

# create the client.
$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
# ... or the following if you want the client to discover automatically an installed implementation of the PSR7 `HttpClient`.
$client = new Client('http://localhost:3000');

# prepare the files required for your conversion.

# from a path.
$index = DocumentFactory::makeFromPath('index.html', '/path/to/file');
# ... or from your own stream.
$stream = new LazyOpenStream('/path/to/file', 'r');
$index = DocumentFactory::makeFromStream('index.html', $stream);
// ... or from a string.
$index = DocumentFactory::makeFromString('index.html', '<html>Foo</html>');

$header = DocumentFactory::makeFromPath('header.html', '/path/to/file');
$footer = DocumentFactory::makeFromPath('footer.html', '/path/to/file');
$assets = [
    DocumentFactory::makeFromPath('style.css', '/path/to/file'),
    DocumentFactory::makeFromPath('img.png', '/path/to/file'),
];

try {
    $request = new HTMLRequest($index);
    $request->setHeader($header);
    $request->setFooter($footer);
    $request->setAssets($assets);
    $request->setPaperSize(Request::A4);
    $request->setMargins(Request::NO_MARGINS);
    $request->setScale(0.75);
    
    # store method allows you to... store the resulting PDF in a particular destination.
    $client->store($request, 'path/you/want/the/pdf/to/be/stored.pdf');
    
    # if you wish to redirect the response directly to the browser, you may also use:
    $client->post($request);          
} catch (RequestException $e) {
    # this exception is thrown if given paper size or margins are not correct.
} catch (ClientException $e) {
    # this exception is thrown by the client if the API has returned a code != 200.
}

For more complete usages, head to the documentation.

Badges

Travis CI Scrutinizer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].