Я пытаюсь использовать iText, чтобы заполнить цвет текстового поля. Я попытался setfieldproperty, и он не работает с атрибутом bgcolor или fill color. То, что я ищу это свойство текстового поля, чтобы установить, как это будет наложен существующий текст или изображениеИспользование 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
опция BorderColor работает ... – theApeman
OK обновления. Я пробовал печатать и сплющивать документ .. он не сохраняет цвет границы ... есть ли способ сделать это ??? – theApeman