PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 12:58 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Oct 30, 2017 6:55 am 
Offline

Joined: Mon Oct 30, 2017 6:31 am
Posts: 3
Hello,
I'm not sure whether this is a bug or I'm messing something up when using MigraDoc. I would really appreciate a bit of help here.

What I am trying to do is have a table with no borders, on a pdf that has a background image. The background image should be seen through the table. All works well if I don't assign any color to the background of the table.
However, if I want the table rows to have alternative colors (lets say transparent white and a transparent light shade of gray) the borders of the table start becoming visible.
This only happens when the background color I assign to rows is darker and transparent. I also tried to set the borders to be of the color I set on the background, but that had no effect. Oh, and also set the Visible property to false, but again, no change.
Am I doing something wrong? Maybe setting the wrong property?

CODE:
Code:
            var row = table.AddRow();
            row.Cells[0].AddParagraph("A");
            row.Shading.Color = new Color(50, 50, 50, 50);
            row = table.AddRow();
            row.Cells[0].AddParagraph("B");
            row.Shading.Color = new Color(50, 50, 50);
            row = table.AddRow();
            row.Cells[0].AddParagraph("C");
            row.Shading.Color = new Color(200, 200, 200);
            row = table.AddRow();
            row.Cells[0].AddParagraph("D");
            row.Shading.Color = new Color(50, 255, 255, 255);


Row A is the one with the issue. The rest are to show that other combinations work well.
MDDDL
Code:
\table
    [
      Borders
      {
        Width = 0
      }
    ]
    {
      \columns
      {
        \column
        \column
      }
      \rows
      {
        \row
        [
          Shading
          {
            Color = 0x32323232
          }
        ]
        {
          \cell
          {
            A
          }
        }
        \row
        [
          Shading
          {
            Color = RGB(50,50,50)
          }
        ]
        {
          \cell
          {
            B
          }
        }
        \row
        [
          Shading
          {
            Color = RGB(200,200,200)
          }
        ]
        {
          \cell
          {
            C
          }
        }
        \row
        [
          Shading
          {
            Color = 0x32FFFFFF
          }
        ]
        {
          \cell
          {
            D
          }
        }
      }
    }


The version I first noticed this on was MigraDoc WPF 1.32.2608 (from nuget), but I also downloaded the issue submission project and it happened there too, and that was version 1.50.4000-beta3b.
I have the issue submission project ready to upload if needed. I haven't uploaded it yet because I still think maybe I'm doing something wrong.

You can see the issue in the following image, on row A. In the middle of it there's a visible border between the cells.

Thank you for your time and for an amazing library!


Attachments:
TransparentBorderIssue.PNG
TransparentBorderIssue.PNG [ 8.65 KiB | Viewed 5650 times ]
Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 30, 2017 8:50 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Hi!

Using Adobe Reader? It sometimes has display errors 1 pixel wide. If you zoom in, the error still is one pixel wide or goes away.

That's what I guess the problem is (can't check this with a PNG, could check this with a PDF).

What you see is probably not the border, but an overlap between two cells that only overlap due to a rounding error.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 30, 2017 9:08 am 
Offline

Joined: Mon Oct 30, 2017 6:31 am
Posts: 3
Yes, I was opening it using Adobe Reader. I see now that different viewers make it look different. However, in 3/4 that line appeared there. The only that didn't was whatever google drive uses to open pdfs.
Zooming in still shows the problem.

I should maybe try to print it and see if that shows on the printed page. However, even if it only gets displayed on adobe reader, it still might be too much of an issue. Any idea what I could do to fix/hide it?

I also attached the pdf so anyone can check it out. (Had to zip it because for some reason trying to upload it as a PDF I got error "Invalid image" on the forum)

Thanks again for the help!


Attachments:
HelloWorld.zip [9.14 KiB]
Downloaded 313 times
Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 30, 2017 9:13 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
bhobinca wrote:
Zooming in still shows the problem.
Yes. As I expected: you see a thin line at any zoom level (100% or 6400%).
The error will be one pixel when printing - and should hardly be visible if visible at all.

Would a gap be better? Having transparent borders or padding could lead to gaps between the cell backgrounds.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 30, 2017 9:31 am 
Offline

Joined: Mon Oct 30, 2017 6:31 am
Posts: 3
A gap would be ok only if I can properly mask it to seem like it's not there. Which it seems I cannot. I tried now to make borders transparent or the color I want in the background of the row, but it is still very obvious the border is there.

I'm going to try some more, but I don't really know how best to approach it now.

But thanks for helping me understand the issue.
If you happen to stumble upon anything that might help me, any suggestion/idea is appreciated.

Short version of what I'm trying to accomplish:
borderless table, with alternative row backgrounds which need to be semi-transparent to be able to see the logo that will be on the background of the page.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 142 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group