java-sdk

pdfapi.io Java SDK

License

License

MIT
Categories

Categories

PDF Data
GroupId

GroupId

io.pdfapi
ArtifactId

ArtifactId

sdk
Last Version

Last Version

2.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

java-sdk
pdfapi.io Java SDK
Project URL

Project URL

https://pdfapi.io
Source Code Management

Source Code Management

https://github.com/pdfapi/java-sdk

Download sdk

How to add to project

<!-- https://jarcasting.com/artifacts/io.pdfapi/sdk/ -->
<dependency>
    <groupId>io.pdfapi</groupId>
    <artifactId>sdk</artifactId>
    <version>2.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.pdfapi/sdk/
implementation 'io.pdfapi:sdk:2.2.0'
// https://jarcasting.com/artifacts/io.pdfapi/sdk/
implementation ("io.pdfapi:sdk:2.2.0")
'io.pdfapi:sdk:jar:2.2.0'
<dependency org="io.pdfapi" name="sdk" rev="2.2.0">
  <artifact name="sdk" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.pdfapi', module='sdk', version='2.2.0')
)
libraryDependencies += "io.pdfapi" % "sdk" % "2.2.0"
[io.pdfapi/sdk "2.2.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.httpcomponents : httpclient jar 4.5.2
com.google.code.gson : gson jar 2.8.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

Build Status

pdfapi.io SDK for Java

Installation

pdfapi.io Java SDK can be installed with Gradle or Maven. Add dependency for Gradle project:

compile group: 'io.pdfapi', name: 'sdk', version: '2.2.0'

Usage

Usage of pdfapi.io PHP SDK is very simple. The easyest way to get started is:

import io.pdfapi.sdk.PdfApi;

import java.io.*;

String template = "<html>\n" +
        "    <body>\n" +
        "        <h1>pdfapi.io makes PDF generation so easy.</h1>\n" +
        "        <p>And it can do complicated stuff.</p>\n" +
        "    </body>\n" +
        "</html>";

PdfApi pdf = new PdfApi("YOUR_API_KEY");
pdf.setHtml(template);

InputStream rawPdf = pdf.generate();

Full example of the usage: Note: Be aware that header and footer are separate HTML documents (with styles and everything) that are copied to each page.

import io.pdfapi.sdk.PdfApi;
import io.pdfapi.sdk.parameter.Margin;
import io.pdfapi.sdk.parameter.Orientation;
import io.pdfapi.sdk.parameter.Size;

import java.io.*;

String template = "<html>\n" +
        "    <body>\n" +
        "        <h1>pdfapi.io makes PDF generation so easy.</h1>\n" +
        "        <p>And it can do complicated stuff.</p>\n" +
        "    </body>\n" +
        "</html>";

String header = "<html>\n" +
        "  <body>\n" +
        "      <p>pdfapi.io</p>\n" +
        "  </body>\n" +
        "</html>";

String footer = "<html>\n" +
        "  <body>\n" +
        "      <p>pdfapi.io</p>\n" +
        "  </body>\n" +
        "</html>";

PdfApi pdf = new PdfApi("YOUR_API_KEY");
pdf.setHtml(template);
pdf.setHeader(header);
pdf.setFooter(footer);
pdf.setSize(Size.A4);
pdf.setOrientation(Orientation.Landscape);
pdf.setMargins(new Margin(60, 60, 60, 60));

InputStream rawPdf = pdf.generate();

//or optionally you can save PDF directly to file
pdf.save("/path/to/file.pdf");

For getting API KEY you need to register account at https://pdfapi.io. Generating API KEY will take you 10 seconds. And it is free. Really.

io.pdfapi

pdfapi.io

Generate PDF documents from HTML via API

Versions

Version
2.2.0
2.0.1
2.0.0
1.1.1
1.1.0
1.0.1
1.0