A native Java client for the DocRaptor document generation service.
Java Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
script
src/main Regenrated client with inclusion of the pipeline API parameter. Oct 12, 2016
test Updated Sync test to try writing a file. Sep 12, 2016
.gitignore
.swagger-revision
CHANGELOG.md
LICENSE
README.md link to release setup guide Nov 3, 2016
RELEASE_SETUP.md
build.gradle Release version v1.1.0 Nov 3, 2016
docraptor.yaml Updated server API version based on new docraptor.yaml. Oct 13, 2016
gradle.properties
pom.xml
settings.gradle
swagger-config.json

README.md

DocRaptor Java Native Client Library

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

Installation

To install the API client library to your local Maven repository, simply execute:

mvn install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn deploy

After the client libarary is installed/deployed, you can use it in your Maven project by adding the following to your pom.xml:

<dependency>
  <groupId>com.docraptor</groupId>
  <artifactId>docraptor</artifactId>
  <version>1.1.0</version>
</dependency>

Usage

See examples for runnable examples with file output, error handling, etc.

import java.io.*;
import java.net.*;
import com.docraptor.*;

public class Sync {
  public static void main(String[] args) throws Exception {
    DocApi docraptor = new DocApi();
    ApiClient client = docraptor.getApiClient();
   client.setUsername("YOUR_API_KEY_HERE"); // this key works for test documents
    //client.setDebugging(true);

    Doc doc = new 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.setDocumentType(Doc.DocumentTypeEnum.PDF);                       // PDF or XLS or XLSX
    doc.setName("docraptor-java.pdf");                                   // help you find a document later
    doc.setJavascript(true);                                             // enable JavaScript processing
    // prince_options = new PrinceOptions();
    // 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
    docraptor.createDoc(doc);
  }
}

Docs created like this are limited to 60 seconds to render, check out the async example which allows 10 minutes.

We have guides for doing some of the common things:

More Help

DocRaptor has a lot of more styling and implementation options.

Stuck? We're experts at using DocRaptor 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 java.

Release Process

If you haven't released before, please see the release setup guide.

  1. Pull latest master
  2. Merge feature branch(es) into master
  3. script/test
  4. Increment version in code:
    • swagger-config.json
    • build.gradle
    • pom.xml
    • README.md
  5. Update CHANGELOG.md
  6. Commit "Release vX.Y.Z"
  7. Push to GitHub
  8. Tag version: git tag 'vX.Y.Z' && git push --tags
  9. eval $(gpg-agent --daemon)
  10. gpg --use-agent --armor --detach-sign and press ^C after authenticating
  11. mvn clean deploy
  12. Verify package release at Central (takes anywhere from minutes to days)
  13. Use the git tag and make a new release with target/docraptor-* attached, https://github.com/DocRaptor/docraptor-java/tags
  14. Refresh documentation on docraptor.com

Version Policy

This library follows Semantic Versioning 2.0.0.