//# 0 errors, 104 messages
//#
/*
    //#pebblepdfcreationlistener.java:1:1: class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
 * Copyright (c) 2003-2006, Simon Brown
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   - Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *
 *   - Neither the name of Pebble nor the names of its contributors may
 *     be used to endorse or promote products derived from this software
 *     without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package net.sourceforge.pebble.web.listener;

import org.xhtmlrenderer.pdf.ITextRenderer;
import org.xhtmlrenderer.pdf.PDFCreationListener;

import java.util.Properties;
import java.util.Enumeration;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import com.lowagie.text.pdf.PdfName;
import com.lowagie.text.pdf.PdfString;
import com.lowagie.text.pdf.PdfObject;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.PdfDictionary;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Add ability to manipulate PDF output document before it's closed and opened.
 *  
 * Soltuion was adopted from: https://xhtmlrenderer.dev.java.net/servlets/ReadMsg?listName=users&msgNo=1908
 *
 * @author    Alexander Zagniotov
 */
public class PebblePDFCreationListener implements PDFCreationListener {

	/** the log used by this class */
	private static Log log = LogFactory.getLog(PebblePDFCreationListener.class);
    //#pebblepdfcreationlistener.java:64: method: net.sourceforge.pebble.web.listener.PebblePDFCreationListener.net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init
    //#pebblepdfcreationlistener.java:64: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): __Descendant_Table[net/sourceforge/pebble/web/listener/PebblePDFCreationListener]
    //#output(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): __Dispatch_Table.onClose(Lorg/xhtmlrenderer/pdf/ITextRenderer;)V
    //#output(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): __Dispatch_Table.parseMetaTags(Lorg/w3c/dom/Document;)V
    //#output(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): __Dispatch_Table.preOpen(Lorg/xhtmlrenderer/pdf/ITextRenderer;)V
    //#output(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): log
    //#post(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): __Descendant_Table[net/sourceforge/pebble/web/listener/PebblePDFCreationListener] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): __Dispatch_Table.onClose(Lorg/xhtmlrenderer/pdf/ITextRenderer;)V == &onClose
    //#post(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): __Dispatch_Table.parseMetaTags(Lorg/w3c/dom/Document;)V == &parseMetaTags
    //#post(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): __Dispatch_Table.preOpen(Lorg/xhtmlrenderer/pdf/ITextRenderer;)V == &preOpen
    //#post(net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init): init'ed(log)
    //#pebblepdfcreationlistener.java:64: end of method: net.sourceforge.pebble.web.listener.PebblePDFCreationListener.net.sourceforge.pebble.web.listener.PebblePDFCreationListener__static_init
	
	Properties headerTags = null;

	public PebblePDFCreationListener()  {
    //#pebblepdfcreationlistener.java:68: method: void net.sourceforge.pebble.web.listener.PebblePDFCreationListener.net.sourceforge.pebble.web.listener.PebblePDFCreationListener()
    //#input(void net.sourceforge.pebble.web.listener.PebblePDFCreationListener()): this
    //#output(void net.sourceforge.pebble.web.listener.PebblePDFCreationListener()): new Properties(PebblePDFCreationListener#1) num objects
    //#output(void net.sourceforge.pebble.web.listener.PebblePDFCreationListener()): this.headerTags
    //#new obj(void net.sourceforge.pebble.web.listener.PebblePDFCreationListener()): new Properties(PebblePDFCreationListener#1)
    //#post(void net.sourceforge.pebble.web.listener.PebblePDFCreationListener()): this.headerTags == &new Properties(PebblePDFCreationListener#1)
    //#post(void net.sourceforge.pebble.web.listener.PebblePDFCreationListener()): new Properties(PebblePDFCreationListener#1) num objects == 1
		headerTags = new Properties();
	}
    //#pebblepdfcreationlistener.java:70: end of method: void net.sourceforge.pebble.web.listener.PebblePDFCreationListener.net.sourceforge.pebble.web.listener.PebblePDFCreationListener()

	public void parseMetaTags(Document sourceXHTML) {
        
		try {

			NodeList e = sourceXHTML.getDocumentElement().getElementsByTagName("head");
    //#pebblepdfcreationlistener.java:76: method: void net.sourceforge.pebble.web.listener.PebblePDFCreationListener.parseMetaTags(Document)
    //#pebblepdfcreationlistener.java:76: Warning: method not available
    //#    -- call on Element org.w3c.dom.Document:getDocumentElement()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void parseMetaTags(Document)
    //#    unanalyzed callee: Element org.w3c.dom.Document:getDocumentElement()
    //#pebblepdfcreationlistener.java:76: Warning: method not available
    //#    -- call on NodeList org.w3c.dom.Element:getElementsByTagName(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void parseMetaTags(Document)
    //#    unanalyzed callee: NodeList org.w3c.dom.Element:getElementsByTagName(String)
    //#input(void parseMetaTags(Document)): log
    //#input(void parseMetaTags(Document)): sourceXHTML
    //#input(void parseMetaTags(Document)): this
    //#input(void parseMetaTags(Document)): this.headerTags
    //#pre[1] (void parseMetaTags(Document)): (soft) log != null
    //#pre[2] (void parseMetaTags(Document)): (soft) sourceXHTML != null
    //#pre[4] (void parseMetaTags(Document)): (soft) this.headerTags != null
    //#presumption(void parseMetaTags(Document)): org.w3c.dom.Document:getDocumentElement(...)@76 != null
    //#presumption(void parseMetaTags(Document)): org.w3c.dom.Element:getAttribute(...)@83 != null
    //#presumption(void parseMetaTags(Document)): org.w3c.dom.Element:getAttribute(...)@84 != null
    //#presumption(void parseMetaTags(Document)): org.w3c.dom.Element:getElementsByTagName(...)@76 != null
    //#presumption(void parseMetaTags(Document)): org.w3c.dom.Element:getElementsByTagName(...)@78 != null
    //#presumption(void parseMetaTags(Document)): org.w3c.dom.NodeList:item(...)@77 != null
    //#presumption(void parseMetaTags(Document)): org.w3c.dom.NodeList:item(...)@82 != null
    //#test_vector(void parseMetaTags(Document)): java.lang.String:length(...)@87: {0}, {1..4_294_967_295}
			Element e1 = (Element) e.item(0);
    //#pebblepdfcreationlistener.java:77: Warning: method not available
    //#    -- call on Node org.w3c.dom.NodeList:item(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void parseMetaTags(Document)
    //#    unanalyzed callee: Node org.w3c.dom.NodeList:item(int)
			NodeList retVal = e1.getElementsByTagName("meta");
    //#pebblepdfcreationlistener.java:78: Warning: method not available
    //#    -- call on NodeList org.w3c.dom.Element:getElementsByTagName(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void parseMetaTags(Document)
    //#    unanalyzed callee: NodeList org.w3c.dom.Element:getElementsByTagName(String)

			for (int i = 0; i < retVal.getLength(); i++) {
    //#pebblepdfcreationlistener.java:80: Warning: method not available
    //#    -- call on int org.w3c.dom.NodeList:getLength()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void parseMetaTags(Document)
    //#    unanalyzed callee: int org.w3c.dom.NodeList:getLength()
					
					Element thisNode = (Element) retVal.item(i);
    //#pebblepdfcreationlistener.java:82: Warning: method not available
    //#    -- call on Node org.w3c.dom.NodeList:item(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void parseMetaTags(Document)
    //#    unanalyzed callee: Node org.w3c.dom.NodeList:item(int)
					String name = thisNode.getAttribute("name");
    //#pebblepdfcreationlistener.java:83: Warning: method not available
    //#    -- call on String org.w3c.dom.Element:getAttribute(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void parseMetaTags(Document)
    //#    unanalyzed callee: String org.w3c.dom.Element:getAttribute(String)
					String content = thisNode.getAttribute("content");
    //#pebblepdfcreationlistener.java:84: Warning: method not available
    //#    -- call on String org.w3c.dom.Element:getAttribute(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void parseMetaTags(Document)
    //#    unanalyzed callee: String org.w3c.dom.Element:getAttribute(String)
				 
					//<meta name="XXXXX" content="XXXXX" />
					if (name.length() != 0 && content.length() != 0) {
						headerTags.setProperty(name,content);
					}
				}
		}
    
		catch (Exception e)  {
				log.warn("Could not parse header meta tags: " + e);
    //#pebblepdfcreationlistener.java:94: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void parseMetaTags(Document)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object)
		}
     }
    //#pebblepdfcreationlistener.java:96: end of method: void net.sourceforge.pebble.web.listener.PebblePDFCreationListener.parseMetaTags(Document)

  
    /**
	 * Called directly before calling open() on the Document. 
	 * That allows you to e.g. modify headers before the document is created.
	 *
	 */
	public void preOpen(ITextRenderer renderer) { 

		try {
			Enumeration e = headerTags.propertyNames();
    //#pebblepdfcreationlistener.java:107: method: void net.sourceforge.pebble.web.listener.PebblePDFCreationListener.preOpen(ITextRenderer)
    //#input(void preOpen(ITextRenderer)): com.lowagie.text.pdf.PdfName.AUTHOR
    //#input(void preOpen(ITextRenderer)): com.lowagie.text.pdf.PdfName.CREATOR
    //#input(void preOpen(ITextRenderer)): com.lowagie.text.pdf.PdfName.KEYWORDS
    //#input(void preOpen(ITextRenderer)): com.lowagie.text.pdf.PdfName.PRODUCER
    //#input(void preOpen(ITextRenderer)): com.lowagie.text.pdf.PdfName.SUBJECT
    //#input(void preOpen(ITextRenderer)): com.lowagie.text.pdf.PdfName.TITLE
    //#input(void preOpen(ITextRenderer)): log
    //#input(void preOpen(ITextRenderer)): renderer
    //#input(void preOpen(ITextRenderer)): this
    //#input(void preOpen(ITextRenderer)): this.headerTags
    //#pre[1] (void preOpen(ITextRenderer)): (soft) log != null
    //#pre[2] (void preOpen(ITextRenderer)): (soft) renderer != null
    //#pre[4] (void preOpen(ITextRenderer)): (soft) this.headerTags != null
    //#presumption(void preOpen(ITextRenderer)): init'ed(com.lowagie.text.pdf.PdfName.AUTHOR)
    //#presumption(void preOpen(ITextRenderer)): init'ed(com.lowagie.text.pdf.PdfName.CREATOR)
    //#presumption(void preOpen(ITextRenderer)): init'ed(com.lowagie.text.pdf.PdfName.KEYWORDS)
    //#presumption(void preOpen(ITextRenderer)): init'ed(com.lowagie.text.pdf.PdfName.PRODUCER)
    //#presumption(void preOpen(ITextRenderer)): init'ed(com.lowagie.text.pdf.PdfName.SUBJECT)
    //#presumption(void preOpen(ITextRenderer)): init'ed(com.lowagie.text.pdf.PdfName.TITLE)
    //#presumption(void preOpen(ITextRenderer)): com.lowagie.text.pdf.PdfWriter:getInfo(...)@137 != null
    //#presumption(void preOpen(ITextRenderer)): java.util.Enumeration:nextElement(...)@134 != null
    //#presumption(void preOpen(ITextRenderer)): java.util.Properties:propertyNames(...)@107 != null
    //#test_vector(void preOpen(ITextRenderer)): java.lang.String:equals(...)@139: {0}, {1}
    //#test_vector(void preOpen(ITextRenderer)): java.lang.String:equals(...)@142: {0}, {1}
    //#test_vector(void preOpen(ITextRenderer)): java.lang.String:equals(...)@145: {0}, {1}
    //#test_vector(void preOpen(ITextRenderer)): java.lang.String:equals(...)@148: {0}, {1}
    //#test_vector(void preOpen(ITextRenderer)): java.lang.String:equals(...)@151: {0}, {1}
    //#test_vector(void preOpen(ITextRenderer)): java.lang.String:equals(...)@154: {0}, {1}
    //#test_vector(void preOpen(ITextRenderer)): org.xhtmlrenderer.pdf.ITextRenderer:getWriter(...)@109: Inverse{null}, Addr_Set{null}

			PdfWriter writer = renderer.getWriter(); 
    //#pebblepdfcreationlistener.java:109: Warning: method not available
    //#    -- call on PdfWriter org.xhtmlrenderer.pdf.ITextRenderer:getWriter()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: PdfWriter org.xhtmlrenderer.pdf.ITextRenderer:getWriter()

			 if (writer == null) {
					 log.warn("PdfWriter is null, not able to set header meta tags to PDF document");
    //#pebblepdfcreationlistener.java:112: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object)
					 return;
			 }

			 /*
					Available versions:
					PdfWriter.VERSION_1_2,
					PdfWriter.VERSION_1_3,
					PdfWriter.VERSION_1_4,  //default
					PdfWriter.VERSION_1_5,
					PdfWriter.VERSION_1_6,
					PdfWriter.VERSION_1_7
				*/
			writer.setPdfVersion(PdfWriter.VERSION_1_5);
    //#pebblepdfcreationlistener.java:125: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfWriter:setPdfVersion(char)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfWriter:setPdfVersion(char)

			//Full compression means that not only page streams are compressed, 
			//but some other objects as well, such as the cross-reference table. 
			//This is only possible since PDF-1.5
			writer.setFullCompression();
    //#pebblepdfcreationlistener.java:130: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfWriter:setFullCompression()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfWriter:setFullCompression()

			while (e.hasMoreElements())  { 

				  String key = (String) e.nextElement() ;
				  PdfString val = new PdfString(headerTags.getProperty(key), PdfObject.TEXT_UNICODE);
    //#pebblepdfcreationlistener.java:135: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfString(String, String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfString(String, String)

				  PdfDictionary dictionary = writer.getInfo();
    //#pebblepdfcreationlistener.java:137: Warning: method not available
    //#    -- call on PdfDictionary com.lowagie.text.pdf.PdfWriter:getInfo()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: PdfDictionary com.lowagie.text.pdf.PdfWriter:getInfo()
				  
				  if (key.equals("title" )) {
						dictionary.put(PdfName.TITLE, val);
    //#pebblepdfcreationlistener.java:140: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
				  }
				  else if (key.equals("author")) {
						dictionary.put(PdfName.AUTHOR, val);  
    //#pebblepdfcreationlistener.java:143: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
				  }
				  else if (key.equals("subject")) {
						dictionary.put(PdfName.SUBJECT, val);  
    //#pebblepdfcreationlistener.java:146: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
				  }
				  else if (key.equals("keywords")) {
						dictionary.put(PdfName.KEYWORDS, val);  
    //#pebblepdfcreationlistener.java:149: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
				  }
				  else if (key.equals("creator")) {
						dictionary.put(PdfName.CREATOR, val);  
    //#pebblepdfcreationlistener.java:152: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
				  }
				  else if (key.equals("producer")) {
						dictionary.put(PdfName.PRODUCER, val);  
    //#pebblepdfcreationlistener.java:155: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfDictionary:put(PdfName, PdfObject)
				  }
				  else  {
						log.warn("Unexpected header meta tag: " + key + ", value: " + val);
    //#pebblepdfcreationlistener.java:158: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object)
				  }
				}
			}
			catch (Exception e)  {
				log.warn("Could not set header meta tags to PDF document: " + e);
    //#pebblepdfcreationlistener.java:163: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void preOpen(ITextRenderer)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object)
			}
	}
    //#pebblepdfcreationlistener.java:165: end of method: void net.sourceforge.pebble.web.listener.PebblePDFCreationListener.preOpen(ITextRenderer)

    public void onClose(ITextRenderer renderer) { 

		PdfWriter writer = renderer.getWriter(); 
    //#pebblepdfcreationlistener.java:169: method: void net.sourceforge.pebble.web.listener.PebblePDFCreationListener.onClose(ITextRenderer)
    //#pebblepdfcreationlistener.java:169: Warning: method not available
    //#    -- call on PdfWriter org.xhtmlrenderer.pdf.ITextRenderer:getWriter()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void onClose(ITextRenderer)
    //#    unanalyzed callee: PdfWriter org.xhtmlrenderer.pdf.ITextRenderer:getWriter()
    //#input(void onClose(ITextRenderer)): log
    //#input(void onClose(ITextRenderer)): renderer
    //#pre[2] (void onClose(ITextRenderer)): renderer != null
    //#pre[1] (void onClose(ITextRenderer)): (soft) log != null
    //#test_vector(void onClose(ITextRenderer)): org.xhtmlrenderer.pdf.ITextRenderer:getWriter(...)@169: Inverse{null}, Addr_Set{null}

		if (writer == null) {
			 log.warn("PdfWriter is null, not able to set header meta tags to PDF document");
    //#pebblepdfcreationlistener.java:172: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:warn(Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void onClose(ITextRenderer)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:warn(Object)
			 return;
		}

		//Display doc title in the title bar instead of filename,
		writer.setViewerPreferences(PdfWriter.DisplayDocTitle);
    //#pebblepdfcreationlistener.java:177: Warning: method not available
    //#    -- call on void com.lowagie.text.pdf.PdfWriter:setViewerPreferences(int)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
    //#    method: void onClose(ITextRenderer)
    //#    unanalyzed callee: void com.lowagie.text.pdf.PdfWriter:setViewerPreferences(int)

	}
    //#pebblepdfcreationlistener.java:179: end of method: void net.sourceforge.pebble.web.listener.PebblePDFCreationListener.onClose(ITextRenderer)
}    //#pebblepdfcreationlistener.java:: end of class: net.sourceforge.pebble.web.listener.PebblePDFCreationListener
