Skip to main content

Posts

Showing posts from February, 2020

Add, Replace and Delete Images in PDF in Java

In this blog, I will show you how to add, replace and delete images in a PDF document in Java using Free Spire.PDF for Java library. Dependencies First of all, you need to add needed dependencies for including Free Spire.PDF for Java into your Java project. There are two ways to do that. If you use maven, you need to add the following code to your project’s pom.xml file. <repositories>           <repository>               <id>com.e-iceblue</id>               <name>e-iceblue</name>               <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>           </repository>   </repositories>   <dependencies>       <dependency>           <groupId>e-iceblue</groupId>           <artifactId>spire.pdf.free</artifactId>           <version>2.6.3</version>       </dependency>   </dependencies>   For non-maven projects, download Free

Simple Java Code to Convert Excel to PDF in Java

This article demonstrates a simple solution to convert an Excel file to PDF in Java by using free Excel API – Free Spire.XLS for Java . The following examples illustrate two possibilities to convert Excel to PDF:      Convert the whole Excel file to PDF     Convert a particular Excel Worksheet to PDF Before start with coding, you need to Download Free Spire.XLS for Java package , unzip it and import Spire.Xls.jar file from the lib folder in your project as a denpendency. 1. Convert the whole Excel file to PDF Spire.XLS for Java provides saveToFile method in Workbook class that enables us to easily save a whole Excel file to PDF. import com.spire.xls.FileFormat; import com.spire.xls.Workbook; public class ExcelToPDF {     public static void main(String[] args){         //Create a Workbook         Workbook workbook = new Workbook();         workbook.loadFromFile( "Sample.xlsx" );         //Fit to page         workbook.getConverterSetting().setShee