How to add itext library to Java?

1

Good morning community,

I am a beginner in the development of JAVA and I must import ITEXT library.

But I create the library and I add it; but when debugging it continues to generate error ...

I must import

import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.Element;
import static com.itextpdf.text.Element.ALIGN_CENTER;
import com.itextpdf.text.Font;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import java.awt.Desktop;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.stage.Stage;
import sistemanomina.Dialogs;

Someone could help me in some way to solve this error, or help in learning to add libraries. Thanks.

    
asked by Jhonatan cardona 09.07.2018 в 18:02
source

1 answer

-1

First remove the import that is not necessary:

import static com.itextpdf.text.Element.ALIGN_CENTER;

Set up iText in Netbeans

In the case of Netbeans, you must create a project Maven

now selects the file pom.xml of your project since this is where the required dependencies :

Add the dependcías within <project> <dependencies> <dependency> and perform a Build of your project!

Doing this will download the .jar files

Now you can add a class to your project and import the necessary classes without problem:

    
answered by 09.07.2018 в 18:22