RT!  公司丢给我一大难题。 求帮助阿。Table dataTable = null;
。。//下面是一堆往里面加东西的代码,
如果设置这个table对象水印。

解决方案 »

  1.   

      com.lowagie.text.Table; 这个包里面得。
      

  2.   

    ...背景图被 还能是啥 你的类是你自己定义的吧 能不能透露些实现让我们知道你是基于什么类写的Table呢?
      

  3.   

        public static void addContentRouteDetail(Document doc, Map routesheet) {
    int headerBox[] = { 80, 20 };
    Table dataTable = null;
    Cell cell = null; try {
    RouteList routeInfo = null;
    ArrayList routePus = null;
    PublicMethods methods = new PublicMethods();
    routeInfo = (RouteList) routesheet.get("routeBasicInfo");
    routePus = (ArrayList) routesheet.get("routePus");
    dataTable = CommonBlock.createTable(headerBox.length, headerBox,
    Element.ALIGN_LEFT);
    cell = new Cell(new Phrase("路单编号:" + routeInfo.getBsid() + "  "
    + "V" + routeInfo.getVersion(), CommonFont.fChs[1][8]));
    cell.setColspan(2);
    cell.setBorderColor(Color.white);
    dataTable.addCell(cell);
    cell = new Cell(new Phrase("日期:" + routeInfo.getBegindate(),
    CommonFont.fChs[1][8]));
    cell.setBorderColor(Color.white);
    dataTable.addCell(cell);
    cell = new Cell(new Phrase("车型:" + routeInfo.getTrucktype(),
    CommonFont.fChs[1][8]));
    cell.setBorderColor(Color.white);
    dataTable.addCell(cell);
    cell = new Cell(new Phrase("卡车编号:" + routeInfo.getTruckid(),
    CommonFont.fChs[1][8]));
    cell.setBorderColor(Color.white);
    dataTable.addCell(cell);
    cell = new Cell(new Phrase("长:" + routeInfo.getTrucklen()
    + methods.fillChar("", 2, " ") + "宽:"
    + routeInfo.getTruckwth(), CommonFont.fChs[1][8]));
    cell.setBorderColor(Color.white);
    dataTable.addCell(cell);
    cell = new Cell(new Phrase("", CommonFont.fChs[1][8]));
    cell.setBorderColor(Color.white);
    dataTable.addCell(cell);
    cell = new Cell(new Phrase("高:" + routeInfo.getTruckhgt()
    + methods.fillChar("", 2, " ") + "载重量:"
    + routeInfo.getTruckload(), CommonFont.fChs[1][8]));
    cell.setBorderColor(Color.white);
    dataTable.addCell(cell);
    dataTable.setBorderColor(Color.white);
    doc.add(dataTable); CommonBlock.addLogo(doc);

    CommonBlock.addBookSheetBarcode(doc,routeInfo.getBsid()); // 签名
    CommonBlock.addSpacing(doc, "", -15, CommonFont.fChs[0][8]);
    CommonBlock.routeSignature(doc,routeInfo); // 汇总
    CommonBlock.addSpacing(doc, "", -20, CommonFont.fChs[0][8]);
    CommonBlock.routeTotal(doc, routeInfo); // 公里数记录
    CommonBlock.addSpacing(doc, "", -25, CommonFont.fChs[0][8]);
    CommonBlock.mileNote(doc); // routeDetail
    CommonBlock.addSpacing(doc, "", -25, CommonFont.fChs[0][8]);
    CommonBlock.routeDetail(doc, routePus);
    // 备注
    CommonBlock.addSpacing(doc, "", -25, CommonFont.fChs[0][8]);
    CommonBlock.routeRe(doc, routeInfo);
    } catch (Exception ex) {
    ex.printStackTrace();
    }
    }
    就是输出到PDF里面  需求是 在这个位置加个水印的效果  引入的IText.jar 这个包
      

  4.   

    .......误会我的意思了 我是说你现在用的Table类是基于什么东西实现的..