English | 日本
Java generate pdf
Shopping Cart Contact Us Java PDF
Java generate PDF

Use Java to generate PDF quickly and accurately

Generating PDF using Java has never been so quick and easy. Learn how to generate PDF files from a majority of other formats with a few lines of Java code and use it with your server or desktop application.

Use the following code to generate high quality PDF files in Java:

import com.bcl.easypdf.printer.*;
import java.io.File;

public class TestPrinter
   public static void main(String[] args) throws Exception
      Printer printer = new Printer();
      printer.useLoader = false;
         PrintJob printjob = printer.getPrintJob();
         printjob.PrintOut(inputFileName, outputFileName);
      catch(PrinterException ex)


Generate PDF files in Java with various settings

BCL’s Java libraries allow you to generate PDF files with multiple settings, such as margins, page width, smart shrink, meta tags, etc. You don’t need to be a professional Java developer to use them.

Add printer settings to your Java PDF generator

Only a few lines of Java code let you generate PDF files with multiple printer settings. The following example uses A4 paper format, sets Layout Scaling to 100, graphics resolution to 300, orientation to Portrait and color to Greyscale.

PrinterSetting printerSettings = printer.getPrinterSetting();

Customize PrintJob in PDF generation with Java, add conversion timeouts

This code will let you make a temporary copy of the input file and set its file conversion timeout to 600 seconds, page conversion timeout to 70 seconds, and initialization to 90 seconds, respectively.


Generate PDF with Java and set metadata settings

Add metadata to your PDF file with the following code:


Encrypt your Java generated PDF

The following code will help you to generate PDF in Java with an encryption:

PDFSetting pdfSettings = printjob.getPDFSetting();

easyPDF SDK accelerates your enterprise application development process and also speeds up your Java application performance. It has high-level Java APIs for converting multiple file formats into PDF, modifying existing PDF files, transferring PDF files to many different image formats, and populating PDF form fields. This toolkit is powerful and easy to use in any Java application that works with PDF documents.

Get a free Java application sample to generate PDF and check out the easyPDF SDK User Manual

Major Benefits of easyPDF - Java PDF Generator

  • Comes with multiple printer settings such as graphic resolution & scaling, paper orientation & size, printer color;
  • Supports many PDF features such as Font Embedding & Subsetting, Image compression, Metadata;
  • Provides a high level of security (e.g. set permission to print, edit), Digital Signature & Stamping, Watermark, PDF Viewer setting;
  • Supports 64-bit versions of Windows 2003/2008/Vista/10, Microsoft Windows Server 2012 and 2012 R2;
  • Supports PDF/A and PDF/X Standards;
  • Generates PDF faster;
  • Supports XPS to PDF conversion.

Stop wasting your time by reading through multiple-volume Java SDK manuals and seeking a perfect Java API to generate PDF. You have found one, already! Implement easyPDF SDK to generate PDF files using Java quickly, with no errors and with the best quality of conversion. Download free trial now!

You might also be interested in how to create PDF with Java, process it, rasterize PDF with Java and process PDF Form with it. In addition, learn how to convert HTML to PDF in Java in a matter of minutes.


What others say regarding our Java Generate PDF

 easy PDF SDK setup was very straightforward, unlike our experience with other products. We wrote just a few lines of code to start using it. Read the case study  

M. David Stone,

PC Magazines

© 1993 - , BCL Technologies.
All other trademarks are the property of their respective owners.