title: Adding Header to existing PDF File using PDFBox
body: <p>I am trying to add a Header to an existing PDF file. It works but the table header in the existing PDF are messed up by the change in the font. If I remove setting the font then the header doesn't show up. Here is my code:</p>
  
  <pre><code>    // the document
      PDDocument doc = null;
      try
      {
          doc = PDDocument.load( file );
  
          List allPages = doc.getDocumentCatalog().getAllPages();
          //PDFont font = PDType1Font.HELVETICA_BOLD;
  
          for( int i=0; i&lt;allPages.size(); i++ )
          {
              PDPage page = (PDPage)allPages.get( i );
              PDRectangle pageSize = page.findMediaBox();
              PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true,true);
              PDFont font = PDType1Font.TIMES_ROMAN;
              float fontSize = 15.0f;
              contentStream.beginText();
              // set font and font size
              contentStream.setFont( font, fontSize);
              contentStream.moveTextPositionByAmount(700, 1150);
              contentStream.drawString( message);
              contentStream.endText();
  
              //contentStream.
              contentStream.close();}
  
          doc.save( outfile );
      }
      finally
      {
          if( doc != null )
          {
              doc.close();
          }
      }
  }`
  </code></pre>