Hi,
I made some investigations with C#-iText. I found some bugs:
(1)
It is not possible to read a <hr>-command from html-page. The reason is, that
the CarrigeReturn detroyes the currentParagraph. The solution sould be as
follows:
private class HTMLTagProcessor_HR : IHTMLTagProcessor {
public void StartElement(HTMLWorker worker, String tag,
IDictionary<String, String> attrs) {
worker.CarriageReturn();
worker.FlushContent();
worker.PushToStack(worker.CreateLineSeparator(attrs));
worker.ProcessLineSeparator();
}
public void EndElement(HTMLWorker worker, String tag) {
}
}
// HTML-Worker.cs
public void ProcessLineSeparator()
{
if (currentParagraph == null)
return;
if (stack.Count == 0)
return;
IElement obj = stack.Pop();
LineSeparator ls = obj as LineSeparator;
if (ls != null)
{
currentParagraph.Add(ls);
currentParagraph.SpacingAfter += ls.LineWidth;
document.Add(currentParagraph);
currentParagraph = null;
}
else
{
stack.Push(obj);
}
}
(2)
There are problems with the alignment in tables. If you simply write
iTextSharp.text.pdf.PdfPTable table = new PdfPTable(2);
table.TotalWidth = 150;
table.AddCell("First cell");
table.AddCell("Second cell");
table.AddCell("Third cell");
table.AddCell("Fourth cell");
table.CellAt(0, 0).HorizontalAlignment = Element.ALIGN_LEFT;
table.CellAt(0, 1).HorizontalAlignment = Element.ALIGN_CENTER;
table.CellAt(1, 0).HorizontalAlignment = Element.ALIGN_LEFT;
table.CellAt(1, 1).HorizontalAlignment = Element.ALIGN_RIGHT;
document.Add(table);
document.Close();
you do not get the whised result. All the texts in the cells are left-aligned.
The vertical align-line is in the center or the right border of the cell. But
this is not the same, what a HTML-brower do with an alignment.
Could you help to solve these problems
Kind regards
Dr. Matthias Jurek
Softwareentwickler Medizintechnik
Eckert & Ziegler BEBIG GmbH
Robert-Rössle-Str.10
D-13125 Berlin
Germany
Tel. +49 30 94 10 84 - 306
Fax. +49 30 94 10 84 - 650
matthias.ju...@bebig.eu<mailto:rene.burd...@ibt-bebig.eu>
www.bebig.eu<http://www.ibt-bebig.eu/>
Sitz Berlin, Amtsgericht Charlottenburg Reg.-Nr. HRB 42949 B
Geschäftsführer: Dr. Gunnar Mann, Dr. Edgar Löffler
This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any unauthorized
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php