MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.util.Iterator;
import java.util.Map;

import com.lowagie.text.pdf.PdfReader;

public class MainClass {
    public static void main(String[] args) throws Exception {
        PdfReader reader = new PdfReader("2.pdf");
        Map info = reader.getInfo();
        for (Iterator i = info.keySet().iterator(); i.hasNext();) {
            String key = (String) i.next();
            String value = (String) info.get(key);
            System.out.println(key + ": " + value);
        }
        if (reader.getMetadata() == null) {
            System.out.println("No XML Metadata.");
        } else {
            System.out.println("XML Metadata: " + new String(reader.getMetadata()));
        }
    }

}