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>
XMLThis 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>
XMLThese 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
to330 seconds
due to slow start. - Set
memory size
to at least2048 MB
. - Set
Ephemeral Storage Size
to at least1024 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
How do I set up a PDF library for Java on Google Cloud?
To set up a PDF library on Google Cloud, use a custom Dockerfile to install all necessary packages as detailed in the IronPDF Linux Deployment Guide. Include the ironpdf-engine-linux-x64
dependency and configure specific settings for optimal performance.
What are the specific settings required for running a PDF library on Google Cloud?
When running a PDF library on Google Cloud, use a timeout of 330 seconds, a memory size of at least 2048 MB, and an Ephemeral Storage Size of at least 1024 MB. Additionally, set the IronPdfEngineWorkingDirectory
and ensure execution permissions for that directory.
Why is Zip Deployment not supported for a PDF library on Google Cloud?
Zip Deployment is not supported because IronPDF requires the execution of binaries at runtime, which is not feasible with standard Zip Deployment methods.
What additional dependencies are necessary for deploying a PDF library on Google Cloud?
Additional dependencies that might be required include perfmark-api
, grpc-okhttp
, and grpc-netty-shaded
. These ensure proper functionality of the library when deployed.
How can I handle package requirements for a PDF library in Google Cloud Docker images?
Default Cloud Function Docker images lack the necessary packages for Chrome. Use a custom Dockerfile to install all required packages, following the instructions in the IronPDF Linux Deployment Guide.
Is there a specific Maven plugin required for deploying a PDF library in Docker environments?
The maven-shade-plugin
may be required for Docker environments. It should be configured to use transformers, especially when dealing with complex dependencies.
How do I set the working directory for a PDF engine in a Docker environment?
You can set the working directory for the PDF engine using Setting.setIronPdfEngineWorkingDirectory(Paths.get("/tmp/"))
. Ensure you grant necessary permissions with a command like RUN chmod 777 /tmp/
in your Dockerfile.