如何将若干个pdf文件(包括图像和文字)读取后在统一写入一个pdf文件
    相当于把若干个pdf文件拼接成一个pdf文件.

解决方案 »

  1.   

    没写过,..
    帮你搜了..希望有帮助.http://java-x.blogspot.com/2006/11/merge-pdf-files-with-itext.htmlhttp://www.gnostice.com/nl_article.asp?id=86&t=Merging_And_Splitting_PDF_Documents_Using_PDFOne_Javahttp://www.pdfonline.com/easypdf/sdk/samples/process/merge-pdf/java/java-mergepdf.htm
      

  2.   

    应该会有对应的jar包吧,没做过,建议在SUN的网站上查一查
      

  3.   

    ireport 试试看  只知道他可以 操作 PDF
      

  4.   

    我把思路和部分代码贴出来吧。1 首先分别读取各个PDF文件至一个document对象中(具体实现就是把第二个之后的文件的document的子元素取出放置第一个document对象中);
    2 输出即可(代码如下)。import java.awt.Color;
    import java.io.FileOutputStream;import com.lowagie.text.Cell;
    import com.lowagie.text.Chapter;
    import com.lowagie.text.Document;
    import com.lowagie.text.Font;
    import com.lowagie.text.FontFactory;
    import com.lowagie.text.List;
    import com.lowagie.text.ListItem;
    import com.lowagie.text.PageSize;
    import com.lowagie.text.Paragraph;
    import com.lowagie.text.Section;
    import com.lowagie.text.Table;
    import com.lowagie.text.pdf.PdfWriter;public class PDFWriter { public Chapter pdfWriter(){
    try {

    //initial a document 
    Document document = new Document(PageSize.A4, 50, 50, 50, 50);

    //create pdf writer
    PdfWriter writer = PdfWriter.getInstance(document,
    new FileOutputStream("resource\\example.pdf"));
    document.open();

    //create paragraph object
    document.add(new Paragraph("First page of the document!"));
    document.add(new Paragraph("Some more text on the first page with different color and font type.",
    FontFactory.getFont(FontFactory.COURIER, 14, Font.BOLD, new Color(255, 150, 200))));

    //create chapter object
    Paragraph title1 = new Paragraph("Chapter 1", 
            FontFactory.getFont(FontFactory.HELVETICA,
            18, Font.BOLDITALIC, new Color(0, 0, 255)));
    Chapter chapter1 = new Chapter(title1, 1);
    chapter1.setNumberDepth(0);

    //create section object
    Paragraph title11 = new Paragraph("This is Section 1 in Chapter 1", 
    FontFactory.getFont(FontFactory.HELVETICA, 16,
    Font.BOLD, new Color(255, 0, 0)));
    Section section1 = chapter1.addSection(title11);
    Paragraph someSectionText = new Paragraph("This text comes as part of section 1 of chapter 1.");
    section1.add(someSectionText);
    someSectionText = new Paragraph("Following is a 3 X 2 table.");
    section1.add(someSectionText);

    //create a table object
    Table table = new Table(3,2);
    table.setBorderColor(new Color(220, 255, 100));
    table.setPadding(5);
    table.setSpacing(5);
    table.setBorderWidth(1);

    Cell header1 = new Cell("yao");
    header1.setHeader(true);
    table.addCell(header1);
    Cell header2 = new Cell("tibco");
    header2.setHeader(true);
    table.addCell(header2);
    Cell header3 = new Cell("monkey");
    header3.setHeader(true);
    table.addCell(header3);
    table.endHeaders();

    table.addCell("1.1");
    table.addCell("1.2");
    table.addCell("1.3");
    section1.add(table);

    //create list object
    List list = new List(true, false, 10);
    list.add(new ListItem("First item"));
    list.add(new ListItem("Second item"));
    section1.add(list);

    document.add(chapter1);
    //close document
    document.close();
    return chapter1;
    } catch (Exception e) {
    System.out.println("file output error!");
    e.printStackTrace();
    return null;
    }
    }


    public static void main(String[] args){
    PDFWriter writer = new PDFWriter();
    writer.pdfWriter();
    }
    }