Skip to main content

Quick Start for Java

With Java, wkhtmltopdf integration is possible, though Puppeteer isn’t natively supported and requires workarounds. Our service acts as a faster, more reliable solution. Follow these steps to begin with Java.

Get Your API Key

  • Your API Key is available in the Admin Dashboard or in the welcome email sent after you signed up.
  • It’s essential for authenticating your requests with the PDFBolt API.

Make Your First Request

Use the following example to quickly make a request to the PDFBolt API and generate your first PDF document.

import kong.unirest.Unirest; //simple java library
import kong.unirest.HttpResponse;
import java.io.FileOutputStream;
import java.io.IOException;

public class PdfBoltRequest {
public static void main(String[] args) {
try {
HttpResponse<byte[]> response = Unirest.post("https://api.pdfbolt.com/v1/direct")
.header("Content-Type", "application/json")
.header("API_KEY", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")
.body("{\"url\":\"https://example.com\"}")
.asBytes();

try (FileOutputStream fos = new FileOutputStream("example.pdf")) {
fos.write(response.getBody());
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

What’s next?

Continue your journey with PDFBolt by exploring its extensive features and benefits. Start by checking the available API Endpoints and reviewing the various Conversion Parameters that can be used to customize your integration. This will help you leverage PDFBolt’s full capabilities and ensure that it aligns with your specific requirements.