parthenon/docraptor

This package is abandoned and no longer maintained. The author suggests using the docraptor/docraptor package instead.

A wrapper for the DocRaptor HTML to PDF/XLS service.

2.0.3 2021-07-10 08:04 UTC

This package is auto-updated.

Last update: 2022-09-16 08:02:52 UTC


README

Build Status

DocRaptor PHP Native Client Library

This is a PHP package for using DocRaptor API to convert HTML to PDF and XLSX.

Installation

composer require docraptor/docraptor

Basic Usage

$docraptor = new DocRaptor\DocApi();
$docraptor->getConfig()->setUsername("YOUR_API_KEY_HERE");             // this key works for test documents
// $docraptor->getConfig()->setDebug(true);

$doc = new DocRaptor\Doc();
$doc->setTest(true);                                                   // test documents are free but watermarked
$doc->setDocumentContent("<html><body>Hello World</body></html>");     // supply content directly
// $doc->setDocumentUrl("http://docraptor.com/examples/invoice.html"); // or use a url
$doc->setName("docraptor-php.pdf");                                    // help you find a document later
$doc->setDocumentType("pdf");                                          // pdf or xls or xlsx
// $doc->setJavascript(true);                                          // enable JavaScript processing
// $prince_options = new DocRaptor\PrinceOptions();                    // pdf-specific options
// $doc->setPrinceOptions($prince_options);
// $prince_options->setMedia("screen");                                // use screen styles instead of print styles
// $prince_options->setBaseurl("http://hello.com");                    // pretend URL when using document_content

$create_response = $docraptor->createDoc($doc);

Next Steps

  • Optionally store and get a URL for your converted document with document hosting
  • View more code examples with error handling, asynchronous creation, file saving, and document hosting.
  • Perfect your document styling with our style and formatting reference, and API reference. Easily add headers and footers, page breaks, page numbers, table of contents, and much more!

More Help

Stuck? We're experts at turning HTML into PDFs so please email us if you run into trouble.

Development

The majority of the code in this repo is generated using swagger-codegen on docraptor.yaml. You can modify this file and regenerate the client using script/generate_language php.

Release Process

  1. Pull latest master
  2. Merge feature branch(es) into master
  3. script/test
  4. Increment version in code:
  • swagger-config.json
  • lib/Configuration.php (2 places)
  1. Update CHANGELOG.md
  2. Commit "Release version vX.Y.Z"
  3. Push to GitHub
  4. Tag version: git tag 'vX.Y.Z' && git push --tags (GitHub packagist integration will tell packagist to release a new version)
  5. Verify update on https://packagist.org/packages/docraptor/docraptor
  6. Refresh documentation on docraptor.com

Version Policy

This library follows Semantic Versioning 2.0.0.

Contributors

  • Joel Meador
  • Elijah Miller
  • James Paden
  • Jason Gladish
  • Nikola Nikolov