Java Code Examples for com.lowagie.text.Element#KEYWORDS
The following examples show how to use
com.lowagie.text.Element#KEYWORDS .
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: HtmlWriter.java From gcs with Mozilla Public License 2.0 | 6 votes |
/** * Writes a Metatag in the header. * * @param meta the element that has to be written * @throws IOException */ protected void writeHeader(Meta meta) throws IOException { addTabs(2); writeStart(HtmlTags.META); switch (meta.type()) { case Element.HEADER: write(HtmlTags.NAME, ((Header) meta).getName()); break; case Element.SUBJECT: write(HtmlTags.NAME, HtmlTags.SUBJECT); break; case Element.KEYWORDS: write(HtmlTags.NAME, HtmlTags.KEYWORDS); break; case Element.AUTHOR: write(HtmlTags.NAME, HtmlTags.AUTHOR); break; } write(HtmlTags.CONTENT, HtmlEncoder.encode(meta.getContent())); writeEnd(); }
Example 2
Source File: HtmlWriter.java From itext2 with GNU Lesser General Public License v3.0 | 6 votes |
/** * Writes a Metatag in the header. * * @param meta the element that has to be written * @throws IOException */ protected void writeHeader(Meta meta) throws IOException { addTabs(2); writeStart(HtmlTags.META); switch(meta.type()) { case Element.HEADER: write(HtmlTags.NAME, ((Header) meta).getName()); break; case Element.SUBJECT: write(HtmlTags.NAME, HtmlTags.SUBJECT); break; case Element.KEYWORDS: write(HtmlTags.NAME, HtmlTags.KEYWORDS); break; case Element.AUTHOR: write(HtmlTags.NAME, HtmlTags.AUTHOR); break; } write(HtmlTags.CONTENT, HtmlEncoder.encode(meta.getContent())); writeEnd(); }
Example 3
Source File: PatchRtfDocument.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public RtfBasicElement[] mapElement( Element element ) throws DocumentException { ArrayList<RtfBasicElement> rtfElements = new ArrayList<RtfBasicElement>(); if ( element instanceof RtfBasicElement ) { RtfBasicElement rtfElement = (RtfBasicElement) element; rtfElement.setRtfDocument( rtfDoc ); return new RtfBasicElement[] { rtfElement }; } switch ( element.type() ) { case Element.CHUNK: Chunk chunk = (Chunk) element; if ( chunk.hasAttributes() ) { if ( chunk.getAttributes().containsKey( Chunk.IMAGE ) ) { rtfElements.add( new RtfImage( rtfDoc, chunk.getImage() ) ); } else if ( chunk.getAttributes().containsKey( Chunk.NEWPAGE ) ) { rtfElements.add( new RtfNewPage( rtfDoc ) ); } else if ( chunk.getAttributes().containsKey( Chunk.TAB ) ) { Float tabPos = (Float) ( (Object[]) chunk.getAttributes().get( Chunk.TAB ) )[1]; RtfTab tab = new RtfTab( tabPos.floatValue(), RtfTab.TAB_LEFT_ALIGN ); tab.setRtfDocument( rtfDoc ); rtfElements.add( tab ); rtfElements.add( new RtfChunk( rtfDoc, new Chunk( "\t" ) ) ); } else { rtfElements.add( new RtfChunk( rtfDoc, (Chunk) element ) ); } } else { rtfElements.add( new RtfChunk( rtfDoc, (Chunk) element ) ); } break; case Element.PHRASE: rtfElements.add( new RtfPhrase( rtfDoc, (Phrase) element ) ); break; case Element.PARAGRAPH: rtfElements.add( new RtfParagraph( rtfDoc, (Paragraph) element ) ); break; case Element.ANCHOR: rtfElements.add( new RtfAnchor( rtfDoc, (Anchor) element ) ); break; case Element.ANNOTATION: rtfElements.add( new RtfAnnotation( rtfDoc, (Annotation) element ) ); break; case Element.IMGRAW: case Element.IMGTEMPLATE: case Element.JPEG: rtfElements.add( new RtfImage( rtfDoc, (Image) element ) ); break; case Element.AUTHOR: case Element.SUBJECT: case Element.KEYWORDS: case Element.TITLE: case Element.PRODUCER: case Element.CREATIONDATE: rtfElements.add( new RtfInfoElement( rtfDoc, (Meta) element ) ); break; case Element.LIST: rtfElements.add( new RtfList( rtfDoc, (List) element ) ); // TODO: Testing break; case Element.LISTITEM: rtfElements.add( new RtfListItem( rtfDoc, (ListItem) element ) ); // TODO: Testing break; case Element.SECTION: rtfElements.add( new RtfSection( rtfDoc, (Section) element ) ); break; case Element.CHAPTER: rtfElements.add( new RtfChapter( rtfDoc, (Chapter) element ) ); break; case Element.TABLE: if ( element instanceof Table ) { rtfElements.add( new PatchRtfTable( rtfDoc, (Table) element ) ); } else { rtfElements.add( new PatchRtfTable( rtfDoc, ( (SimpleTable) element ).createTable() ) ); } break; case Element.PTABLE: if ( element instanceof PdfPTable ) { rtfElements.add( new PatchRtfTable( rtfDoc, (PdfPTable) element ) ); } else { rtfElements.add( new PatchRtfTable( rtfDoc, ( (SimpleTable) element ).createTable() ) ); } break; } return rtfElements.toArray( new RtfBasicElement[rtfElements.size()] ); }