title: How to set metada in PDF being created with FlyingSaucer
body: <p>I'm trying to set the metadata (such as Title or Author) in a PDF file that I'm creating with FlyingSaucer (<a href="https://github.com/flyingsaucerproject/flyingsaucer" rel="nofollow noreferrer">https://github.com/flyingsaucerproject/flyingsaucer</a>) from an HTML file.</p>
  
  <p>Here's the code that creates the PDF file:</p>
  
  <pre><code>    ByteArrayOutputStream out = new ByteArrayOutputStream();
  
      ITextRenderer renderer = new ITextRenderer();
      renderer.getFontResolver().addFont("fonts/VERDANA.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
      renderer.getFontResolver().addFont("fonts/VERDANAB.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
      renderer.getFontResolver().addFont("fonts/VERDANAI.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
      renderer.getFontResolver().addFont("fonts/VERDANAZ.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
      renderer.setDocumentFromString(... HTML as a String ...);
      renderer.layout();
      renderer.createPDF(out);
  
      FileOutputStream fos = new FileOutputStream(pathPdf);
  
      PdfReader reader = new PdfReader(baos.toByteArray());
      PdfStamper stamper = new PdfStamper(reader, fos);
  
      ... sets watermark image if available ...
  
      stamper.close();
      reader.close();
  </code></pre>
  
  <p>I've tried getting the PdfDictionary and setting the metadata, getting the info map and setting the metadata, and getting the Document to set the metadata, but I cannot make it work.</p>