本文整理汇总了Java中com.lowagie.text.DocumentException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentException.getMessage方法的具体用法?Java DocumentException.getMessage怎么用?Java DocumentException.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.DocumentException
的用法示例。
在下文中一共展示了DocumentException.getMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import com.lowagie.text.DocumentException; //导入方法依赖的package包/类
@Override
public void close() throws IOException {
try {
float width = 0;
float[] w = new float[iMaxWidth.length - iHiddenColumns.size()]; int wi = 0;
for (int i = 0; i < iMaxWidth.length; i++)
if (!iHiddenColumns.contains(i)) { width += 15f + iMaxWidth[i]; w[wi++] = iMaxWidth[i]; }
Document document = new Document(new Rectangle(60f + width, 60f + width * 0.75f), 30f, 30f, 30f, 30f);
PdfWriter writer = PdfWriter.getInstance(document, iOutput);
writer.setPageEvent(new PdfEventHandler());
document.open();
iTable.setWidths(w);
document.add(iTable);
document.close();
} catch (DocumentException e) {
throw new IOException(e.getMessage(), e);
}
}
示例2: createPdfDocument
import com.lowagie.text.DocumentException; //导入方法依赖的package包/类
public String createPdfDocument(String fileName, Image image) {
Document document = new Document();
File file = null;
try {
int w = image.getWidth(null);
int h = image.getHeight(null);
file = new File(fileName);
PdfWriter writer = PdfWriter.getInstance(document,
new FileOutputStream(file));
document.open();
PdfContentByte cb = writer.getDirectContent();
PdfTemplate tp = cb.createTemplate(w, h);
Graphics2D g2 = tp.createGraphics(w, h);
g2.setStroke(new BasicStroke(0.1f));
tp.setWidth(w);
tp.setHeight(h);
g2.drawImage(image, 0, 0, w, h, 0, 0, w, h, null);
g2.dispose();
cb.addTemplate(tp, 72, 720 - h);
} catch (DocumentException de) {
return de.getMessage();
} catch (IOException ioe) {
return ioe.getMessage();
}
document.close();
return null;
}