This is a maven package for using DocRaptor API to convert HTML to PDF and XLSX.
To install the API client library to your local Maven repository, simply execute:
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
After the client library 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>3.2.0</version> </dependency>
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); } }
Stuck? We're experts at turning HTML into PDFs so please email us if you run into trouble.
The majority of the code in this repo is generated using openapi-generator on docraptor.yaml. You can modify this file and regenerate the client using script/generate_language
.
If dependencies change in the generated code then the pom.xml
will need regenerated by swagger which it only does if the file doesn't exist. To regenerate it:
pom.xml
script/generate_language
pom.xml
file removes. To replace it add the following plugin in the <project><build><plugins>
section:
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
If you haven't released before, please see the release setup guide.
script/test
generator-config.json
README.md
script/generate_language
to update generated version numbers:build.gradle
pom.xml
src/main/java/com/docraptor/ApiClient.java
git tag 'vX.Y.Z' && git push --tags
script/release
target/docraptor-*
to the releaseThis library follows Semantic Versioning 2.0.0.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4