本文整理匯總了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;
}