2014-10-15 6 views
0

2 개의 단락을 서로 옆에 배치해야합니다.두 단락을 서로 나란히 정렬하는 방법

Document document = new Document(); 

document.SetPageSize(iTextSharp.text.PageSize.A4); 
iTextSharp.text.pdf.draw.LineSeparator line1 = new iTextSharp.text.pdf.draw.LineSeparator(0f, 100f, iTextSharp.text.Color.BLACK, Element.ALIGN_LEFT, 1); 

Paragraph paragraph = new Paragraph("AirNet Network & Datacom Pvt Ltd \n Address :Block no 10 , Bldg no: D/6, \n RK Industrial Park. \n Mumbai -Nasik High Way, \n Thane Dist-42301 \n Tel. No.:022- 1234567890 \n Email: [email protected] \n Url:www.airnetnetworks.com"); 

Paragraph paragraph1 = new Paragraph("AirNet Network & Datacom Pvt Ltd \n Address :Block no 10 , Bldg no: D/6, \n RK Industrial Park. \n Mumbai -Nasik High Way, \n Thane Dist-42301 \n Tel. No.:022- 1234567890 \n Email: [email protected] \n Url:www.airnetnetworks.com"); 

PdfWriter.GetInstance(document, new FileStream("G:\\MySamplePDF.pdf", FileMode.Create)); 
document.Open(); 

document.Add(jpg); 

document.Add(new Chunk(line1)); 
document.Add(paragraph); 

paragraph1.Alignment = Element.ALIGN_RIGHT; 

document.Add(paragraph1); 

document.Close(); 
+0

가능한 [Itextsharp 한 행에 두 개의 열에 데이터 표시] (http://stackoverflow.com/questions/1471475/itextsharp-display-data-in-two-columns-in-a-singlerow) –

답변

0

당신은 PdfPTable 2 열을 사용할 수 있으며 셀에 각각 Paragraph를 추가합니다.

PdfPTable table = new PdfPTable(2); 
table.DefaultCell.BorderWidth = 0; 
table.AddCell(paragraph); 
table.AddCell(paragraph1); 
document.Add(table); 

ColumnText도 사용할 수 있습니다.

관련 문제