PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 2:00 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Jul 07, 2022 1:59 pm 
Offline

Joined: Thu Jul 07, 2022 1:40 pm
Posts: 3
In my Windows Forms application using PDFsharp 1.32.2608.0 I'm currently trying to update to PDFsharp 1.50
The applications uses PDFsharp X... commands to draw to a PDF, but also to Screen or Printer.

My problem is:
For drawing to Screen or Printer I need the PdfSharp.Drawing.XGraphics.FromGraphics function to get a reference to the Graphics of those devices.
But somehow this function is not available anymore in PDFsharp 1.50.

Why is this functionality removed?
How to solve this problem?


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 07, 2022 2:28 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 905
Location: CCAA
Hi!
Johan Mulderij wrote:
Why is this functionality removed?
It was not removed.

Johan Mulderij wrote:
How to solve this problem?
Use the correct version.
https://www.nuget.org/packages/PDFsharp ... .5185-beta

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


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 08, 2022 11:29 am 
Offline

Joined: Thu Jul 07, 2022 1:40 pm
Posts: 3
Hello Thomas,

Thanks for the reply (and for moving my post to the correct section).

That 1.51.5185 beta version did seem to solve the problem, because the FromGraphics function is there now.

But now I see that the scaling is completely different from what I had.
I noticed that the dll has -gdi appended and I saw that there also was a version without -gdi (which I probably had in the 1.32.2608.0 version)

So I downloaded pdfsharp.1.51.5185-beta.nupkg to try if that had the original scaling.
But in this version the PdfSharp.Drawing.XGraphics.FromGraphics function again is missing.

Is it required to use the gdi version or is it a bug that this FromGraphics function is missing in the non-gdi version?

Thanks for your support.


EDIT:
The scaling problem was for output to Screen or Printer, not for the PDF file itself.
I have solved the scaling problem by using a scalefactor 0.3523 on the screen and printer Graphics object using .ScaleTransform(0.3523,0.3523)
So I can use the gdi version now.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 11, 2022 9:31 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 905
Location: CCAA
In the old days there only was one PDFsharp version - and it implicitly was the GDI version.
Now there are three versions - and XGraphics is used by the GDI version only.
With respect to the difference in scaling, I don't know where the difference comes from.

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


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 51 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