ImagesDocxToPDFConverter is a JavaFX desktop application that allows users to convert either images (.jpg or .png) files or .docx files to PDF files by dragging and dropping the files for conversion.
The program takes the following as input files:
The application uses itextpdf and documents4j packages to convert images and docx files to Acrobat PDF format respectively.
Given an image, the program does the following:
- Creates a new Document instance and FileOutputStream instance
- Instantiates a new PdfWriter object
- Opens the PdfWriter and Document
- Creates a new page where the image will be rendered
- Instantiates and gets a new Image object
- Sets image's absolute position (x, y) = (0, 0), border width to 0, and the image's page size to A4
- Adds the image to the Document object which will convert the image file
- Close Document and PDFWriter
- Instantiates two File objects for input and output files respectively.
- Instantiates an InputStream and and OutputStream object for input and output files respectively
- Builds an IConverter to convert the input file to its respective PDF file
- Converts the word file to PDF file
- Shuts IConverter
- Close the Inputstream and Outputstream objects
The application has three options (shown in the screen shot below) for the user:
Clicking on the first option, the program launches a new scene prompting the user to drag the image files to the window area:
On dropping the images, the preview window is launched and the user can browse through the images to converted by scrolling on the window (see the screen shot below):
Word files can be converted in a similar manner as described above


