Multi-selection list box missing beginning items in Adobe Reader DC

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Multi-selection list box missing beginning items in Adobe Reader DC

Nick K

Dear iText Mailing List Support:


iTextSharp.dll Version:

Adobe Reader DC Version: 2015.008.20082

Adobe Acrobat Pro Version: 8.x



I’m getting unwanted results in Adobe Reader when generating or regenerating a multi-selection list box in an Acroform PDF document. The resulting PDF views correctly in Adobe Acrobat 8, but not in Adobe Reader DC.


Problem: When viewing the modified PDF in Adobe Reader DC, the non-selected display items at the beginning of the list box that are previous to the first selection are hidden. For example: “One“,“Two“,“Three“,“Four“,“Five“ are list items; and “Two“ and “Four“ are selected; then previous items such as “One” are not visible in the top of the list box. And the first item displayed in the list box starts with the first selection, in this case “Two”. (See Adobe Reader DC Screenshot)


FYI: Using Adobe Reader DC, when I select different field selections in the list box, and then double click outside the list box, the list box field reverts back to normal appearance with all the items shown.


I can’t reproduce this issue when opening the modified PDF in Adobe Acrobat Professional 8 and all the field items are visible and correctly selected.



Is this an Adobe Reader DC issue or an iTextSharp issue?


Thank you for all your hard work!



Modified Acroform Document with issue:


Adobe Reader DC Screenshot:


Acrobat Screenshot (no error):


VB.NET (v3.5 – Windows Application) CODE:

Imports iTextSharp.text.pdf

Imports iTextSharp.text

Imports System.IO

Public Class listboxTest

    Private Sub RunTest()

        Dim cList As New listboxTest()

        Dim fn As String = Application.StartupPath.ToString.TrimEnd("\") & "\listbox-error.pdf"

        Dim b() As Byte = cList.addListBox(System.IO.File.ReadAllBytes(fn), New iTextSharp.text.Rectangle(231.67, 108.0, 395.67, 197.0), "ListBox1", "ListBox1", 1)

        File.WriteAllBytes(fn, b)


    End Sub

    Public Function addListBox(ByVal pdfBytes() As Byte, ByVal newRect As Rectangle, ByVal newFldName As String, ByVal oldfldname As String, ByVal pg As Integer) As Byte()

        Dim pdfReaderDoc As New PdfReader(pdfBytes)

        Dim m As New System.IO.MemoryStream

        With New PdfStamper(pdfReaderDoc, m)

            Dim frmField As iTextSharp.text.pdf.TextField

            frmField = New iTextSharp.text.pdf.TextField(.Writer, newRect, newFldName)

            frmField.TextColor = BaseColor.BLACK

            frmField.BackgroundColor = BaseColor.WHITE

            frmField.BorderColor = BaseColor.BLACK

            frmField.FieldName = newFldName

            frmField.Alignment = 0

            frmField.BorderStyle = 1

            frmField.BorderWidth = 1.0F

            frmField.Visibility = TextField.VISIBLE

            frmField.Rotation = 0

            frmField.Box = newRect

            Dim opt As New PdfArray

            Dim ComboBox_ItemDisplay As New List(Of String)






            Dim ComboBox_ItemValue As New List(Of String)






            frmField.Options += iTextSharp.text.pdf.TextField.MULTISELECT

            Dim selIndex As New List(Of Integer)

            Dim selValues As New List(Of String)



            frmField.Choices = ComboBox_ItemDisplay.ToArray

            frmField.ChoiceExports = ComboBox_ItemValue.ToArray

            Dim selIndex2 As New List(Of Integer)


            frmField.ChoiceSelections = selIndex2

            Dim fld As PdfFormField = frmField.GetListField

            If Not String.IsNullOrEmpty(oldfldname & "") Then

                .AcroFields.RemoveField(oldfldname, pg)

            End If

            .AddAnnotation(fld, pg)

            .Writer.CloseStream = False


            If m.CanSeek Then

                m.Position = 0

            End If

            Dim b() As Byte = m.ToArray




            Return b

        End With

    End Function

End Class







iText-questions mailing list
[hidden email]

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book:
Please check the keywords list before you ask for examples: