Flickering of Table Borders in PDF when Zooming

Hello Aspose,

I migrate from Aspose.pdf 10.4 to latest Aspose.pdf. With the new version a new effect was introduced: When rendering a PDF containing a table with cell borders and zooming the PDF in a viewer the borders are flickering (changing display width).
TableBorderFlickering.pdf (168.0 KB)

        private static string TableBordersFlickering(Page page)
        {
            var table = new Table()
            {
                ColumnWidths = null,
                Alignment = HorizontalAlignment.Left,
                ColumnAdjustment = ColumnAdjustment.AutoFitToWindow,
                DefaultColumnWidth = "100",
                RepeatingColumnsCount = 0,
                RepeatingRowsCount = 5,
                Broken = TableBroken.None,
                IsBroken = true,
                DefaultCellBorder = null,
                DefaultCellPadding = null,
                Margin = new MarginInfo() { Left = 0, Top = 20, Right = 0, Bottom = 20 },
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Left,
                IsFirstParagraphInColumn = false,
                IsInLineParagraph = false,
                IsInNewPage = false,
                IsKeptWithNext = false,
                IsBordersIncluded = true
            };
            var titleRow = new Row();
            var groupHeaderRow = new Row();
            var headerRow = new Row();
            var secondHeaderRow = new Row();
            var date1Row = new Row();
            var date2Row = new Row();
            var date3Row = new Row();

            table.Rows.Add(titleRow);
            table.Rows.Add(groupHeaderRow);
            table.Rows.Add(headerRow);
            table.Rows.Add(secondHeaderRow);
            table.Rows.Add(date1Row);
            table.Rows.Add(date2Row);
            table.Rows.Add(date3Row);

            var defaultHeaderCellMargins = new MarginInfo() { Left = 7, Top = 10, Right = 7, Bottom = 10 };
            var secondHeaderCellMargins = new MarginInfo() { Left = 7, Top = 8, Right = 7, Bottom = 8 };
            var dataRowCellMargins = new MarginInfo() { Left = 7, Top = 10, Right = 7, Bottom = 10 };
            var defaultHeaderTextFormat = new TextState("Arial", false, false) { HorizontalAlignment = HorizontalAlignment.Left, FontSize = 10, LineSpacing = 1 };
            var secondHeaderTextFormat = new TextState("Arial", false, false) { HorizontalAlignment = HorizontalAlignment.Right, FontSize = 7, LineSpacing = 1 };
            var dataRowTextFormat = new TextState("Arial", false, false) { HorizontalAlignment = HorizontalAlignment.Left, FontSize = 9, LineSpacing = 1 };
            var dataRowNumericsFormat = new TextState("Arial", true, false) { HorizontalAlignment = HorizontalAlignment.Left, FontSize = 9, LineSpacing = 1 };

            var titleCell = new Cell()
                            {
                                Alignment = HorizontalAlignment.Left,
                                VerticalAlignment = VerticalAlignment.Center,
                                IsNoBorder = false,
                                IsOverrideByFragment = false,
                                IsWordWrapped = true,
                                ColSpan = 5,
                                RowSpan = 1,
                                Margin = defaultHeaderCellMargins,
                                DefaultCellTextState = new TextState("Arial", true, false) { HorizontalAlignment = HorizontalAlignment.Left, FontSize = 10F, LineSpacing = 1 },
                                Paragraphs = { new TextFragment("Status on a Table") },
                            };
            titleRow.Cells.Add(titleCell);

            var headerColumnCell = new Cell()
                                   {
                                       Alignment = HorizontalAlignment.Left,
                                       VerticalAlignment = VerticalAlignment.Center,
                                       IsNoBorder = false,
                                       IsOverrideByFragment = false,
                                       IsWordWrapped = true,
                                       ColSpan = 1,
                                       RowSpan = 2,
                                       Margin = defaultHeaderCellMargins,
                                       DefaultCellTextState = defaultHeaderTextFormat,
                                       BackgroundColor = Color.FromArgb(230, 230, 230),
                                       Paragraphs = { new TextFragment("Header Column") },
                                       Border = new BorderInfo(BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                                   };
            var groupHeaderColumnCell = new Cell()
                                   {
                                       Alignment = HorizontalAlignment.Left,
                                       VerticalAlignment = VerticalAlignment.Center,
                                       IsNoBorder = false,
                                       IsOverrideByFragment = false,
                                       IsWordWrapped = true,
                                       ColSpan = 3,
                                       RowSpan = 1,
                                       Margin = defaultHeaderCellMargins,
                                       DefaultCellTextState = defaultHeaderTextFormat,
                                       BackgroundColor = Color.FromArgb(230, 230, 230),
                                       Paragraphs = { new TextFragment("Header") },
                                       Border = new BorderInfo(BorderSide.Right | BorderSide.Bottom, 1F, Color.FromArgb(153, 153, 153))
                                   };
            var headerColumnCell2 = new Cell()
                                        {
                                            Alignment = HorizontalAlignment.Left,
                                            VerticalAlignment = VerticalAlignment.Center,
                                            IsNoBorder = false,
                                            IsOverrideByFragment = false,
                                            IsWordWrapped = true,
                                            ColSpan = 1,
                                            RowSpan = 2,
                                            Margin = defaultHeaderCellMargins,
                                            DefaultCellTextState = defaultHeaderTextFormat,
                                            BackgroundColor = Color.FromArgb(230, 230, 230),
                                            Paragraphs = { new TextFragment("") },
                                        };
            groupHeaderRow.Cells.Add(headerColumnCell);
            groupHeaderRow.Cells.Add(groupHeaderColumnCell);
            groupHeaderRow.Cells.Add(headerColumnCell2);

            var headerCell = new Cell()
                                    {
                                        Alignment = HorizontalAlignment.Left,
                                        VerticalAlignment = VerticalAlignment.Center,
                                        IsNoBorder = false,
                                        IsOverrideByFragment = false,
                                        IsWordWrapped = true,
                                        ColSpan = 1,
                                        RowSpan = 1,
                                        Margin = defaultHeaderCellMargins,
                                        DefaultCellTextState = defaultHeaderTextFormat,
                                        BackgroundColor = Color.FromArgb(230, 230, 230),
                                        Paragraphs = { new TextFragment("") },
                                        Border = new BorderInfo(BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
            };
            var headerCell2 = new Cell()
                              {
                                  Alignment = HorizontalAlignment.Left,
                                  VerticalAlignment = VerticalAlignment.Center,
                                  IsNoBorder = false,
                                  IsOverrideByFragment = false,
                                  IsWordWrapped = true,
                                  ColSpan = 1,
                                  RowSpan = 1,
                                  Margin = defaultHeaderCellMargins,
                                  DefaultCellTextState = defaultHeaderTextFormat,
                                  BackgroundColor = Color.FromArgb(230, 230, 230),
                                  Paragraphs = { new TextFragment("[V]") },
                                  Border = new BorderInfo(BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                              };
            var headerCell3 = new Cell()
                              {
                                  Alignment = HorizontalAlignment.Left,
                                  VerticalAlignment = VerticalAlignment.Center,
                                  IsNoBorder = false,
                                  IsOverrideByFragment = false,
                                  IsWordWrapped = true,
                                  ColSpan = 1,
                                  RowSpan = 1,
                                  Margin = defaultHeaderCellMargins,
                                  DefaultCellTextState = defaultHeaderTextFormat,
                                  BackgroundColor = Color.FromArgb(230, 230, 230),
                                  Paragraphs = { new TextFragment("[mV]") },
                                  Border = new BorderInfo(BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                              };

            headerRow.Cells.Add(headerCell);
            headerRow.Cells.Add(headerCell2);
            headerRow.Cells.Add(headerCell3);

            var secondHeaderCell = new Cell()
                                   {
                                       Alignment = HorizontalAlignment.Left,
                                       VerticalAlignment = VerticalAlignment.Center,
                                       IsNoBorder = false,
                                       IsOverrideByFragment = false,
                                       IsWordWrapped = true,
                                       ColSpan = 1,
                                       RowSpan = 1,
                                       Margin = secondHeaderCellMargins,
                                       DefaultCellTextState = secondHeaderTextFormat,
                                       BackgroundColor = Color.FromArgb(230, 230, 230),
                                       Paragraphs = { new TextFragment("") },
                                       Border = new BorderInfo(BorderSide.Bottom | BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                                   };
            var secondHeaderCell2 = new Cell()
                                    {
                                        Alignment = HorizontalAlignment.Left,
                                        VerticalAlignment = VerticalAlignment.Center,
                                        IsNoBorder = false,
                                        IsOverrideByFragment = false,
                                        IsWordWrapped = true,
                                        ColSpan = 1,
                                        RowSpan = 1,
                                        Margin = secondHeaderCellMargins,
                                        DefaultCellTextState = secondHeaderTextFormat,
                                        BackgroundColor = Color.FromArgb(230, 230, 230),
                                        Paragraphs = { new TextFragment("") },
                                        Border = new BorderInfo(BorderSide.Bottom | BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                                    };
            var secondHeaderCell3 = new Cell()
                                    {
                                        Alignment = HorizontalAlignment.Right,
                                        VerticalAlignment = VerticalAlignment.Center,
                                        IsNoBorder = false,
                                        IsOverrideByFragment = false,
                                        IsWordWrapped = true,
                                        ColSpan = 1,
                                        RowSpan = 1,
                                        Margin = secondHeaderCellMargins,
                                        DefaultCellTextState = secondHeaderTextFormat,
                                        BackgroundColor = Color.FromArgb(230, 230, 230),
                                        Paragraphs = { new TextFragment("Tolerance: 5\u202f…\u202f6") },
                                        Border = new BorderInfo(BorderSide.Bottom | BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                                    };
            var secondHeaderCell4 = new Cell()
                                    {
                                        Alignment = HorizontalAlignment.Right,
                                        VerticalAlignment = VerticalAlignment.Center,
                                        IsNoBorder = false,
                                        IsOverrideByFragment = false,
                                        IsWordWrapped = true,
                                        ColSpan = 1,
                                        RowSpan = 1,
                                        Margin = secondHeaderCellMargins,
                                        DefaultCellTextState = secondHeaderTextFormat,
                                        BackgroundColor = Color.FromArgb(230, 230, 230),
                                        Paragraphs = { new TextFragment("Tolerance: \u2264\u202f6.03") },
                                        Border = new BorderInfo(BorderSide.Bottom | BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                                    };
            var secondHeaderCell5 = new Cell()
                                    {
                                        Alignment = HorizontalAlignment.Left,
                                        VerticalAlignment = VerticalAlignment.Center,
                                        IsNoBorder = false,
                                        IsOverrideByFragment = false,
                                        IsWordWrapped = true,
                                        ColSpan = 1,
                                        RowSpan = 1,
                                        Margin = secondHeaderCellMargins,
                                        DefaultCellTextState = secondHeaderTextFormat,
                                        BackgroundColor = Color.FromArgb(230, 230, 230),
                                        Paragraphs = { new TextFragment("") },
                                        Border = new BorderInfo(BorderSide.Bottom, 1F, Color.FromArgb(153, 153, 153))
                                    };
            secondHeaderRow.Cells.Add(secondHeaderCell);
            secondHeaderRow.Cells.Add(secondHeaderCell2);
            secondHeaderRow.Cells.Add(secondHeaderCell3);
            secondHeaderRow.Cells.Add(secondHeaderCell4);
            secondHeaderRow.Cells.Add(secondHeaderCell5);

            var dataCell11 = new Cell()
            {
                Alignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center,
                IsNoBorder = false,
                IsOverrideByFragment = false,
                IsWordWrapped = true,
                ColSpan = 1,
                RowSpan = 1,
                Margin = dataRowCellMargins,
                DefaultCellTextState = dataRowTextFormat,
                BackgroundColor = Color.FromArgb(242, 242, 242),
                Paragraphs = { new TextFragment("Light Markers") },
                Border = new BorderInfo(BorderSide.Bottom | BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
            };
            var dataCell12 = new Cell()
                             {
                                 Alignment = HorizontalAlignment.Left,
                                 VerticalAlignment = VerticalAlignment.Center,
                                 IsNoBorder = false,
                                 IsOverrideByFragment = false,
                                 IsWordWrapped = true,
                                 ColSpan = 1,
                                 RowSpan = 1,
                                 Margin = dataRowCellMargins,
                                 DefaultCellTextState = dataRowNumericsFormat,
                                 BackgroundColor = Color.FromArgb(242, 242, 242),
                                 Paragraphs = { new TextFragment("5.0") },
                                 Border = new BorderInfo(BorderSide.Bottom | BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                             };
            var dataCell13 = new Cell()
                             {
                                 Alignment = HorizontalAlignment.Left,
                                 VerticalAlignment = VerticalAlignment.Center,
                                 IsNoBorder = false,
                                 IsOverrideByFragment = false,
                                 IsWordWrapped = true,
                                 ColSpan = 1,
                                 RowSpan = 1,
                                 Margin = dataRowCellMargins,
                                 DefaultCellTextState = dataRowNumericsFormat,
                                 BackgroundColor = Color.FromArgb(242, 242, 242),
                                 Paragraphs = { new TextFragment("0") },
                                 Border = new BorderInfo(BorderSide.Bottom | BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                             };
            var dataCell14 = new Cell()
                             {
                                 Alignment = HorizontalAlignment.Left,
                                 VerticalAlignment = VerticalAlignment.Center,
                                 IsNoBorder = false,
                                 IsOverrideByFragment = false,
                                 IsWordWrapped = true,
                                 ColSpan = 1,
                                 RowSpan = 1,
                                 Margin = dataRowCellMargins,
                                 DefaultCellTextState = dataRowNumericsFormat,
                                 BackgroundColor = Color.FromArgb(242, 242, 242),
                                 Paragraphs = { new TextFragment("15.03") },
                                 Border = new BorderInfo(BorderSide.Bottom | BorderSide.Right, 1F, Color.FromArgb(153, 153, 153))
                             };
            var dataCell15 = new Cell()
                             {
                                 Alignment = HorizontalAlignment.Left,
                                 VerticalAlignment = VerticalAlignment.Center,
                                 IsNoBorder = false,
                                 IsOverrideByFragment = false,
                                 IsWordWrapped = true,
                                 ColSpan = 1,
                                 RowSpan = 1,
                                 Margin = dataRowCellMargins,
                                 DefaultCellTextState = dataRowNumericsFormat,
                                 BackgroundColor = Color.FromArgb(242, 242, 242),
                                 Paragraphs = { new TextFragment("5.0") },
                                 Border = new BorderInfo(BorderSide.Bottom, 1F, Color.FromArgb(153, 153, 153))
                             };

            date1Row.Cells.Add(dataCell11);
            date1Row.Cells.Add(dataCell12);
            date1Row.Cells.Add(dataCell13);
            date1Row.Cells.Add(dataCell14);
            date1Row.Cells.Add(dataCell15);

            var dataCell21 = (Cell)dataCell11.Clone();
            dataCell21.DefaultCellTextState = dataCell11.DefaultCellTextState;
            var dataCell22 = (Cell)dataCell12.Clone();
            dataCell22.DefaultCellTextState = dataCell12.DefaultCellTextState;
            var dataCell23 = (Cell)dataCell13.Clone();
            dataCell23.DefaultCellTextState = dataCell13.DefaultCellTextState; 
            var dataCell24 = (Cell)dataCell14.Clone();
            dataCell24.DefaultCellTextState = dataCell14.DefaultCellTextState; 
            var dataCell25 = (Cell)dataCell15.Clone();
            dataCell25.DefaultCellTextState = dataCell15.DefaultCellTextState;

            date2Row.Cells.Add(dataCell21);
            date2Row.Cells.Add(dataCell22);
            date2Row.Cells.Add(dataCell23);
            date2Row.Cells.Add(dataCell24);
            date2Row.Cells.Add(dataCell25);

            var dataCell31 = (Cell)dataCell11.Clone();
            dataCell31.DefaultCellTextState = dataCell11.DefaultCellTextState;
            var dataCell32 = (Cell)dataCell12.Clone();
            dataCell32.DefaultCellTextState = dataCell12.DefaultCellTextState;
            var dataCell33 = (Cell)dataCell13.Clone();
            dataCell33.DefaultCellTextState = dataCell12.DefaultCellTextState;
            var dataCell34 = (Cell)dataCell14.Clone();
            dataCell34.DefaultCellTextState = dataCell12.DefaultCellTextState;
            var dataCell35 = (Cell)dataCell15.Clone();
            dataCell35.DefaultCellTextState = dataCell12.DefaultCellTextState;

            date3Row.Cells.Add(dataCell31);
            date3Row.Cells.Add(dataCell32);
            date3Row.Cells.Add(dataCell33);
            date3Row.Cells.Add(dataCell34);
            date3Row.Cells.Add(dataCell35);

            page.Paragraphs.Add(table);

            return Path.Combine(myDataDir, "TableBorderFlickering.pdf");
        }

My observation is that the borders appear with different thickness when zooming the PDF. In fact these borders have all the correct thickness:
grafik.png (122.4 KB)

Sometimes the lines are disappearing or small holes appear between the border endings:
grafik.png (119.5 KB)

The line below the ‘Header’ cell is completely invisible:
grafik.png (121.2 KB)

In fact all the graphic objects appears correctly in the PDF but the order is not as optimal as it was in Aspose.pdf 10.4.
As an expample:
grafik.png (123.1 KB)
If the graphical object is moved down the line will appear:
grafik.png (122.9 KB)

I checked the flickering effect by moving other border lines down as well and the flickering was disappearing.

So I propose to order the operators for borders drawing after the operators for cell background and cell contents as it was done in the former Aspose.pdf 10.4 Generator API.

As a workaround I tried tried to move the operators after processing the paragraphs e.g. with Document. ProcessParagraphs(), but I failed.
I can identify the border line operators: e.g.
(SetRGBColorStroke): 0.6 0.6 0.6 RG
(SetLineWidth): 1 w
(MoveTo): 422 687.5 m
(LineTo): 173 687.5 l
(Stroke): S

Is it possible to find this block of operators in Page.Contests and to move?
I tried it with:

            var last = doc.Pages[1].Contents.Count;
            for (int i = 1; i <= last; i++)
            {
                if (doc.Pages[1].Contents[i] is SetRGBColorStroke
                    && doc.Pages[1].Contents[i + 1] is SetLineWidth
                    && doc.Pages[1].Contents[i + 2] is MoveTo
                    && doc.Pages[1].Contents[i + 3] is LineTo
                    && doc.Pages[1].Contents[i + 4] is Stroke)
                {
                    doc.Pages[1].Contents.Add(doc.Pages[1].Contents[i]);
                    doc.Pages[1].Contents.Add(doc.Pages[1].Contents[i+1]);
                    doc.Pages[1].Contents.Add(doc.Pages[1].Contents[i+2]);
                    doc.Pages[1].Contents.Add(doc.Pages[1].Contents[i+3]);
                    doc.Pages[1].Contents.Add(doc.Pages[1].Contents[i+4]);
                    doc.Pages[1].Contents.Delete(i);
                    doc.Pages[1].Contents.Delete(i);
                    doc.Pages[1].Contents.Delete(i);
                    doc.Pages[1].Contents.Delete(i);
                    doc.Pages[1].Contents.Delete(i);
                    last -= 5;
                }
            }

But without effect after saving the PDF.
How to do this correctly?

Regards
Gerd

@Gerd
When viewing a document in Adobe Acrobat, I see only the following shortcomings.

  • Changing line thickness
  • No displayed line (although the corresponding path is present).
    Table.png (75.8 KB)

(I did not see any breaks/" lines are disappearing or small holes appear"/ in the lines or noticeable flickering)
Please see how the document is displayed in Acrobat in your environment, perhaps this is due to the viewer.

Please attach a document generated in version 10.4, with the same generated table.
(the licenses that I have do not allow me to work with this version and I cannot generate it myself)

Since the effect does not manifest itself for me, I cannot check much of what you wrote.
But you are a very qualified user - so I will offer some things.

After moving the Paths in the editor, which, as you believe, leads to an improvement, save the document and look at the order of operators in it.
(If you don’t have a viewer for operators, you can open the document with the library and look at the order of operators in it)

An interesting idea and a great way to code the movement of operators - I would most likely create a new list to which I would throw the operators, and then assign it to doc.Pages[1].Contents.
Before moving the operators, you should call saving the document to be sure that the complete processing has been completed:

doc.Save(new MemoryStream())

After performing the operation of moving the operators, check the location of the operators in doc.Pages[1].Contents (and compare with what you get when moving the Path in the editor).
Check the order of the operators after saving and reopening the document.

Well, it might be better to immediately use the document generated in version 10.4 as a standard - look at how the operators are located in it and try to bring them to the same order.

I don’t think I have fully answered your question - if you have any questions, additional information, etc., please write.

This is the same table for Aspose.pdf 10.4 basing on the former namespace Aspose.Pdf.Generator.
TableBorderFlickering.alt.pdf (6.1 KB)
For reproducing it is not neccessary to have a license. In fact you can see that one border is missing. It is not rendered into the PDF, but in my original code it is fine. But what you can see is that the border lines are drawn after table background and content.
It think this could be improved.

        private static string TableBordersFlickering(Section page)
        {
            var table = new Table();
            table.ColumnWidths = "20% 20% 20% 20% 20%";
            table.ColumnAdjustment = ColumnAdjustmentType.Customized;
            table.RepeatingRows = 5;
            table.IsBroken = true;
            table.Margin = new MarginInfo() { Left = 0, Top = 20, Right = 0, Bottom = 20 };
            table.VerticalAlignment = VerticalAlignmentType.Center;
            table.Alignment = AlignmentType.Left;
            table.IsFirstParagraphInColumn = false;
            table.IsKeptWithNext = false; //Border = new BorderInfo(BorderSide.All, 1.0F, Color.White),
            table.BreakText = new Text("(continued)");

            

            var defaultHeaderCellMargins = new MarginInfo() { Left = 7, Top = 10, Right = 7, Bottom = 10 };
            var secondHeaderCellMargins = new MarginInfo() { Left = 7, Top = 8, Right = 7, Bottom = 8 };
            var dataRowCellMargins = new MarginInfo() { Left = 7, Top = 10, Right = 7, Bottom = 10 };
            var defaultHeaderTextFormat = new TextInfo()
                                          {
                                              IsTrueTypeFontBold = false, IsTrueTypeFontItalic = false, FontName = "Arial", Alignment = AlignmentType.Left,
                                              FontSize = 10, LineSpacing = 1
                                          };
            var secondHeaderTextFormat = new TextInfo()
                                         {
                                             IsTrueTypeFontBold = false, IsTrueTypeFontItalic = false, FontName = "Arial", Alignment = AlignmentType.Right, FontSize = 7,
                                             LineSpacing = 1
                                         };
            var dataRowTextFormat = new TextInfo()
                                    {
                                        IsTrueTypeFontBold = false, IsTrueTypeFontItalic = false, FontName = "Arial", Alignment = AlignmentType.Left, FontSize = 9,
                                        LineSpacing = 1
                                    };
            var dataRowNumericsFormat = new TextInfo()
                                        {
                                            IsTrueTypeFontBold = true, IsTrueTypeFontItalic = false, FontName = "Arial", Alignment = AlignmentType.Left, FontSize = 9,
                                            LineSpacing = 1
                                        };
            var northEastBorder = new BorderInfo((int)(BorderSide.Right | BorderSide.Top), 1F, new Color(153, 153, 153));
            var northEastWestBorder = new BorderInfo((int)(BorderSide.Right | BorderSide.Left | BorderSide.Top), 1F, new Color(153, 153, 153));
            var southEastBorder = new BorderInfo((int)(BorderSide.Right | BorderSide.Bottom), 1F, new Color(153, 153, 153));
            var southEastWestBorder = new BorderInfo((int)(BorderSide.Right | BorderSide.Left | BorderSide.Bottom), 1F, new Color(153, 153, 153));
            var southWestBorder = new BorderInfo((int)(BorderSide.Left | BorderSide.Bottom), 1F, new Color(153, 153, 153));
            var southBorder = new BorderInfo((int)BorderSide.Bottom, 1F, new Color(153, 153, 153));
            var eastBorder = new BorderInfo((int)BorderSide.Right, 1F, new Color(153, 153, 153));
            var westBorder = new BorderInfo((int)BorderSide.Right, 1F, new Color(153, 153, 153));
            
            var titleRow = table.Rows.Add();
            var titleCell = titleRow.Cells.Add();
            titleCell.Alignment = AlignmentType.Left;
            titleCell.VerticalAlignment = VerticalAlignmentType.Center;
            titleCell.IsWordWrapped = true;
            titleCell.ColumnsSpan = 5;
            titleCell.RowSpan = 1;
            titleCell.Padding = defaultHeaderCellMargins;
            titleCell.DefaultCellTextInfo = new TextInfo()
                                            {
                                                IsTrueTypeFontBold = true,
                                                IsTrueTypeFontItalic = false,
                                                FontName = "Arial",
                                                Alignment = AlignmentType.Left,
                                                FontSize = 10F,
                                                LineSpacing = 1
                                            };
            titleCell.Paragraphs.Add(new Text("Status on a Table"));

            var groupHeaderRow = table.Rows.Add();
            var headerColumnCell = groupHeaderRow.Cells.Add();
            headerColumnCell.Alignment = AlignmentType.Left;
            headerColumnCell.VerticalAlignment = VerticalAlignmentType.Center;
            headerColumnCell.IsWordWrapped = true;
            headerColumnCell.ColumnsSpan = 1;
            headerColumnCell.RowSpan = 2;
            headerColumnCell.Padding = defaultHeaderCellMargins;
            headerColumnCell.DefaultCellTextInfo = defaultHeaderTextFormat;
            headerColumnCell.BackgroundColor = new Color(230, 230, 230);
            headerColumnCell.Border = eastBorder;
            var t = new Text("Header Column");
            t.TextInfo = defaultHeaderTextFormat;
            headerColumnCell.Paragraphs.Add(t);

            var groupHeaderColumnCell = groupHeaderRow.Cells.Add();
            groupHeaderColumnCell.Alignment = AlignmentType.Left;
            groupHeaderColumnCell.VerticalAlignment = VerticalAlignmentType.Center;
            groupHeaderColumnCell.IsWordWrapped = true;
            groupHeaderColumnCell.ColumnsSpan = 3;
            groupHeaderColumnCell.RowSpan = 1;
            groupHeaderColumnCell.Padding = defaultHeaderCellMargins;
            groupHeaderColumnCell.DefaultCellTextInfo = defaultHeaderTextFormat;
            groupHeaderColumnCell.BackgroundColor = new Color(230, 230, 230);
            groupHeaderColumnCell.Border = southEastWestBorder;
            t = new Text("Header");
            t.TextInfo = defaultHeaderTextFormat;
            groupHeaderColumnCell.Paragraphs.Add(t);

            var headerColumnCell2 = groupHeaderRow.Cells.Add();
            headerColumnCell2.Alignment = AlignmentType.Left;
            headerColumnCell2.VerticalAlignment = VerticalAlignmentType.Center;
            headerColumnCell2.IsNoBorder = false;
            headerColumnCell2.IsWordWrapped = true;
            headerColumnCell2.ColumnsSpan = 1;
            headerColumnCell2.RowSpan = 2;
            headerColumnCell2.Padding = defaultHeaderCellMargins;
            headerColumnCell2.DefaultCellTextInfo = defaultHeaderTextFormat;
            headerColumnCell2.BackgroundColor = new Color(230, 230, 230);
            groupHeaderColumnCell.Border = westBorder;
            headerColumnCell2.Paragraphs.Add(new Text(""));
            t = new Text("");
            t.TextInfo = defaultHeaderTextFormat;
            groupHeaderColumnCell.Paragraphs.Add(t);


            var headerRow = table.Rows.Add();
            var headerCell = headerRow.Cells.Add();
            headerCell.Alignment = AlignmentType.Left;
            headerCell.VerticalAlignment = VerticalAlignmentType.Center;
            headerCell.IsNoBorder = false;
            headerCell.IsWordWrapped = true;
            headerCell.ColumnsSpan = 1;
            headerCell.RowSpan = 1;
            headerCell.Padding = defaultHeaderCellMargins;
            headerCell.DefaultCellTextInfo = defaultHeaderTextFormat;
            headerCell.BackgroundColor = new Color(230, 230, 230);
            headerCell.Border = northEastWestBorder;
            t = new Text("");
            t.TextInfo = defaultHeaderTextFormat;
            headerCell.Paragraphs.Add(t);

            var headerCell2 = headerRow.Cells.Add();
            headerCell2.Alignment = AlignmentType.Left;
            headerCell2.VerticalAlignment = VerticalAlignmentType.Center;
            headerCell2.IsNoBorder = false;
            headerCell2.IsWordWrapped = true;
            headerCell2.ColumnsSpan = 1;
            headerCell2.RowSpan = 1;
            headerCell2.Padding = defaultHeaderCellMargins;
            headerCell2.DefaultCellTextInfo = defaultHeaderTextFormat;
            headerCell2.BackgroundColor = new Color(230, 230, 230);
            headerCell2.Border = northEastWestBorder;
            t = new Text("[V]");
            t.TextInfo = defaultHeaderTextFormat;
            headerCell2.Paragraphs.Add(t);


            var headerCell3 = headerRow.Cells.Add();
            headerCell3.Alignment = AlignmentType.Left;
            headerCell3.VerticalAlignment = VerticalAlignmentType.Center;
            headerCell3.IsNoBorder = false;
            headerCell3.IsWordWrapped = true;
            headerCell3.ColumnsSpan = 1;
            headerCell3.RowSpan = 1;
            headerCell3.Padding = defaultHeaderCellMargins;
            headerCell3.DefaultCellTextInfo = defaultHeaderTextFormat;
            headerCell3.BackgroundColor = new Color(230, 230, 230);
            headerCell3.Border = northEastWestBorder;
            t = new Text("[mV]");
            t.TextInfo = defaultHeaderTextFormat;
            headerCell3.Paragraphs.Add(t);

            var secondHeaderRow = table.Rows.Add();
            var secondHeaderCell = secondHeaderRow.Cells.Add();
            secondHeaderCell.Alignment = AlignmentType.Left;
            secondHeaderCell.VerticalAlignment = VerticalAlignmentType.Center;
            secondHeaderCell.IsNoBorder = false;
            secondHeaderCell.IsWordWrapped = true;
            secondHeaderCell.ColumnsSpan = 1;
            secondHeaderCell.RowSpan = 1;
            secondHeaderCell.Padding = secondHeaderCellMargins;
            secondHeaderCell.DefaultCellTextInfo = secondHeaderTextFormat;
            secondHeaderCell.BackgroundColor = new Color(230, 230, 230);
            secondHeaderCell.Border = southEastBorder;
            t = new Text("");
            t.TextInfo = secondHeaderTextFormat;
            secondHeaderCell.Paragraphs.Add(t);


            var secondHeaderCell2 = secondHeaderRow.Cells.Add(); 
            secondHeaderCell2.Alignment = AlignmentType.Left;
            secondHeaderCell2.VerticalAlignment = VerticalAlignmentType.Center;
            secondHeaderCell2.IsNoBorder = false;
            secondHeaderCell2.IsWordWrapped = true;
            secondHeaderCell2.ColumnsSpan = 1;
            secondHeaderCell2.RowSpan = 1;
            secondHeaderCell2.Padding = secondHeaderCellMargins;
            secondHeaderCell2.DefaultCellTextInfo = secondHeaderTextFormat;
            secondHeaderCell2.BackgroundColor = new Color(230, 230, 230);
            secondHeaderCell2.Border = southEastWestBorder;
            t = new Text("");
            t.TextInfo = secondHeaderTextFormat;
            secondHeaderCell2.Paragraphs.Add(t);

            var secondHeaderCell3 = secondHeaderRow.Cells.Add();
            secondHeaderCell3.Alignment = AlignmentType.Right;
            secondHeaderCell3.VerticalAlignment = VerticalAlignmentType.Center;
            secondHeaderCell3.IsNoBorder = false;
            secondHeaderCell3.IsWordWrapped = true;
            secondHeaderCell3.ColumnsSpan = 1;
            secondHeaderCell3.RowSpan = 1;
            secondHeaderCell3.Padding = secondHeaderCellMargins;
            secondHeaderCell3.DefaultCellTextInfo = secondHeaderTextFormat;
            secondHeaderCell3.BackgroundColor = new Color(230, 230, 230);
            secondHeaderCell3.Border = southEastWestBorder;
            t = new Text("Tolerance: 5\u202f…\u202f6");
            t.TextInfo = secondHeaderTextFormat;
            secondHeaderCell3.Paragraphs.Add(t);

            var secondHeaderCell4 = secondHeaderRow.Cells.Add();
            secondHeaderCell4.Alignment = AlignmentType.Right;
            secondHeaderCell4.VerticalAlignment = VerticalAlignmentType.Center;
            secondHeaderCell4.IsNoBorder = false;
            secondHeaderCell4.IsWordWrapped = true;
            secondHeaderCell4.ColumnsSpan = 1;
            secondHeaderCell4.RowSpan = 1;
            secondHeaderCell4.Padding = secondHeaderCellMargins;
            secondHeaderCell4.DefaultCellTextInfo = secondHeaderTextFormat;
            secondHeaderCell4.BackgroundColor = new Color(230, 230, 230);
            secondHeaderCell4.Border = southEastWestBorder;
            t = new Text("Tolerance: \u2264\u202f6.03");
            t.TextInfo = secondHeaderTextFormat;
            secondHeaderCell4.Paragraphs.Add(t);

            var secondHeaderCell5 = secondHeaderRow.Cells.Add();
            secondHeaderCell5.Alignment = AlignmentType.Left;
            secondHeaderCell5.VerticalAlignment = VerticalAlignmentType.Center;
            secondHeaderCell5.IsNoBorder = false;
            secondHeaderCell5.IsWordWrapped = true;
            secondHeaderCell5.ColumnsSpan = 1;
            secondHeaderCell5.RowSpan = 1;
            secondHeaderCell5.Padding = secondHeaderCellMargins;
            secondHeaderCell5.DefaultCellTextInfo = secondHeaderTextFormat;
            secondHeaderCell5.BackgroundColor = new Color(230, 230, 230);
            secondHeaderCell5.Border = southWestBorder;
            t = new Text("");
            t.TextInfo = secondHeaderTextFormat;
            secondHeaderCell5.Paragraphs.Add(t);

            DataCell11();
            DataCell11(); 
            DataCell11();
            
            page.Paragraphs.Add(table);

            return Path.Combine(myDataDir, "TableBorderFlickering.alt.pdf");

            Cell DataCell11()
            {
                var date1Row = table.Rows.Add();
                var dataCell11 = date1Row.Cells.Add();
                dataCell11.Alignment = AlignmentType.Left;
                dataCell11.VerticalAlignment = VerticalAlignmentType.Center;
                dataCell11.IsNoBorder = false;
                dataCell11.IsWordWrapped = true;
                dataCell11.ColumnsSpan = 1;
                dataCell11.RowSpan = 1;
                dataCell11.Padding = dataRowCellMargins;
                dataCell11.DefaultCellTextInfo = dataRowTextFormat;
                dataCell11.BackgroundColor = new Color(242, 242, 242);
                dataCell11.Border = southEastBorder;
                t = new Text("Light Markers");
                t.TextInfo = dataRowTextFormat;
                dataCell11.Paragraphs.Add(t);

                var dataCell12 = date1Row.Cells.Add();
                dataCell12.Alignment = AlignmentType.Left;
                dataCell12.VerticalAlignment = VerticalAlignmentType.Center;
                dataCell12.IsNoBorder = false;
                dataCell12.IsWordWrapped = true;
                dataCell12.ColumnsSpan = 1;
                dataCell12.RowSpan = 1;
                dataCell12.Padding = dataRowCellMargins;
                dataCell12.DefaultCellTextInfo = dataRowNumericsFormat;
                dataCell12.BackgroundColor = new Color(242, 242, 242);
                dataCell12.Border = southEastWestBorder;
                t = new Text("5.0");
                t.TextInfo = dataRowNumericsFormat;
                dataCell12.Paragraphs.Add(t);

                var dataCell13 = date1Row.Cells.Add();
                dataCell13.Alignment = AlignmentType.Left;
                dataCell13.VerticalAlignment = VerticalAlignmentType.Center;
                dataCell13.IsNoBorder = false;
                dataCell13.IsWordWrapped = true;
                dataCell13.ColumnsSpan = 1;
                dataCell13.RowSpan = 1;
                dataCell13.Padding = dataRowCellMargins;
                dataCell13.DefaultCellTextInfo = dataRowNumericsFormat;
                dataCell13.BackgroundColor = new Color(242, 242, 242);
                dataCell13.Border = southEastWestBorder;
                t = new Text("0");
                t.TextInfo = dataRowNumericsFormat;
                dataCell13.Paragraphs.Add(t);

                var dataCell14 = date1Row.Cells.Add();
                dataCell14.Alignment = AlignmentType.Left;
                dataCell14.VerticalAlignment = VerticalAlignmentType.Center;
                dataCell14.IsNoBorder = false;
                dataCell14.IsWordWrapped = true;
                dataCell14.ColumnsSpan = 1;
                dataCell14.RowSpan = 1;
                dataCell14.Padding = dataRowCellMargins;
                dataCell14.DefaultCellTextInfo = dataRowNumericsFormat;
                dataCell14.BackgroundColor = new Color(242, 242, 242);
                dataCell14.Border = southEastWestBorder;
                t = new Text("15.03");
                t.TextInfo = dataRowNumericsFormat;
                dataCell14.Paragraphs.Add(t);

                var dataCell15 = date1Row.Cells.Add(); 
                dataCell15.Alignment = AlignmentType.Left;
                dataCell15.VerticalAlignment = VerticalAlignmentType.Center;
                dataCell15.IsNoBorder = false;
                dataCell15.IsWordWrapped = true;
                dataCell15.ColumnsSpan = 1;
                dataCell15.RowSpan = 1;
                dataCell15.Padding = dataRowCellMargins;
                dataCell15.DefaultCellTextInfo = dataRowNumericsFormat;
                dataCell15.BackgroundColor = new Color(242, 242, 242);
                dataCell15.Border = southWestBorder;
                t = new Text("5.0");
                t.TextInfo = dataRowNumericsFormat;
                dataCell15.Paragraphs.Add(t);
                return dataCell11;
            }
        }


@Gerd
For the document created with version 10.4, line drawing is indeed at the end of the list of operators.
documents.
Operators.zip (2.4 KB)
But both documents are displayed in my environment without flickering and gaps. And at the moment I can only set a task for the developers on the undisplayed line.

Have you opened a document created with the latest version in Acrobat and if so, how is it displayed in it?
After applying the code snippet to move the line drawing operators, is the location of the operators the same (close) as what was created with the latest version?

Sure, same effect in Adobe:
grafik.png (53.6 KB)
grafik.png (53.9 KB)

Else I would not have asked for support.

The workaround I have not tested yet.