ではありません、私は次のようなHTMLがあります。iTextの - PDFが良い
<div align='center' style='height:50px'>
<H1>A Simple Sample Web Page</H1>
<IMG SRC='http://sheldonbrown.com/images/scb_eagle_contact.jpeg'>
<H4>By Sheldon Brown</H4>
<H2>Demonstrating a few HTML features</H2>
</div>
HTML is really a very simple language. '
<P>
'command, which will insert a blank line.If you would like to make a link or
bookmark to this page, the URL is:
<BR>
http://sheldonbrown.com/web_sample1.html
</center>
をしかし、画像ではなく、以下のテキストの背後に表示されます!
どういうところが間違っていますか?
iTextで処理できない場合 - どのライブラリが優れていますか?
これは私のコードです:あなたは、任意のCSSは、このHTMLに適用
// step 1
Document document = new Document();
// step 2
PdfWriter.getInstance(document, new FileOutputStream("C:\\hello-world.pdf"));
document.open();
String content = "<div align='center' style='height:50px'><H1>A Simple Sample Web Page</H1><IMG SRC='http://sheldonbrown.com/images/scb_eagle_contact.jpeg'><H4>By Sheldon Brown</H4><H2>Demonstrating a few HTML features</H2></div>HTML is really a very simple language. '<P>' command, which will insert a blank line.If you would like to make a link or bookmark to this page, the URL is:<BR> http://sheldonbrown.com/web_sample1.html</center>";
// use the snippet for the PDF document
List<Element> objects = HTMLWorker.parseToList(new StringReader(content), null);
for (Element element : objects)
document.add(element);
document.close();
iTextメーリングリストを検索しましたか?ここにはそのミラーがあります:http://itext-general.2136553.n4.nabble.com/ –
多分、あなたのテキストとあなたのイメージを異なるdivタグに入れるべきでしょう。 – Stephan
@Stephan私は2つの異なるタグに入れようとしましたが、それでも動作しません! – Dejell