PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Nov 16, 2016 10:58 pm 
Offline

Joined: Thu Jan 28, 2016 8:28 pm
Posts: 3
I have a foot border defined with its Thickness as (1,0,1,1) and CornerRadius as (0,0,4,4). The border on PDF always shows the top with very thin line until I set the CornerRadius as (0,0,0,0) or zoom in the PDF file into 800%. Following are the code
Code:
Border footBorder = new Border() {
                BorderBrush = Brushes.Green,
                BorderThickness = new Thickness(1, 0, 1, 1),// not border on the top
                Margin = new Thickness(2,0,2,0),
                //SnapsToDevicePixels = true,
                UseLayoutRounding = true,
                Height = 4,
                CornerRadius = new CornerRadius(0, 0, 4, 4)// corner radius only applied to leftbottom and rightbottom
            };
            if (!string.IsNullOrWhiteSpace(footerNote))
            {
               
                TextBlock tbFooter = new TextBlock() {
                    Text = footerNote,
                    FontSize = 12,
                    //Margin = new Thickness(5)
                };
                footBorder.Child = tbFooter;
                footBorder.BorderThickness = new Thickness(1, 1, 1, 1); // border on the top
            }
            else
            {
                footBorder.Child = new TextBlock() {
                    Text = "   ",
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Margin = new Thickness(0), /*Padding = new Thickness(0), Background = Brushes.Gray,*/ //SnapsToDevicePixels = true,
                    UseLayoutRounding = true,
                    Height = 4
                };
                //footBorder.BorderThickness = new Thickness(1, 0, 1, 1); // not border on the top
            }
            BlockUIContainer footContainer = new BlockUIContainer(footBorder);
            section.Blocks.Add(footContainer);


Here is what the foot border looks like in the saved PDF file:
Attachment:
File comment: The foot border in PDF file now
FootBorder.jpg
FootBorder.jpg [ 8.04 KiB | Viewed 4286 times ]
. There should not have the light green top line.

Is there any bug in PDFSharp to render the border with CornerRadius set to non-zero?


Thanks!


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 17, 2016 9:11 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
shenglanl wrote:
Is there any bug in PDFSharp to render the border with CornerRadius set to non-zero?
I don't know.
We will investigate this issue if we get a VS solution or an MDDDL file that allows us to replicate the issue.
See also:
viewtopic.php?f=2&t=832

Nothing in your code snippet looks like PDFsharp code.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 17, 2016 6:02 pm 
Offline

Joined: Thu Jan 28, 2016 8:28 pm
Posts: 3
Thank you, Thomas, for your quick response.

Yes, the code snippet I posted above is C# code to generate a FixDocument which XpsDocumentWriter can use to write a xps file. We use PDFSharp to convert the saved xps file into a pdf file.
Code:
PdfSharp.Xps.XpsConverter.Convert(xpsFileName, pdfFileName, 0);


I saved the temporary xps file and the pdf file and attatched their zip file below. It looks the xps file doesn't have the issues as I pointed in the pdf file.

If you still need an example VS solution for debugging, I have to create a simple one. This VS example solution is too big and with the production code behind.


Attachments:
File comment: Both XPS file and PDF file
BorderIssues.zip [142.26 KiB]
Downloaded 322 times
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 156 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