webp to pdf

WebP to PDF Converter in Java

The WebP is a modern image format that offers superior compression and quality compared to traditional formats like JPEG and PNG. They are quite popular because a WebP file is generally much smaller than a traditional JPEG and hence websites load faster and provide better users experience. However, it’s not always compatible with all devices and platforms. That’s where converting WebP to PDF comes in. In this article, we’ll guide you on how to convert WebP to PDF using Java REST API. We’ll walk you through the process of creating a Java project, calling a REST API endpoint and convert WebP files to PDF.


In order to process raster images, Metafiles, photoshop and other popular image formats, we have developed Aspose.Imaging Cloud SDK for Java. It’s a finest solution offering reliable image processing and image conversion capabilities. It also supports the feature to convert WebP file to PDF format. Now in order to convert WebP to PDF Online, we need to add API reference in our java project by including following information in pom.xml (maven build type project).



Once the REST API reference has been added in Java project, please obtain your client credentials from Cloud Dashboard. Else, you need to first register a free account while using a valid email address.

Convert WebP to PDF in Java

Let’s discuss the steps for converting WebP to PDF using Java. Please note that the following code snippet expects the input WebP image to be available in Cloud storage, so we are going to upload the input WebP image to cloud storage.

  • Create an instance of ImagingApi using personalized credentials
  • Load the WebP file using readAllBytes(…) method and pass the returned value to byte[] array
  • Now create an object of CreateConvertedImageRequest which takes WebP image name and ‘pdf’ format as arguments
  • Call the method createConvertedImage(…) to perform WebP to PDF conversion. As a result, the output is returned in response stream
  • Finally, save the resultant WebP to local drive using FileOutputStream object
webp to pdf

Image:- WebP to PDF conversion preview

The input WebP image used in the above example can be download from this link.

WebP File to PDF using cURL Commands

Apart from Java code snippet, another approach to convert WebP file to PDF format is via cURL commands. Now as a pre-requisite, we need to generate a JWT access token (based on client credentials) using following command.

curl -v "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Now execute the following command to convert WebP to PDF format and save the output to local drive

curl -v -X GET "https://api.aspose.cloud/v3.0/imaging/input.webp/convert?format=pdf" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-o "Output.pdf"


The article has explicitly provided all the necessary details on converting WebP to PDF using Java. Apart from this, we highly encourage you to explore the Product Documentation which is an amazing source of information to learn about other exciting features offered by the API. You can also test the API through SwaggerUI within a web browser and in case you need to download and modify the source code of Cloud SDK, it is available on GitHub (published under MIT license).

Lastly, in case you encounter any issues while using the API, you may consider approaching us for a quick resolution via free product support forum.

Please visit the following links to learn more about: