PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

PdfSharp.Drawing.XGraphics.FromGraphics is missing.
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4350
Page 1 of 1

Author:  Johan Mulderij [ Thu Jul 07, 2022 1:59 pm ]
Post subject:  PdfSharp.Drawing.XGraphics.FromGraphics is missing.

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?

Author:  TH-Soft [ Thu Jul 07, 2022 2:28 pm ]
Post subject:  Re: PdfSharp.Drawing.XGraphics.FromGraphics is missing.

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

Author:  Johan Mulderij [ Fri Jul 08, 2022 11:29 am ]
Post subject:  Re: PdfSharp.Drawing.XGraphics.FromGraphics is missing.

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.

Author:  TH-Soft [ Mon Jul 11, 2022 9:31 am ]
Post subject:  Re: PdfSharp.Drawing.XGraphics.FromGraphics is missing.

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.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/