Itextsharp를 사용한 MVC3 VB.NET 응용 프로그램입니다. 나는 pdf 파일을 생성하는 코드 섹션을 가지고 있지만 모든 것이 멋지지만 그 값을보고있는 사람이 쉽게 따라갈 수 있도록 2 색 사이의 pdf 파일에서 선 색상을 교체하고 싶습니다. 글꼴 크기를 기준으로 전체 줄의 배경색을 설정된 색으로 설정할 수 있습니까? 나는이에서를 사용하는 것입니다 함수는 다음과 같습니다 :Contentbyte의 배경색 설정 itextsharp
For Each _reg_ In _reg
Dim _registrant As reg_info = _reg_
If y_line1 <= 30 Then
doc.NewPage()
_Page = _Page + 1
y_line1 = 670
End If
If y_line1 = 670 Then
cb.BeginText()
cb.SetFontAndSize(BF_Times, 6)
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, _datePrinted + " " + _timePrinted, 500, 770, 0)
cb.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, "Page Number" + " " + _Page, 600, 770, 0)
cb.SetFontAndSize(BF_Times, 8)
cb.ShowTextAligned(PdfContentByte.ALIGN_CENTER, _reportHead + " Overrides ", 304, 720, 0)
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "First Name", 20, 700, 0)
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "Last Name", 80, 700, 0)
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "Last Four", 160, 700, 0)
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "Email Address", 300, 700, 0)
cb.EndText()
End If
cb.BeginText()
cb.SetFontAndSize(BF_Times, 8)
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, _registrant.first_name, 20, y_line1, 0)
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, _registrant.last_name, 80, y_line1, 0)
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, _registrant.last_four_social, 160, y_line1, 0)
cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, _registrant.email, 300, y_line1, 0)
_total += 1
cb.EndText()
y_line1 = y_line1 - 15
Next
가 난 그냥 y_line1를 사용하고 색상은 회색 또는 백색 여부를 결정하는 계수를 사용하여 라인의 배경 색상을 설정하는 방법에 대한 생각했다. 하지만 전체 라인 배경색을 설정하는 방법에 대한 코드 샘플은 어디에도 없습니다.