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 moreInfo = new HashMap();
moreInfo.put("Author", "YourName");
moreInfo.put("Title", "YourTitle");
moreInfo.put("Subject", "YourSubject");
stamp.setMoreInfo(moreInfo);
stamp.close();
} catch (Exception de) {
de.printStackTrace();
}
}
}
itext.zip( 1,748 k)