In this program we are going to know what is metadata in pdf.
Metadata is data about something, whether it is an object, person, or any other data. The term has come to mean structured information that feeds into automated processes, and this is the most useful way to think about metadata. Metadata is useful to the people and systems that keeps it, primarily within the context of a particular system. Metadata can take many forms, and metadata records can vary tremendously in richness, creating an array of content management and economic models.
To make a program over this, firstly we need to import some packages. Remember to make this program the first and foremost thing to remember is to place the iText.jar in WEB-INF/lib of your web application. Without this jar our application cannot run. The packages we were talking about are java.io.* for input output, com.lowagie.text.pdf.*, and com.lowagie.text.*. These two package will help us to make and use pdf file in our program.
Now create a file named Comboine2page. Remember the name of the file should be such that the reader can understand what the program is going to perform. Inside the class declare a main method inside which we are going to write the logic of our program.
Firstly make a object of Document class. This class describes a document's page size, margins, and other important attributes. It works as a container for a document's chapters, sections, images, paragraphs, and other content.
Now create a document writer that writes the equivalent syntax for a document's content to a specific OutputStream. PdfWriter.getInstance() creates a PDF document writer that writes PDF syntax to concerned file by a FileOutputStream.
Now open the document by document.open(). Add the method addTitle() to the previously created Document, then also add subject, keywords, creator, author to the already created Document. Create a Paragraph that houses a paragraph of text, tells the PDF document writer to ensure that the Paragraph's text is justified on both sides and adds the Paragraph to the previously created Document. Inside the constructor of Paragraph we have passed one String "Roseindia". At last closes the document by using the document.close(). The closing of the document is important because it flushes and closes the OutputStream instance.
The code of the program is given below:
The output of the program is given below:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.