Hey, i found the solution how to get indentation worked on pdfs.
Made changes to 2 files: HTMLWorker.java and FactoryProperties.java
HTMLWorker.java
protected Stack blockQuoteStack = new Stack();
protected float indentSpace = 0.0f;
public void startElement(String tag, HashMap h) {
// modified the tag checked for "p"
if (tag.equals("p")) {
if(blockQuoteStack !=null && blockQuoteStack.size() > 0){
for(int k=blockQuoteStack.size();k>0;k--){
if(k == blockQuoteStack.size()){
HashMap hmap =
(HashMap)blockQuoteStack.elementAt(k-1);
h.put("indent",hmap.get("indent"));
System.out.println("indent
value:<"+hmap.get("indent")+">");
}
}
}
cprops.addToChain(tag, h);
currentParagraph = FactoryProperties.createParagraph(h);
return;
}
//added new tag check for blockquote
if (tag.equals("blockquote")) {
indentSpace = indentSpace + 40.0f; //give your value for
indented space
h.put("indent",indentSpace);
cprops.addToChain(tag, h);
blockQuoteStack.push(h);
return;
}
}
public void endElement(String tag) {
//add tag end fpr blockquote
if (tag.equals("blockquote")) {
cprops.removeChain(tag);
blockQuoteStack.pop();
return;
}
}
//added blockquote in the tagssupported list
public static final String tagsSupportedString = "ol ul li a pre font span
br p div body table td th tr i b u sub sup em strong"
+ " h1 h2 h3 h4 h5 h6 img blockquote";
FactoryProperties.java
public static Paragraph createParagraph(HashMap props) {
// add code to check if indent property is set
float indent = 0;
if(props.get("indent") != null){
indent = (Float)props.get("indent");
p.setIndentationLeft(indent);
}
}
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Blockquote-not-supported-by-HTMLWorker-tp2234092p2247069.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/