私はpdfを作成しており、ページに水平線を入れる必要があります。誰もそれをする方法を教えてもらえますか?iTextSharpで水平線を表示するには
私のHTMLタグ(<table>....</table>
)を持つXMLファイルがあります。 xml
ファイルの内容全体は、pdf
の作成に使用されるstring
に解析されます。現在、一部のタグはサポートされていません。それらの1つは<hr>
です。したがって、xml
ファイルで使用できる他のタグがあるので、xmlデータを使用してpdfを作成すると line
が表示されます。以下は
任意のより多くの情報が必要な場合は私に知らせてくださいXMLのxontent
<table>
<tr>
<td>
<span>
This is working properly.
</span>
</td>
<tr>
</table>
<table>
<tr>
<td>
<span>
<hr>
This is not working properly.
</span>
</td>
<tr>
</table>
の一例です。
ありがとうございます。以下は、フルを作成し、私はこれが
PdfPTable table = new PdfPTable(1); //Create a new table with one column
PdfPCell cellLeft = new PdfPCell(); //Create an empty cell
StyleSheet style = new StyleSheet(); //Declare a stylesheet
style.LoadTagStyle("h1", "border-bottom", "red"); //Create styles for your html tags which you think will be there in PDFText
List<IElement> objects = HTMLWorker.ParseToList(new StringReader(PDFText),style); //This transforms your HTML to a list of PDF compatible objects
for (int k = 0; k < objects.Count; ++k)
{
cellLeft.AddElement((IElement)objects[k]); //Add these objects to cell one by one
}
table.AddCell(cellLeft);
[ここを見て](http://stackoverflow.com/questイオン/ 5103404/problem-in-drawing-a-line-in-a-pdfファイルを使用したitextsharp)と [ここでも](http://stackoverflow.com/questions/4894329/code-isnt-drawing -a-horizontal-line-in-my-pdf) – Haris
ありがとうHaris。
私はpdf要素作成の背後にあるコードを使用していません。私は簡単なhtmlを表示する必要があります。特に、私はテーブル行の下の境界線だけを表示したい。 – Narendra
どのバージョンのItextsharpを使用していますか? –