Create PDF using CSS and JAVA

I am creating a PDF consisting of several tables, and I want to know if there is some way by which I can find out if the table will exceed the page size of the PDF or not. I use the information to decide if I will generate PDF in portrait or landscape mode. Is it possible to get this size?

+3
source share
1 answer

know if the table size will exceed the PDF page size

  • The size of the table is determined from your content in the XHTML table (rows, columns, headers and footers, etc.), as well as your documents (width, height and border values).
  • (ITextRenderer) CSS, XHTML .
  • , ITextRenderer , :

    • ITextRenderer, Document renderer.setDocument(), CSS renderer.layout(), .
    • - ,
    • , /. CSS, :
      • CSS,
      • ITextRenderer, Document renderer.setDocument(), CSS renderer.layout(), .
      • PDF renderer.createPDF().

:

  • .
  • . (a) (XHTML) (b) (CSS). , .
  • (2) , , . , , . :.

     BlockBox root = renderer.getRootBox();
     List  pageList = root.getLayer().getPages() 
     PageBox page = (PageBox)pageList.get(2);
     List childBoxList = page.getChildren();
     Box childBox = (Box)childBoxList.get(0);
     // etc... until you locate your table
    
  • (4) ITextRenderer , CSS XHTML. , XHTML, ITextRenderer.

:

  • / - .
  • //
  • , , v . . X, - Y, ,...
  • CSS
  • , XHTML, CSS
+2

All Articles