使用itextpdf删除空格

时间:2015-03-17 09:20:27

标签: java itext itextpdf

我正在将html数据转换为pdf,但是我得到了一些空白,其中会插入一些大数据,我想要删除空白以便跟踪数据

注意:标题来自jasper报告

'Document document = new Document(PageSize.A4, 40, 72, getMargins(1),20);`

document.setMarginMirroringTopBottom(true);`

String path = dao.gettomcatserverPath1() + "webapps/wordimages/disch" +patid+ ".pdf";`        

PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(path));
`String html = "";
List list1 = dao.executeQuery("select wordole from ip.dischargetemplate where patid='"+patid+"'");

html = ((Map)list1.get(0)).get("WORDOLE").toString();

InputStream _ishtml = new ByteArrayInputStream(html.getBytes());

HeaderFooter event = new HeaderFooter();`
writer.setPageEvent(event);`

writer.setBoxSize("art", new Rectangle(36, 54, 559, 788));`

document.open();`
Font font = FontFactory.getFont("Times-Roman");

XMLWorkerHelper.getInstance().parseXHtml(writer, document, _ishtml);`

document.close();`

0 个答案:

没有答案