Tuesday, 29 June 2021

Set the paragraph spacing and character spacing for Word in Java

Expanding the spacing between the characters or paragraphs can make your text look bigger and bolder for standing out them, without increasing their size. This article will demonstrate how to set the paragraph spacing and character spacing for Word documents using Java codes.

Before running codes, we need to create a development environment and use a free third-party library called Free Spire.Doc for Java. It’s worth mentioning that we need to add a Jar file called Spire.Doc.jar of the library to IDEA. Get it from the link or reference it by using the following Maven configurations.

<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.doc.free</artifactId>
<version>3.9.0</version>
</dependency>
</dependencies>

Using the code

import com.spire.doc.*;
import com.spire.doc.documents.Paragraph;
import com.spire.doc.fields.TextRange;
import java.awt.*;

public class SetSpacing {
public static void main(String[] args) {
//Load a Word document
Document document= new Document("C:\\Users\\Test1\\Desktop\\Sample.docx");

//Add a new paragraph and append the text
Paragraph para = new Paragraph(document);
TextRange textRange1 = para.appendText("Newly add a paragraph and set the paragraph spacing and character spacing");
textRange1.getCharacterFormat().setTextColor(Color.blue);
textRange1.getCharacterFormat().setFontSize(14);

//Set the spacing before and after paragraph
para.getFormat().setBeforeAutoSpacing(false);
para.getFormat().setBeforeSpacing(10);
para.getFormat().setAfterAutoSpacing(false);
para.getFormat().setAfterSpacing(10);

//Set the character spacing
for (Object object :(Iterable) para.getChildObjects())
{
if(object instanceof TextRange)
{
TextRange textRange= (TextRange) object;
textRange.getCharacterFormat().setCharacterSpacing(8f);
}
}
//Insert the paragraph
document.getSections().get(0).getParagraphs().insert(2, para);

//Save the document to file
document.saveToFile("output/SetSpacing.docx", FileFormat.Docx);
}
}

Output




Thursday, 24 June 2021

Convert Excel to Image in Java

This article will introduce how to convert Excel to Image using Java codes with the help of a free third-party library called Free Spire.XLS for Java. The library supports converting a whole worksheet to Image, and also can convert a specific range of cells in a worksheet to Image. Besides, when converting Excel to Image, it supports setting dpi value of the image. The following code samples will separately demonstrate the functions above.

BEFORE RUNNING CODES

First of all, we need to create a development environment to run Java codes. Download and install JDK and Intellij IDEA, and then add a Jar file called Spire.Xls.jar which can be found in the “lib” folder of the Free Spire.XLS for Java library to IDEA. Or you can reference it by using the following Maven configurations.

USING THE CODE

Next, let’s find the corresponding code samples. The following is the screenshot of my Excel sample.

l  Convert a whole worksheet to Image

import com.spire.xls.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class ToImage {
public static void main(String[] args) throws IOException {

//Create a workbook and load a file
Workbook workbook = new Workbook();
workbook.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.xlsx");

//Get the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);

//Save the sheet to image
BufferedImage bufferedImage = sheet.toImage(sheet.getFirstRow(), sheet.getFirstColumn(), sheet.getLastRow(), sheet.getLastColumn());
ImageIO.write(bufferedImage,"PNG",new File("output/ToImage.png"));
}
}

Output


l  Convert a specific range of cells to Image

import com.spire.xls.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;

public class SpecificCellsToImage {
public static void main(String[] args) throws IOException {
//Create a workbook and load a file
Workbook workbook = new Workbook();
workbook.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.xlsx");

//Get the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);

//Specify Cell Ranges and save to image formats
BufferedImage bufferedImage = sheet.toImage(1, 1, 5, 4);
ImageIO.write(bufferedImage,"PNG",new File("output/specificCellsToImage.png"));
}
}

Output


l  Set Dpi when converting Excel to Image

import com.spire.xls.*;

public class SetDpiToImage {
public static void main(String[] args) {
//Create a Workbook object
Workbook wb = new Workbook();

//Load an Excel file
wb.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.xlsx");

//Set dpi on x and y axis
wb.getConverterSetting().setXDpi(400);
wb.getConverterSetting().setYDpi(400);

//Declare a Worksheet variable
Worksheet sheet;

//Loop through the worksheets
for (int i = 0; i < wb.getWorksheets().size(); i++) {

//Get the specific worksheet
sheet = wb.getWorksheets().get(i);

//Convert worksheet to image
sheet.saveToImage("output/image-" + i + ".png");
}
}
}


Monday, 21 June 2021

Add and Delete Annotations in PDF using Java

Usually, PDF files are loved because they are secure and retain the format of information even when compressed. However, they are not easy to edit. To do this effectively we can add annotations for specified text in PDF. This article will use Java codes to demonstrate how to add annotations to PDF and then how to delete them. The operation can be done without Adobe Acrobat installed.

Development Environment

Before running codes, we need to download and install JDK and Intellij IDEA to create a development environment. At the same time, here we need to use a free third-party library called Free Spire.PDF for Java.

Add Spire.Pdf.jar to IDEA

Download the package of Free Spire.Pdf for Java from the link, find a Jar file called Spire.Pdf.jar in the “lib” folder, and then add it to IDEA. Or you can directly refer to it by using the following Maven configurations.

<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>3.9.0</version>
</dependency>
</dependencies>

Create a new PDF file and add a pop-up annotation to it

import com.spire.pdf.*;
import com.spire.pdf.annotations.*;
import com.spire.pdf.graphics.*;
import java.awt.*;
import java.awt.geom.*;

public class PopupAnnotation {
public static void main(String[] args) {
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Set the margin of PDF
PdfUnitConvertor unitCvtr = new PdfUnitConvertor();
PdfMargins margin = new PdfMargins();
margin.setTop(unitCvtr.convertUnits(2.54f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point));
margin.setBottom(margin.getTop());
margin.setLeft(unitCvtr.convertUnits(3f, PdfGraphicsUnit.Centimeter, PdfGraphicsUnit.Point));
margin.setRight(margin.getLeft());
//Create one page
PdfPageBase page = doc.getPages().add(PdfPageSize.A4, margin);

//Add text
PdfBrush brush1 = PdfBrushes.getBlack();
PdfTrueTypeFont font1 = new PdfTrueTypeFont(new Font("Arial", Font.BOLD + Font.ITALIC,13), true);
PdfStringFormat format1 = new PdfStringFormat(PdfTextAlignment.Left);
float y = 50;
String s = "The sample demonstrates how to add annotations to PDF.";
page.getCanvas().drawString(s, font1, brush1, 0, y - 5, format1);
y = y + (float)font1.measureString(s, format1).getHeight();

//set the annotation font, string, size, position and style
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial",0, 12));
PdfStringFormat format = new PdfStringFormat();
format.setMeasureTrailingSpaces(true);
String prompt = "Popup Annotation: ";
Dimension2D size = font.measureString(prompt, format);
page.getCanvas().drawString(prompt, font, PdfBrushes.getDodgerBlue(), 0, y);
float x = (float)size.getWidth();
String label = "demo of Pop-up annotation";
page.getCanvas().drawString(label, font, PdfBrushes.getOrangeRed(), x, y);
x = x + (float)font.measureString(label, format).getWidth();
String markupText = "What is Annotation";
Rectangle2D rectangle2D = new Rectangle.Float();
rectangle2D.setFrame(new Point2D.Double(x,y),new Dimension());
PdfPopupAnnotation annotation = new PdfPopupAnnotation(rectangle2D, markupText);
annotation.setIcon(PdfPopupIcon.Paragraph);
annotation.setOpen(true);
annotation.setColor(new PdfRGBColor(Color.YELLOW));
((PdfNewPage) page).getAnnotations().add(annotation);

//Save the document to file
doc.saveToFile("output/AddPopupAnnotation.pdf");
doc.close();
}
}

Output


Adding a text box annotation to an existing PDF file

import com.spire.pdf.*;
import com.spire.pdf.annotations.*;
import com.spire.pdf.graphics.*;
import java.awt.*;
import java.awt.geom.*;
import com.spire.pdf.general.find.PdfTextFind;

public class TextBoxAnnotation {
public static void main(String[] args) {

//load the document from file
PdfDocument doc = new PdfDocument();
doc.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.pdf");

//get the first page
PdfPageBase page = doc.getPages().get(0);

//search a string and get its location where to add the annotation
PdfTextFind[] find = page.findText("Cashless Society").getFinds();
float x = (float) (find[0].getPosition().getX() - doc.getPageSettings().getMargins().getLeft() + find[0].getSize().getWidth() + 20);
float y = (float) (find[0].getPosition().getY() - doc.getPageSettings().getMargins().getTop() + 20);

//define a text annotation
Rectangle2D.Float rect = new Rectangle2D.Float(x, y, 180, 30);
PdfFreeTextAnnotation textAnnotation = new PdfFreeTextAnnotation(rect);

// set the annotation text, font and format
textAnnotation.setMarkupText("The definition of Cashless Society");
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 0, 12));
;
textAnnotation.setFont(font);
PdfAnnotationBorder border = new PdfAnnotationBorder(0.5f);
textAnnotation.setBorder(border);
textAnnotation.setBorderColor(new PdfRGBColor(Color.pink));
textAnnotation.setColor(new PdfRGBColor(Color.YELLOW));
textAnnotation.setOpacity(0.75f);
textAnnotation.setTextMarkupColor(new PdfRGBColor(Color.black));

//add the annotation to the PDF page
page.getAnnotationsWidget().add(textAnnotation);

//Save the document to file
doc.saveToFile("output/FreeTextAnnotation.pdf");
doc.close();
}
}

Output

Delete annotations in PDF

Free Spire.PDF for Java not only supports deleting a specified annotation but also it supports removing

all the annotations at one time.

import com.spire.pdf.*;
public class DeleteAnnotation {
public static void main(String[] args) {
//Load the sample PDF file
PdfDocument document = new PdfDocument();
document.loadFromFile("C:\\Users\\Test1\\Desktop\\Test.pdf");

////Remove the first annotation from the first page of PDF
//document.getPages().get(0).getAnnotationsWidget().removeAt(0);

//Remove all annotations
document.getPages().get(0).getAnnotationsWidget().clear();

String result = "output/deleteAllAnnotations.pdf";

//Save the document
document.saveToFile(result);
}
}

Wednesday, 16 June 2021

Find and Highlight Text in PowerPoint documents using Java

This article will introduce how to find and highlight specified text in a PowerPoint slide using Java codes. It’s worth mentioning that I used a free third-party library called Free Spire.Presentation for Java. Before running codes, we need to add a Jar file called Spire.Presentantion.jar in the library to Intellij IDEA. You can download the package from the link, find the Jar file in the “lib” folder and add it to IDEA. Or directly refer to it by using the following Maven configurations.

<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.presentation.free</artifactId>
<version>3.9.0</version>
</dependency>
</dependencies>

Using the code

import com.spire.presentation.FileFormat;
import com.spire.presentation.IAutoShape;
import com.spire.presentation.Presentation;
import com.spire.presentation.TextHighLightingOptions;
import java.awt.*;

public class SearchAndHighlightText {
public static void main(String[] args) throws Exception {
//Create a Presentation instance
Presentation presentation = new Presentation();
//Load a PowerPoint document
presentation.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.pptx");

//Get the first shape on the first slide
IAutoShape shape = (IAutoShape) presentation.getSlides().get(0).getShapes().get(0);

//Set highlight options
TextHighLightingOptions options = new TextHighLightingOptions();
options.setWholeWordsOnly(true);
options.setCaseSensitive(false);

//Highlight text
shape.getTextFrame().highLightText("nose", Color.yellow, options);

//Save the resulting document
presentation.saveToFile("output/HighlightSpecifiedText.pptx", FileFormat.PPTX_2013);
}
}

Output



Friday, 11 June 2021

Add Footnotes and Endnotes to Word documents in Java

In a Word document, footnotes appear at the bottom of the page while endnotes come at the end of the document. A number on the footnote or endnote matches up with a reference mark in the document. This article will introduce how to add a footnote for a specified paragraph or text string in a Word document, and also show how to insert a endnote for a specified paragraph. It’s worth mentioning that I’ll finish the opration above using Java codes without Microsoft Office installed.

Development Environment

First of all, we need to download and install JDK and Intellij IDEA so that the development environment can be created. And then we add a Jar file called Spire.Doc.jar which is located in a free third-party library called Free Spire.Doc for Java to Intellij IDEA. You can get it from the link or refer to it by using the following Maven configuration.

<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.doc.free</artifactId>
<version>3.9.0</version>
</dependency>
</dependencies>

Using the code

Add a footnote for a specified paragraph in Word

import com.spire.doc.*;
import com.spire.doc.documents.*;
import com.spire.doc.fields.*;
import java.awt.*;

public class AddFootNoteForParagraph {
public static void main(String[] args) {
//Load a Word document
Document doc = new Document();
doc.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.docx", FileFormat.Docx_2010);

//get the fifth paragraph of the first section
Paragraph para = doc.getSections().get(0).getParagraphs().get(4);

//Add footnote for the fifth paragraph
Footnote footnote = para.appendFootnote(FootnoteType.Footnote);

//Set font size, font color and font name for the content of the footnote
TextRange text = footnote.getTextBody().addParagraph().appendText("The Definition of Cashless Society");
text.getCharacterFormat().setFontName("Arial Black");
text.getCharacterFormat().setFontSize(10);
text.getCharacterFormat().setTextColor(new Color(180, 11, 255));

//set the format for footnote marker
footnote.getMarkerCharacterFormat().setFontName("Calibri");
footnote.getMarkerCharacterFormat().setFontSize(12);
footnote.getMarkerCharacterFormat().setBold(true);
footnote.getMarkerCharacterFormat().setTextColor(new Color(10, 6, 139));

// save the resulting document
doc.saveToFile("output/AddFootnoteToParagraph.docx", FileFormat.Docx_2010);
}
}

Output


Add a footnote for a specified text string in Word

import com.spire.doc.*;
import com.spire.doc.documents.*;
import com.spire.doc.fields.*;
import java.awt.*;

public class AddFootNoteForText {
public static void main(String[] args) {
//load a Word document
Document doc = new Document();
doc.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.docx", FileFormat.Docx_2010);

//find the text string "Cashless Society" in the whole document
TextSelection[] selections = doc.findAllString("Cashless Society", false, true);
for (TextSelection selection : selections) {
TextRange range = selection.getAsOneRange();
Paragraph para = range.getOwnerParagraph();

//Add footnote behind the searched text strings
Footnote footnote = para.appendFootnote(FootnoteType.Footnote);
int index = para.getChildObjects().indexOf(range);

para.getChildObjects().insert(index + 1, footnote);

//Set font color, font name and font size for the content of the footnote
TextRange text = footnote.getTextBody().addParagraph().appendText("The Tech in Cashless Society");
text.getCharacterFormat().setFontName("Arial Black");
text.getCharacterFormat().setFontSize(10);
text.getCharacterFormat().setTextColor(new Color(255, 140, 0));
//set the format for footnote marker
footnote.getMarkerCharacterFormat().setFontName("Calibri");
footnote.getMarkerCharacterFormat().setFontSize(12);
footnote.getMarkerCharacterFormat().setBold(true);
footnote.getMarkerCharacterFormat().setTextColor(new Color(0, 0, 139));

// save the resulting document
doc.saveToFile("output/AddFootnoteForText.docx", FileFormat.Docx_2010);

}
}
}

Output

Add a endnote for a specified paragraph in Word

import com.spire.doc.*;
import com.spire.doc.documents.Paragraph;
import com.spire.doc.fields.Footnote;
import com.spire.doc.fields.TextRange;
import java.awt.*;

public class AddEndNote {
public static void main(String[] args) {
//Load a Word document
Document doc = new Document();
doc.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.docx");

//Get the first section
Section section = doc.getSections().get(0);

//Get the specific paragraph to add Endnote
Paragraph paragraph = section.getParagraphs().get(2);

//Add an Endnote
Footnote endnote = paragraph.appendFootnote(FootnoteType.Endnote);

//Set the content of the Endnote
TextRange textRange = endnote.getTextBody().addParagraph().appendText("This is an Endnote sample");

//Set font name, font size and font color for the content
textRange.getCharacterFormat().setFontName("Arial");
textRange.getCharacterFormat().setFontSize(14f);
textRange.getCharacterFormat().setTextColor(Color.RED);

//Save the resulting document
doc.saveToFile("output/AddEndnote.docx", FileFormat.Docx_2013);
}
}

Output





Monday, 7 June 2021

Find, Highlight and Replace Data in Excel worksheets using Java

Today, I’ll introduce how to find and highlight/replace data in Excel using Java codes. First of all, we need to add a Jar file which is included into a free third-party library called Free Spire.XLS for Java to Intellij IDEA. You can get it from the link, or directly refer to it by using the following Maven configurations.

<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.xls.free</artifactId>
<version>3.9.1</version>
</dependency>
</dependencies>

Find and Highlight Data in Excel

import com.spire.xls.*;
import java.awt.*;


public class HighlightData {
public static void main(String[] args) {
//Load the sample document
Workbook workbook = new Workbook();
workbook.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.xlsx");

//Get the first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);

//Find the text string "China"
CellRange[] ranges = worksheet.findAllString("China", true, true);

for (CellRange range : ranges)
{
//Set the color to highlight the text
range.getCellStyle().setColor(Color.yellow);
}

//Save the document to file
workbook.saveToFile("output/HighlightData.xlsx", ExcelVersion.Version2010);
}
}

Output


Find and Replace Data in Excel

import com.spire.xls.CellRange;
import com.spire.xls.ExcelVersion;
import com.spire.xls.Workbook;
import com.spire.xls.Worksheet;

public class ReplaceData {
public static void main(String[] args) {
//Create a Workbook instance
Workbook workbook = new Workbook();
//Load the Excel file
workbook.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.xlsx");

//Get the first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);

//Find all the text "Name" in the worksheet
CellRange[] ranges = worksheet.findAllString("Name", true, true);

for (CellRange range : ranges)
{
//Replace the text with new text
range.setText("Country");
}

//Save the resulting file
workbook.saveToFile("output/ReplaceData.xlsx", ExcelVersion.Version2013);
}
}
Output


Thursday, 3 June 2021

Add Text Watermarks or Image Watermarks to PDF documents in Java

A watermark is text or an image which appears behind the existing content of a document, and it is usually used to indicate certain information about the owner of the document, such as name of a company, an organization logo, which can help to prevent the document from being copied or allow others to know where the document is copied from and who owns the right.

In this article, I’ll introduce how to add multiple text watermarks or an image watermark to the specified page of a PDF document using Java codes, and the operation don’t need Adobe Acrobat installed on your project.

Add Spire.Pdf.jar to Intellij IDEA

It’s worth mentioning that I used a free third-party library called Free Spire.PDF for Java in this tutorial and before running codes, we need a Jar file called Spire.Pdf.jar located in the library to Intellij IDEA. There are two methods to add it. One is that download a package from the link, unzip it and find the Jar file in the “lib” folder, finally manually add it to IDEA. The other is that directly use the following Maven configurations in Intellij IDEA to reference it.

<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>3.9.0</version>
</dependency>
</dependencies>

Add multiple text watermarks to PDF

import com.spire.pdf.*;
import com.spire.pdf.graphics.*;
import java.awt.*;
import java.awt.geom.*;

public class TextWatermark {
public static void main(String[] args) {
//create a PdfDocument instance
PdfDocument pdf = new PdfDocument();

//load the sample document
pdf.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.pdf");
//get the first page of the PDF
PdfPageBase page = pdf.getPages().get(0);

//use insertWatermark()to insert the watermark
insertWatermark(page, "CONFIDENTIAL");
//save the resulting document
pdf.saveToFile("output/AddTextWaterMark.pdf");
}

static void insertWatermark(PdfPageBase page, String watermark) {
Dimension2D dimension2D = new Dimension();
dimension2D.setSize(page.getCanvas().getClientSize().getWidth() / 2, page.getCanvas().getClientSize().getHeight() / 3);
PdfTilingBrush brush = new PdfTilingBrush(dimension2D);
brush.getGraphics().setTransparency(0.3F);
brush.getGraphics().save();
brush.getGraphics().translateTransform((float) brush.getSize().getWidth() / 2, (float) brush.getSize().getHeight() / 2);
brush.getGraphics().rotateTransform(-45);
brush.getGraphics().drawString(watermark, new PdfFont(PdfFontFamily.Helvetica, 24), PdfBrushes.getViolet(), 0, 0, new PdfStringFormat(PdfTextAlignment.Center));
brush.getGraphics().restore();
brush.getGraphics().setTransparency(0);
Rectangle2D loRect = new Rectangle2D.Float();
loRect.setFrame(new Point2D.Float(0, 0), page.getCanvas().getClientSize());
page.getCanvas().drawRectangle(brush, loRect);
}
}

Output


Add an image watermark to PDF

import com.spire.pdf.*;
import java.awt.geom.Rectangle2D;
public class ImageWatermark {
public static void main(String[] args) {
//Create a pdf document and load the sample document
PdfDocument doc = new PdfDocument();
doc.loadFromFile("C:\\Users\\Test1\\Desktop\\Sample.pdf");

//Get the first page
PdfPageBase page = doc.getPages().get(0);

//Load the image and set it as background image
page.setBackgroundImage("C:\\Users\\Test1\\Desktop\\logo.png");

//Set the background region
Rectangle2D.Float rect = new Rectangle2D.Float();
rect.setRect(240, 280, 150, 150);
page.setBackgroundRegion(rect);

//Save the resulting file
doc.saveToFile("output/addImageWaterMark.pdf");
doc.close();
}
}

Output




Change PDF Versions in Java

In daily work, you might need to change the version of a PDF document you have in order to ensure compatibility with another version which a...