/** * Adds a link to the current paragraph. * * @since 5.0.6 */ public void processLink() { if (currentParagraph == null) { currentParagraph = new Paragraph(); } // The link provider allows you to do additional processing LinkProcessor i = (LinkProcessor) providers.get(HTMLWorker.LINK_PROVIDER); if (i == null || !i.process(currentParagraph, chain)) { // sets an Anchor for all the Chunks in the current paragraph String href = chain.getProperty(HtmlTags.HREF); if (href != null) { for (Chunk ck : currentParagraph.getChunks()) { ck.setAnchor(href); } } } // a link should be added to the current paragraph as a phrase if (stack.isEmpty()) { // no paragraph to add too, 'a' tag is first element Paragraph tmp = new Paragraph(new Phrase(currentParagraph)); currentParagraph = tmp; } else { Paragraph tmp = (Paragraph) stack.pop(); tmp.add(new Phrase(currentParagraph)); currentParagraph = tmp; } }
/** * Updates the chain with a new tag and new attributes. * * @param tag the new tag * @param attrs the corresponding attributes * @since 5.0.6 */ public void updateChain(final String tag, final Map<String, String> attrs) { chain.addToChain(tag, attrs); }
/** * Updates the chain by removing a tag. * * @param tag the new tag * @since 5.0.6 */ public void updateChain(final String tag) { chain.removeChain(tag); }
/** @see com.itextpdf.text.xml.simpleparser.SimpleXMLDocHandler#startDocument() */ public void startDocument() { HashMap<String, String> attrs = new HashMap<String, String>(); style.applyStyle(HtmlTags.BODY, attrs); chain.addToChain(HtmlTags.BODY, attrs); }