小编Meh*_*hul的帖子

如何在itext中将页面大小设置为欧洲A4

我使用以下代码合并pdf.但它给了我一个保证金问题.它在原始文档的顶部,左侧和底部以及较少的边距留下更多边距.我试图设置利润率,但它没有用.请帮我解决这个问题,或者帮助我将页面大小设置为欧洲A4

 public class Pdf_Merge {
  public static void main(String[] args) {
    try {
      List<InputStream> pdfs = new ArrayList<InputStream>();
      pdfs.add(new FileInputStream("file1.pdf"));
      pdfs.add(new FileInputStream("file2.pdf"));
      OutputStream output = new FileOutputStream("Output_file.pdf");
      System.out.println("Created");
      Pdf_Merge.concatPDFs(pdfs, output, true);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public static void concatPDFs(List<InputStream> streamOfPDFFiles, OutputStream    
  outputStream, boolean paginate) {

    Document document = new Document(PageSize.A4);
    try {
    List<InputStream> pdfs = streamOfPDFFiles;
    List<PdfReader> readers = new ArrayList<PdfReader>();
    int totalPages = 0;
    Iterator<InputStream> iteratorPDFs = pdfs.iterator();

    // Create Readers for the pdfs.
      while …
Run Code Online (Sandbox Code Playgroud)

java itext

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

itext ×1

java ×1