GithubHelp home page GithubHelp logo

pdfreactor's Introduction

RealObjects PDFreactor® PHP wrapper

PHP wrapper API for PDFreactor (PHP include, PHP sample), put into a composer-compatible library package which autoloads the PDFreactor wrapper.

Used from PDFreactor.com / Version 9.0.9411.6, 2017-07-06

Please note that by installing and using PDFreactor itself (not the wrapper) you agree to the license, terms and conditions of PDFreactor.com.

This package is not affiliated with RealObjects or PDFreactor.

Usage

Use composer to install the library via composer require b13/pdfreactor.

In an ideal world, you then have your composer-based application and just use it like this:

$pdfReactor = new PDFreactor('http://yourServer:9423/service/rest');

or via .env logic

$pdfReactor = new PDFreactor(getenv('PDFREACTOR_API_ENDPOINT'));

as the class is already available via the composer autoloader.

The default example taken from PDFreactor can be found under example/sample.php.

License

The PDFreactor wrapper library is licensed under MIT, see LICENSE file for more details.

pdfreactor's People

Contributors

bmack avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pdfreactor's Issues

Got issue in localhost for connection

Screenshot from 2019-07-11 13-10-43

Please solve it so i can use it in my laravel project, below is my latest code 👍

`require_once base_path("vendor/b13/pdfreactor/src/PDFreactor.class.php");
use com\realobjects\pdfreactor\webservice\client\PDFreactor as PDFreactor;
use com\realobjects\pdfreactor\webservice\client\LogLevel as LogLevel;
use com\realobjects\pdfreactor\webservice\client\ViewerPreferences as ViewerPreferences;

// The content to render
$content = implode(file(base_path("vendor/b13/pdfreactor/src/PDFreactor.class.php")));

date_default_timezone_set('CET');

// Create new PDFreactor instance
// $pdfReactor = new PDFreactor("http://yourServer:9423/service/rest");
$pdfReactor = new PDFreactor();

$config = array(
    // Specify the input document
    "document"=> $content,
    // Set a base URL for images, style sheets, links
    "baseURL"=> "http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"],
    // Set an appropriate log level
    "logLevel"=> LogLevel::DEBUG,
    // Set the title of the created PDF
    "title"=> "Demonstration of PDFreactor PHP API",
    // Sets the author of the created PDF
    "author"=> "Myself",
    // Enables links in the PDF document.
    "addLinks"=> true,
    // Enables bookmarks in the PDF document.
    "addBookmarks"=> true,
    // Set some viewer preferences
    "viewerPreferences"=> array(
        ViewerPreferences::FIT_WINDOW,
        ViewerPreferences::PAGE_MODE_USE_THUMBS
    ),
    // Add user style sheets
    "userStyleSheets"=> array(
        array(
            'content'=> "@page {" .
                            "@top-center {".
                                "content: 'PDFreactor PHP API demonstration';".
                            "}".
                            "@bottom-center {" .
                                "content: 'Created on ".date("m/d/Y G:i:s A")."';" .
                            "}" .
                        "}"
        ),
        array( 'uri'=> "../../resources/common.css" )
    )
);

// Render document and save result to $result
$result = null;
try {
    $result = $pdfReactor->convertAsBinary($config);
    header("Content-Type: application/pdf");
    echo $result;
} catch (Exception $e) {
    echo "<h1>An Error Has Occurred</h1>";
    echo "<h2>".$e->getMessage()."</h2>";
}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.