logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
chitarrastonata  
#1 Posted : Wednesday, May 7, 2025 6:59:13 AM(UTC)
Quote
chitarrastonata

Rank: Newbie

Groups: Registered
Joined: 5/7/2025(UTC)
Posts: 1
Italy
Location: Milan

I'm developing a program to display my sheet music on a Windows tablet (Microsoft Surface). The PDFs contain only one page, and I generate them myself using Word. The issue is that when viewing the PDF in full screen using PdfRenderer, it does not completely fill the display. The PDF page is rendered with page borders, and around the rendered page, there is additional empty space, making the PDF content appear smaller than the available display space.

I want to make full use of the display by eliminating both the page border and the extra empty space that appears around it. I have tried setting Padding and Margin to zero, but that does not solve the problem. How can I achieve this?

I have attached an image showing the top part of the screen as it currently displays the PDF.bordo.png

Thanks!
Paul Rayman  
#2 Posted : Monday, July 21, 2025 1:00:35 AM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,125

Thanks: 10 times
Was thanked: 132 time(s) in 129 post(s)
Hello,

Winforms:
The page border is always displayed outside of its area. So the following will help you achieve your goal.

Code:
this.SizeMode = SizeModes.FitToWidth;
this.ShowCurrentPageHighlight = false;
this.PageMargin = new Padding(0);
this.Padding = new Padding(0);


WPF:
Code:
this.SizeMode = SizeModes.FitToWidth;
this.ShowCurrentPageHighlight = false;
this.PageMargin = new System.Windows.Thickness(0);
this.Padding = new System.Windows.Thickness(0);
this.PageBorderColor = Colors.White;
darina1234  
#3 Posted : Saturday, December 20, 2025 10:31:48 AM(UTC)
Quote
darina1234

Rank: Newbie

Groups: Registered
Joined: 12/20/2025(UTC)
Posts: 1
Costa Rica
Location: New Zealand

PdfRenderer always respects the PDF page box, so those “borders” are usually baked into the file by Word. Zero padding won’t help. Either export the PDF with zero margins in Word, or crop the page using the PDF crop box (iText/PdfBox). In code, render into a bitmap scaled to your view with a Matrix to fill the screen.
Quick Reply Show Quick Reply
Users browsing this topic
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.