Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oxyplot is not printed (blank) when Printing WPF UI which is rescaled to fit on one page using .NET 7 #2048

Open
supershopping opened this issue Oct 30, 2023 · 3 comments

Comments

@supershopping
Copy link

Steps to reproduce

  1. Clone the repo from : https://github.com/supershopping/OxyPlotPrintTest
  2. Run application
  3. Click "Add Data" button
  4. Click "Print" button and select a printer to print on a "letter size paper".

Platform:
.NET version: .NET 7

Expected behaviour

My goal is to print the WPF UI Window "Main" or the Datagrid "ReportGrid". The printing code is just to transform/resacle the UI to fit on one "letter" page. The Oxyplot is supposed to resize and print.

Actual behaviour

Once the UI is printed, you can see the buttons on the right side of the UI are prined but the Oxyplot is blank and not printed.
I have another application using .NET framework 4.8 instead of .NET 7. With the same printing code, the UI printing is working properly.
It seems an compatability issue with Oxyplot library using .NET 7, and I am not sure how to fix this or is there a workaround?

@supershopping
Copy link
Author

I did a lot of testing. It turns out the pringting issue is related to Oxyplot version 2.1.2. When I am using 2.0 version of the library, the printing is working fine. Version 2.0 works for both .NET framework 4.8 and .NET7. Sorry for the confusion from my original post.

@VisualMelon
Copy link
Contributor

To clarify, it works with 2.0.0 with netframework4.8 and net7.0, but not with 2.1.2 on net7.0?

Are you able to provide any sort of reproducing example?

@supershopping
Copy link
Author

Yes. The Oxyplot 2.0.0 works with netframework4.8 and net7.0, The Oxyplot 2.1.2 does not work with netframework4.8 and net7.0,
I have created an example (using .NET 7) at this repo:
https://github.com/supershopping/OxyPlotPrintTest

The "Master" branch is using Oxyplot 2.0 version. Printing UI is OK.
[UsingVersion2.1.2] branch is using Oxyplot 2.1.2. Printing UI is not working.

You can put a breakpoint on "pd.PrintVisual(v, "My Print");" and check the "v" through WPF Visualizer. The oxplot is empty in the Visualizer. The same result when you are printing on a real letter size paper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants