Skip to content

HTML CSS tips

Per Nyfelt edited this page Apr 11, 2024 · 9 revisions

Paging

When using named page directives, the layout gets distorted due to some issue in flying saucer. You can fix this by adjusting the body as follows (adjust depending on margin/padding settings in the page definition) :

  @page defaultPage {
     size: letter portrait;
     /* give some space for the header and footer, 
        margin right must be 1px or it will be outside 
        of the page (even for non-named pages)*/
     margin: 20px 1px 20px 0;
     padding: 0;
  }
        
  body {
    /* For a5 portrait
      margin-top: 0;
      margin-right: 149.5px;
    */

    /* for a4 portrait
      margin-top: 0;
      margin-right: -85px;       
    */

    /* for letter portrait */
      margin-top: 0;
      margin-right: -107.4px; 
    }

    /* for letter landscape 
      margin-top: 0;
      margin-right: -347px;
    */

    /* for a4 landscape 
      margin-top: 0;
      margin-right: -414px; 
    */

    /* for a5 landscape   
      margin-top: 0;
      margin-right: -86px;
    */

Clone this wiki locally