Rectangle rectPageSize = new Rectangle(PageSize.A4);//A4纸张
Document document = new Document(rectPageSize, 40, 40, 40, 40);//上、下、左、右间距
try{
String filePath= StaticConfig.getConfig("file_path") +invest.getContractPath();
String folderPath= filePath.substring(0, filePath.lastIndexOf("/") + 1);
File folder= newFile(folderPath);if (!folder.exists()) {
folder.mkdirs();
}
PdfWriter writer= PdfWriter.getInstance(document, newFileOutputStream(filePath));
writer.setPdfVersion(PdfWriter.PDF_VERSION_1_7);
document.addCreationDate();
document.addCreator("rockbb");
document.addTitle("rockbbPDF");
document.addKeywords("export");
document.addSubject("rockbb业务文件");
document.open();
Font yahei9px= FontFactory.getFont("微软雅黑