How to Run IronPDF for Java in Google Cloud

Note: We have not fully tested support with Google Cloud, but if you want to try, we have some Required Settings.

Important: Required Settings

  • Zip Deployment is not supported, since IronPDF requires execution of binaries at runtime.
  • Default Cloud Function Docker images are not working because they lack the required packages for Chrome to run properly. For more information, see the Google Cloud System Packages.
  • Please use a custom Dockerfile and install all required packages. Learn more about this in our Linux Deployment Guide.

  • Include the ironpdf-engine-linux-x64 dependency to your project (change the version number to the latest):

    <dependency>
      <groupId>com.ironsoftware</groupId>
      <artifactId>ironpdf-engine-linux-x64</artifactId>
      <version>2022.xx.x</version>
    </dependency>
    <dependency>
      <groupId>com.ironsoftware</groupId>
      <artifactId>ironpdf-engine-linux-x64</artifactId>
      <version>2022.xx.x</version>
    </dependency>
    XML
  • This plugin may be required:

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-shade-plugin</artifactId>
      <version>3.2.4</version>
      <executions>
          <execution>
              <phase>package</phase>
              <goals>
                  <goal>shade</goal>
              </goals>
              <!-- required for Docker -->
              <configuration>
                  <transformers>
                      <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                  </transformers>
              </configuration>
          </execution>
      </executions>
    </plugin>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-shade-plugin</artifactId>
      <version>3.2.4</version>
      <executions>
          <execution>
              <phase>package</phase>
              <goals>
                  <goal>shade</goal>
              </goals>
              <!-- required for Docker -->
              <configuration>
                  <transformers>
                      <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                  </transformers>
              </configuration>
          </execution>
      </executions>
    </plugin>
    XML
  • These dependencies may be required:

    <dependency>
      <groupId>io.perfmark</groupId>
      <artifactId>perfmark-api</artifactId>
      <version>0.26.0</version>
    </dependency>
    
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-okhttp</artifactId>
      <version>1.50.2</version>
    </dependency>
    
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-netty-shaded</artifactId>
      <version>1.50.2</version>
    </dependency>
    <dependency>
      <groupId>io.perfmark</groupId>
      <artifactId>perfmark-api</artifactId>
      <version>0.26.0</version>
    </dependency>
    
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-okhttp</artifactId>
      <version>1.50.2</version>
    </dependency>
    
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-netty-shaded</artifactId>
      <version>1.50.2</version>
    </dependency>
    XML
  • Set timeout to 330 seconds due to slow start.
  • Set memory size to at least 2048 MB.
  • Set Ephemeral Storage Size to at least 1024 MB.
  • In some environments, you may need to point at an IronPdfEngineWorkingDirectory and set execution permissions for it:

    // Set the working directory for the IronPDF Engine
    Setting.setIronPdfEngineWorkingDirectory(Paths.get("/tmp/"));
    // Set the working directory for the IronPDF Engine
    Setting.setIronPdfEngineWorkingDirectory(Paths.get("/tmp/"));
    JAVA
    # Grant full read/write/execute permissions to the /tmp directory
    RUN chmod 777 /tmp/

Frequently Asked Questions

What are the required settings to run IronPDF for Java in Google Cloud?

Zip Deployment is not supported, and default Cloud Function Docker images do not work. A custom Dockerfile with all required packages is necessary.

What dependency should be included in the project for IronPDF?

Include the 'ironpdf-engine-linux-x64' dependency to your project, ensuring you use the latest version.

Is there a plugin that may be required for deploying IronPDF in Google Cloud?

The 'maven-shade-plugin' may be required, especially for Docker, with specific configurations for transformers.

What additional dependencies might be necessary?

You may need to include 'perfmark-api', 'grpc-okhttp', and 'grpc-netty-shaded' dependencies.

What timeout setting is recommended for running IronPDF on Google Cloud?

Set the timeout to 330 seconds due to slow start.

What is the recommended memory size for deploying IronPDF on Google Cloud?

Set the memory size to at least 2048 MB.

How much Ephemeral Storage Size is required?

Set the Ephemeral Storage Size to at least 1024 MB.

How do you set the working directory for the IronPDF engine?

Use the Setting.setIronPdfEngineWorkingDirectory method to point to a directory like '/tmp/' and set execution permissions.