Skip to main content
Skip table of contents

pdfOffice: enabled parallel conversion

What changed?

Previously, it wasn't possible to use pdfOffice in parallel due to certain limitations in the library. Files were sequentially processed, regardless of whether threads were being used during processing or not. In pdfOffice version 2.0.3, the multithreading handler which locked parallel conversions was removed and true multithreading was enabled by using Java's ThreadLocal API along with some refactoring to reduce non-final statics. 

How it works

To use the multithreading functionality, all you need to do is to call one of the OfficeConverter#convertOfficeDocumentToPdf overloads (Java) inside 2 or more separate threads and the conversion will happen concurrently. Below you can find a simple example method to show how you could create threads to run concurrently. During testing with simple mock files and 2 threads, we already noticed an increase in performance of 14% but optimization results will, naturally, be dependent on several environmental factors such as hardware, input files, JVM warmup, and other factors. 

JAVA
  public Thread createOfficeConversionThread(String inputFilePath, String outputFilePath) {
        return new Thread(() -> {
            File officeInput = new File(inputFilePath);
            File pdfOutput = new File(outputFilePath);
            try {

                OfficeConverter.convertOfficeDocumentToPdf(officeInput, pdfOutput);
            } catch (IOException e) {
                throw new PdfOfficeException("Thread was not able to be created: " + e.getMessage());
            }
        });
    } 

Want high-quality Office to PDF conversion, but don't use Java?

While the pdfOffice add-on is currently only available natively for Java, you can access its functionality using the iText 7 Suite BYOL's REST API on AWS Marketplace. Alternatively, tell us about your requirements. We'll see what we can do for you!

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.