我想使用iText填充文本字段的顏色。我試過setfieldproperty,它不適用於bgcolor或填充顏色屬性。我所尋找的是文本字段的屬性設置,因爲它會被覆蓋現有的文本或圖像使用iText填充文本字段背景
我已經試過夫婦在結束的情況下..
' Create a new PDF reader based on the PDF template document
Dim pdfReaderBG As PdfReader = New PdfReader(pdfTemplate) ' Page of Fields
Dim pdfReaderFG As PdfReader = New PdfReader(pdfExisting) ' Image from CD Image
'Create the stream for the new PDF Document with the BackGround PDf
Dim writer As PdfStamper = New PdfStamper(pdfReaderBG, New FileStream("c:\temp\CDs\newMerge.pdf", FileMode.Create))
'Get all the content of the page
Dim content_Byte As PdfContentByte = writer.GetUnderContent(1)
'Then get the Other PDF to overlay the other
Dim mark_page As PdfImportedPage = writer.GetImportedPage(pdfReaderFG, 1)
If (mark_page.Width > mark_page.Height) Then 'Check to see if it is in Landscape
content_Byte.AddTemplate(mark_page, 0, -1, 1, 0, 0, mark_page.Width)
Else
'Then add the content to the new page over the Image
content_Byte.AddTemplate(mark_page, 0, 0)
End If
Dim formFields As AcroFields = writer.AcroFields
formFields.SetFieldProperty("cd28", "borderColor", BaseColor.GREEN, Nothing)
'content_Byte.te(BaseColor.PINK)
**formFields.SetFieldProperty("cd28", "backgroundcolor", BaseColor.YELLOW, Nothing)
'formFields.setfieldproperty("cd28") ' SetFieldProperty("cd28", "bgColor", BaseColor.WHITE, Nothing)**
我只是想更改一個文本字段背景的顏色
當您手動編輯文檔中的文本字段時。屬性的外觀選項卡。它有填充顏色和邊框顏色 我能夠做邊框顏色.. 我似乎無法做內碼的填充顏色屬性的屬性..
我已添加上面的代碼 – theApeman 2013-03-11 16:58:33
bordercolor選項工作... – theApeman 2013-03-11 16:59:21
確定更新。我試圖打印和展平文件..它不保存邊框顏色...有沒有辦法做到這一點? – theApeman 2013-03-11 17:43:54