List of usage examples for com.lowagie.text ElementTags ALIGN
String ALIGN
To view the source code for com.lowagie.text ElementTags ALIGN.
Click Source Link
From source file:org.apache.maven.doxia.module.itext.ITextSink.java
License:Apache License
/** {@inheritDoc} */ public void body() { if (writeStart) { writeStartElement(ElementTags.ITEXT); writeAddAttribute(ElementTags.TITLE, header.getTitle()); writeAddAttribute(ElementTags.AUTHOR, header.getAuthors()); writeAddAttribute(ElementTags.CREATIONDATE, header.getDate()); writeAddAttribute(ElementTags.SUBJECT, header.getTitle()); writeAddAttribute(ElementTags.KEYWORDS, ""); writeAddAttribute(ElementTags.PRODUCER, "Generated with Doxia by " + System.getProperty("user.name")); writeAddAttribute(ElementTags.PAGE_SIZE, ITextUtil.getPageSize(ITextUtil.getDefaultPageSize())); writeStartElement(ElementTags.CHAPTER); writeAddAttribute(ElementTags.NUMBERDEPTH, numberDepth); writeAddAttribute(ElementTags.DEPTH, depth); writeAddAttribute(ElementTags.INDENT, "0.0"); writeStartElement(ElementTags.TITLE); writeAddAttribute(ElementTags.LEADING, DEFAULT_CHAPTER_TITLE_LEADING); writeAddAttribute(ElementTags.FONT, ITextFont.DEFAULT_FONT_NAME); writeAddAttribute(ElementTags.SIZE, ITextFont.getSectionFontSize(0)); writeAddAttribute(ElementTags.STYLE, ITextFont.BOLD); writeAddAttribute(ElementTags.BLUE, ITextFont.DEFAULT_FONT_COLOR_BLUE); writeAddAttribute(ElementTags.GREEN, ITextFont.DEFAULT_FONT_COLOR_GREEN); writeAddAttribute(ElementTags.RED, ITextFont.DEFAULT_FONT_COLOR_RED); writeAddAttribute(ElementTags.ALIGN, ElementTags.ALIGN_CENTER); // startChunk( ITextFont.DEFAULT_FONT_NAME, ITextFont.getSectionFontSize( 0 ), // ITextFont.BOLD, ITextFont.DEFAULT_FONT_COLOR_BLUE, ITextFont.DEFAULT_FONT_COLOR_GREEN, // ITextFont.DEFAULT_FONT_COLOR_RED, "top" ); writeStartElement(ElementTags.CHUNK); writeAddAttribute(ElementTags.FONT, ITextFont.DEFAULT_FONT_NAME); writeAddAttribute(ElementTags.SIZE, ITextFont.getSectionFontSize(0)); writeAddAttribute(ElementTags.STYLE, ITextFont.BOLD); writeAddAttribute(ElementTags.BLUE, ITextFont.DEFAULT_FONT_COLOR_BLUE); writeAddAttribute(ElementTags.GREEN, ITextFont.DEFAULT_FONT_COLOR_GREEN); writeAddAttribute(ElementTags.RED, ITextFont.DEFAULT_FONT_COLOR_RED); // writeAddAttribute( ElementTags.LOCALDESTINATION, "top" ); write(header.getTitle());/*from w w w . j a v a 2 s.c o m*/ writeEndElement(); // ElementTags.CHUNK writeEndElement(); // ElementTags.TITLE } actionContext.setAction(SinkActionContext.BODY); }
From source file:org.apache.maven.doxia.module.itext.ITextSink.java
License:Apache License
/** {@inheritDoc} */ public void table_() { if (tableCaptionXMLWriter != null) { tableCaptionXMLWriter = null;//from ww w. ja v a2s.c o m writeEndElement(); // ElementTags.TABLE writeEndElement(); // ElementTags.CHUNK writeStartElement(ElementTags.PARAGRAPH); writeAddAttribute(ElementTags.ALIGN, ElementTags.ALIGN_CENTER); write(tableCaptionWriter.toString(), true); writeEndElement(); // ElementTags.PARAGRAPH tableCaptionWriter = null; } else { writeEndElement(); // ElementTags.TABLE writeEndElement(); // ElementTags.CHUNK } actionContext.release(); }
From source file:org.apache.maven.doxia.module.itext.ITextSink.java
License:Apache License
/** {@inheritDoc} */ public void table() { writeStartElement(ElementTags.CHUNK); writeAddAttribute(ElementTags.FONT, font.getFontName()); writeAddAttribute(ElementTags.SIZE, font.getFontSize()); writeAddAttribute(ElementTags.STYLE, font.getFontStyle()); writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue()); writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen()); writeAddAttribute(ElementTags.RED, font.getFontColorRed()); writeStartElement(ElementTags.TABLE); writeAddAttribute(ElementTags.LEFT, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.RIGHT, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.TOP, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.BOTTOM, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.ALIGN, ElementTags.ALIGN_CENTER); writeAddAttribute(ElementTags.WIDTH, "100.0%"); writeAddAttribute(ElementTags.TABLEFITSPAGE, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.CELLSFITPAGE, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.CELLPADDING, "10"); //writeAddAttribute( ElementTags.COLUMNS, "2" ); actionContext.setAction(SinkActionContext.TABLE); }
From source file:org.apache.maven.doxia.module.itext.ITextSink.java
License:Apache License
/** {@inheritDoc} */ public void verbatim(boolean boxed) { // Always boxed writeStartElement(ElementTags.CHUNK); writeAddAttribute(ElementTags.FONT, font.getFontName()); writeAddAttribute(ElementTags.SIZE, font.getFontSize()); writeAddAttribute(ElementTags.STYLE, font.getFontStyle()); writeAddAttribute(ElementTags.BLUE, font.getFontColorBlue()); writeAddAttribute(ElementTags.GREEN, font.getFontColorGreen()); writeAddAttribute(ElementTags.RED, font.getFontColorRed()); writeStartElement(ElementTags.TABLE); writeAddAttribute(ElementTags.COLUMNS, "1"); writeAddAttribute(ElementTags.LEFT, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.RIGHT, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.TOP, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.BOTTOM, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.ALIGN, ElementTags.ALIGN_CENTER); writeAddAttribute(ElementTags.TABLEFITSPAGE, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.CELLSFITPAGE, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.CELLPADDING, "10"); writeAddAttribute(ElementTags.WIDTH, "100.0%"); writeStartElement(ElementTags.ROW);/*w w w . j av a2 s . co m*/ writeStartElement(ElementTags.CELL); writeAddAttribute(ElementTags.LEFT, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.RIGHT, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.TOP, Boolean.TRUE.toString()); writeAddAttribute(ElementTags.BOTTOM, Boolean.TRUE.toString()); actionContext.setAction(SinkActionContext.VERBATIM); }
From source file:org.apache.maven.doxia.module.itext.ITextSink.java
License:Apache License
/** * If the <code>name</code> is a relative link, the internal link will used a System property * <code>itext.basedir</code>, or the class loader. * {@inheritDoc}/* w w w.jav a2 s. c o m*/ */ public void figureGraphics(String name) { String urlName = null; File nameFile = null; if ((name.toLowerCase(Locale.ENGLISH).startsWith("http://")) || (name.toLowerCase(Locale.ENGLISH).startsWith("https://"))) { urlName = name; } else { if (System.getProperty("itext.basedir") != null) { try { nameFile = new File(System.getProperty("itext.basedir"), name); urlName = nameFile.toURI().toURL().toString(); } catch (MalformedURLException e) { getLog().error("MalformedURLException: " + e.getMessage(), e); } } else { if (getClassLoader() != null) { if (getClassLoader().getResource(name) != null) { urlName = getClassLoader().getResource(name).toString(); } } else { if (ITextSink.class.getClassLoader().getResource(name) != null) { urlName = ITextSink.class.getClassLoader().getResource(name).toString(); } } } } if (urlName == null) { String msg = "No image '" + name + "' found in the class loader. Try to call setClassLoader(ClassLoader) before."; logMessage("imageNotFound", msg); return; } if (nameFile != null && !nameFile.exists()) { String msg = "No image '" + nameFile + "' found in your system, check the path."; logMessage("imageNotFound", msg); return; } boolean figureCalled = figureDefined; if (!figureCalled) { figure(); } float width = 0; float height = 0; try { Image image = Image.getInstance(new URL(urlName)); image.scaleToFit(ITextUtil.getDefaultPageSize().width() / 2, ITextUtil.getDefaultPageSize().height() / 2); width = image.plainWidth(); height = image.plainHeight(); } catch (BadElementException e) { getLog().error("BadElementException: " + e.getMessage(), e); } catch (MalformedURLException e) { getLog().error("MalformedURLException: " + e.getMessage(), e); } catch (IOException e) { getLog().error("IOException: " + e.getMessage(), e); } writeAddAttribute(ElementTags.URL, urlName); writeAddAttribute(ElementTags.ALIGN, ElementTags.ALIGN_MIDDLE); writeAddAttribute(ElementTags.PLAINWIDTH, String.valueOf(width)); writeAddAttribute(ElementTags.PLAINHEIGHT, String.valueOf(height)); actionContext.setAction(SinkActionContext.FIGURE_GRAPHICS); if (!figureCalled) { figure_(); } }