question

donpro2009 avatar image
0 Votes"
donpro2009 asked GarethWilliams-0328 answered

Image is not loaded in UWP print preview

Hi,
When the print preview is generated for my app, the logo is not loaded.
When I save the print as a PDF (using 'Microsoft Print to PDF'), the logo is there.

When I close the preview, and click the print button again, the logo is loaded in the preview (and also in the PDF).

Here's part of my code:

BitmapImage logoBitmap = new BitmapImage(new Uri("ms-appx:///Assets/Images/logo.png"));

Image companyLogoImage = new Image()
{
    Width = 300,
    HorizontalAlignment = HorizontalAlignment.Left,
    VerticalAlignment = VerticalAlignment.Top,
    Source = logoBitmap
};

It's not that big of a deal for me as the logo is included in the export (I haven't printed it, but I assume it might print with the logo), but the user will not like it as they expect an actual print preview!

Any help is appreciated.

windows-uwp
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

When I tried to print an image, the image can display well in the print preview and PDF file, I can't reproduce this issue. Can you please provide a simple sample that can be reproduced for us to test?

0 Votes 0 ·

Thanks,
I can't seem to reproduce it anymore.

This might just be a weird bug or something.

0 Votes 0 ·

Have you solved this issue?

0 Votes 0 ·

I am having the exact same issue.
My preview is not showing the logos at the top of the screen, but a close/re-open of the preview does show them, or even a switch of page orientation works too.

They always print though.

A feature of my app is to print a site plan this has a large background image of the 'site'.
It never shows on preview.
Strangely if I put a breakpoint in the part which sets the image source then it will sometimes show on resuming the app.

It's as if the preview is displaying a thumbnail of the printed page before it's fully rendered its images so this seems timing related.

This has been a consistent cause of frustration for me for several months now and I don't know how to solve it.

0 Votes 0 ·

1 Answer

GarethWilliams-0328 avatar image
0 Votes"
GarethWilliams-0328 answered

Any update on this issue - I last posted that I was having the same problem nearly a year ago now.
And it is still an issue.
In fact a new issue has cropped up - I print a datagrid and have it configured so that alternate rows are greyed so you can read the rows better.
This works on the print preview
but it does not print on my canon ink jet.
but it does print on my hp laser jet

Very disappointed at these bugs and no resolution for a year.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.