@Override public void writeHeader() throws IOException {
  os=new PDFWriter(new BufferedOutputStream(ros),PDF_VERSION);
  delayImageQueue=new PDFImageDelayQueue(os);
  delayPaintQueue=new PDFPaintDelayQueue(os,delayImageQueue);
  fontTable=new PDFFontTable(os);
  PDFDocInfo info=os.openDocInfo("DocInfo");
  info.setTitle(getProperty(TITLE));
  info.setAuthor(getProperty(AUTHOR));
  info.setSubject(getProperty(SUBJECT));
  info.setKeywords(getProperty(KEYWORDS));
  info.setCreator(getCreator());
  info.setProducer(producer == null ? "" : producer);
  if (!isDeviceIndependent()) {
    Calendar now=Calendar.getInstance();
    info.setCreationDate(now);
    info.setModificationDate(now);
  }
  info.setTrapped("False");
  os.close(info);
  PDFCatalog catalog=os.openCatalog("Catalog","RootPage");
  catalog.setOutlines("Outlines");
  catalog.setPageMode("UseOutlines");
  catalog.setViewerPreferences("Preferences");
  catalog.setOpenAction(new Object[]{os.ref("Page1"),os.name("Fit")});
  os.close(catalog);
  PDFViewerPreferences prefs=os.openViewerPreferences("Preferences");
  prefs.setFitWindow(true);
  prefs.setCenterWindow(false);
  os.close(prefs);
  alphaIndex=1;
  extGStates=new HashMap<Float,String>();
  if (!isMultiPage()) {
    openPage(getSize(),null);
  }
}

@ Override public void writeHeader ( ) throws IOException { os = new PDFWriter ( new BufferedOutputStream ( ros ) , PDF_VERSION ) ; delayImageQueue = new PDFImageDelayQueue ( os ) ; delayPaintQueue = new PDFPaintDelayQueue ( os , delayImageQueue ) ; fontTable = new PDFFontTable ( os ) ; PDFDocInfo info = os . openDocInfo ( "DocInfo" ) ; info . setTitle ( getProperty ( TITLE ) ) ; info . setAuthor ( getProperty ( AUTHOR ) ) ; info . setSubject ( getProperty ( SUBJECT ) ) ; info . setKeywords ( getProperty ( KEYWORDS ) ) ; info . setCreator ( getCreator ( ) ) ; info . setProducer ( producer == null ? "" : producer ) ; if ( ! isDeviceIndependent ( ) ) { Calendar now = Calendar . getInstance ( ) ; info . setCreationDate ( now ) ; info . setModificationDate ( now ) ; } info . setTrapped ( "False" ) ; os . close ( info ) ; PDFCatalog catalog = os . openCatalog ( "Catalog" , "RootPage" ) ; catalog . setOutlines ( "Outlines" ) ; catalog . setPageMode ( "UseOutlines" ) ; catalog . setViewerPreferences ( "Preferences" ) ; catalog . setOpenAction ( new Object [ ] { os . ref ( "Page1" ) , os . name ( "Fit" ) } ) ; os . close ( catalog ) ; PDFViewerPreferences prefs = os . openViewerPreferences ( "Preferences" ) ; prefs . setFitWindow ( true ) ; prefs . setCenterWindow ( false ) ; os . close ( prefs ) ; alphaIndex = 1 ; extGStates = new HashMap < Float , String > ( ) ; if ( ! isMultiPage ( ) ) { openPage ( getSize ( ) , null ) ; } }
writes the catalog , docinfo , preferences , and ( as we use only single page output the page tree .
