com.lowagie.text.DocListener Java Examples

The following examples show how to use com.lowagie.text.DocListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param is The inputsource with the content
* @param tagmap A user defined tagmap
*/
   
   public void go(DocListener document, InputSource is, String tagmap) {
       try {
           parser.parse(is, new SAXmyHandler(document, new TagMap(tagmap)));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #2
Source File: HtmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document the parser will write to
* @param is the InputStream with the content
*/
   
   public void go(DocListener document, InputStream is) {
       try {
           parser.parse(new InputSource(is), new SAXmyHtmlHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #3
Source File: XmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param file the path to a file with the content
* @param tagmap a user defined tagmap
*/
   
   public void go(DocListener document, String file, HashMap tagmap) {
       try {
           parser.parse(file, new SAXmyHandler(document, tagmap));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #4
Source File: XmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document that will listen to the parser
* @param file the path to a file with the content
* @param tagmap a user defined tagmap
*/
   
   public void go(DocListener document, String file, String tagmap) {
       try {
           parser.parse(file, new SAXmyHandler(document, new TagMap(tagmap)));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #5
Source File: XmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param file The path to a file with the content
*/
   
   public void go(DocListener document, String file) {
       try {
           parser.parse(file, new SAXiTextHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #6
Source File: XmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param is the inputsource with the content
* @param tagmap an inputstream to a user defined tagmap
*/
   
   public void go(DocListener document, InputSource is, InputStream tagmap) {
       try {
           parser.parse(is, new SAXmyHandler(document, new TagMap(tagmap)));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #7
Source File: XmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param is The inputsource with the content
* @param tagmap A user defined tagmap
*/
   
   public void go(DocListener document, InputSource is, String tagmap) {
       try {
           parser.parse(is, new SAXmyHandler(document, new TagMap(tagmap)));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #8
Source File: XmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document	The document that will listen to the parser
* @param is	The InputStream with the contents
*/
   
   public void go(DocListener document, InputSource is) {
       try {
           parser.parse(is, new SAXiTextHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #9
Source File: HtmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document the parser will write to
* @param is the Reader with the content
*/
   
   public void go(DocListener document, Reader is) {
       try {
           parser.parse(new InputSource(is), new SAXmyHtmlHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #10
Source File: HtmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document the parser will write to
* @param is the Reader with the content
*/
   
   public void go(DocListener document, Reader is) {
       try {
           parser.parse(new InputSource(is), new SAXmyHtmlHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #11
Source File: HTMLWorker.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/** Creates a new instance of HTMLWorker */
public HTMLWorker(DocListener document) {
	this.document = document;
	cprops = new ChainedProperties();
	String fontName = ServerConfigurationService.getString("pdf.default.font");
	if (StringUtils.isNotBlank(fontName)) {
		FontFactory.registerDirectories();
		if (FontFactory.isRegistered(fontName)) {
			HashMap fontProps = new HashMap();
			fontProps.put(ElementTags.FACE, fontName);
			fontProps.put("encoding", BaseFont.IDENTITY_H);
			cprops.addToChain("face", fontProps);
		}
	}
}
 
Example #12
Source File: XmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param is the inputsource with the content
* @param tagmap a user defined tagmap
*/
   
   public void go(DocListener document, InputSource is, HashMap tagmap) {
       try {
           parser.parse(is, new SAXmyHandler(document, tagmap));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #13
Source File: HtmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document the parser will write to
* @param file the file with the content
*/
   
   public void go(DocListener document, String file) {
       try {
           parser.parse(file, new SAXmyHtmlHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #14
Source File: PdfWriter.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Use this method to get an instance of the <CODE>PdfWriter</CODE>.
 *
 * @return a new <CODE>PdfWriter</CODE>
 * @param document The <CODE>Document</CODE> that has to be written
 * @param os The <CODE>OutputStream</CODE> the writer has to write to.
 * @param listener A <CODE>DocListener</CODE> to pass to the PdfDocument.
 * @throws DocumentException on error
 */

public static PdfWriter getInstance(Document document, OutputStream os, DocListener listener)
throws DocumentException {
    PdfDocument pdf = new PdfDocument();
    pdf.addDocListener(listener);
    document.addDocListener(pdf);
    PdfWriter writer = new PdfWriter(pdf, os);
    pdf.addWriter(writer);
    return writer;
}
 
Example #15
Source File: HtmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document the parser will write to
* @param file the file with the content
*/
   
   public void go(DocListener document, String file) {
       try {
           parser.parse(file, new SAXmyHtmlHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #16
Source File: HtmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document the parser will write to
* @param is the InputSource with the content
*/
   
   public void go(DocListener document, InputSource is) {
       try {
           parser.parse(is, new SAXmyHtmlHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #17
Source File: XmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document	The document that will listen to the parser
* @param is	The InputStream with the contents
*/
   
   public void go(DocListener document, InputSource is) {
       try {
           parser.parse(is, new SAXiTextHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #18
Source File: XmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param file the path to a file with the content
* @param tagmap a user defined tagmap
*/
   
   public void go(DocListener document, String file, HashMap tagmap) {
       try {
           parser.parse(file, new SAXmyHandler(document, tagmap));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #19
Source File: PdfWriter.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Use this method to get an instance of the <CODE>PdfWriter</CODE>.
 *
 * @return a new <CODE>PdfWriter</CODE>
 * @param document The <CODE>Document</CODE> that has to be written
 * @param os The <CODE>OutputStream</CODE> the writer has to write to.
 * @param listener A <CODE>DocListener</CODE> to pass to the PdfDocument.
 * @throws DocumentException on error
 */

public static PdfWriter getInstance(Document document, OutputStream os, DocListener listener) throws DocumentException {
	PdfDocument pdf = new PdfDocument();
	pdf.addDocListener(listener);
	document.addDocListener(pdf);
	PdfWriter writer = new PdfWriter(pdf, os);
	pdf.addWriter(writer);
	return writer;
}
 
Example #20
Source File: XmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document that will listen to the parser
* @param file the path to a file with the content
* @param tagmap a user defined tagmap
*/
   
   public void go(DocListener document, String file, String tagmap) {
       try {
           parser.parse(file, new SAXmyHandler(document, new TagMap(tagmap)));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #21
Source File: HtmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document the parser will write to
* @param is the InputSource with the content
*/
   
   public void go(DocListener document, InputSource is) {
       try {
           parser.parse(is, new SAXmyHtmlHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #22
Source File: XmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param file The path to a file with the content
*/
   
   public void go(DocListener document, String file) {
       try {
           parser.parse(file, new SAXiTextHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #23
Source File: XmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param is the inputsource with the content
* @param tagmap a user defined tagmap
*/
   
   public void go(DocListener document, InputSource is, HashMap tagmap) {
       try {
           parser.parse(is, new SAXmyHandler(document, tagmap));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #24
Source File: XmlParser.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document The document that will listen to the parser
* @param is the inputsource with the content
* @param tagmap an inputstream to a user defined tagmap
*/
   
   public void go(DocListener document, InputSource is, InputStream tagmap) {
       try {
           parser.parse(is, new SAXmyHandler(document, new TagMap(tagmap)));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #25
Source File: HtmlParser.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
* Parses a given file.
* @param document the document the parser will write to
* @param is the InputStream with the content
*/
   
   public void go(DocListener document, InputStream is) {
       try {
           parser.parse(new InputSource(is), new SAXmyHtmlHandler(document));
       }
       catch(SAXException se) {
           throw new ExceptionConverter(se);
       }
       catch(IOException ioe) {
           throw new ExceptionConverter(ioe);
       }
   }
 
Example #26
Source File: SAXiTextHandler.java    From itext2 with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @param document
 * @param myTags
 */
public SAXiTextHandler(DocListener document, HtmlTagMap myTags) {
    this(document);
    this.myTags = myTags;
}
 
Example #27
Source File: SAXiTextHandler.java    From itext2 with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @param document
 * @param myTags
 */
public SAXiTextHandler(DocListener document, HashMap myTags) {
    this(document);
    this.myTags = myTags;
}
 
Example #28
Source File: SAXiTextHandler.java    From itext2 with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @param document
 * @param myTags
 * @param bf
 */
public SAXiTextHandler(DocListener document, HtmlTagMap myTags,
        BaseFont bf){
    this(document, myTags);
    this.bf = bf;
}
 
Example #29
Source File: SAXiTextHandler.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
/**
 * @param document
 * @param myTags
 */
public SAXiTextHandler(DocListener document, HtmlTagMap myTags) {
	this(document);
	this.myTags = myTags;
}
 
Example #30
Source File: SAXiTextHandler.java    From itext2 with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @param document
 */
public SAXiTextHandler(DocListener document) {
    super();
    this.document = document;
    stack = new Stack();
}