import java.io.FileOutputStream;
import java.util.HashMap;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
public class CopyPDFFileAndAddMetaData {
public static void main(String[] args) {
try {
PdfReader reader = new PdfReader("YourOwnPDF.pdf");
PdfStamper stamp = new PdfStamper(reader,
new FileOutputStream("NewPDFFileFromPdfStamper.pdf"));
HashMap<String, String> moreInfo = new HashMap<String, String>();
moreInfo.put("Author", "YourName");
moreInfo.put("Title", "YourTitle");
moreInfo.put("Subject", "YourSubject");
stamp.setMoreInfo(moreInfo);
stamp.close();
} catch (Exception de) {
de.printStackTrace();
}
}
}
|