K
K
kr_ilya2021-12-20 17:59:14
WPF
kr_ilya, 2021-12-20 17:59:14

Why is only the visible part of the canvas captured when printing?

When trying to print the contents of the canvas, only the visible part is captured. Everything below the vertical scroll is not printed. What can be done?

<ScrollViewer x:Name="preview_scroll" HorizontalAlignment="Left" Height="382" VerticalAlignment="Top" Width="592" Margin="20,20,0,0">
            <Canvas x:Name="preview_canvas" Height="379" Width="582" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</ScrollViewer>

Seal
try
            {
                PrintDialog dialog = new PrintDialog();

                if (dialog.ShowDialog() != true)
                    return;
                dialog.PrintVisual(preview_canvas, "Print");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Print Screen", MessageBoxButton.OK, MessageBoxImage.Error);
            }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question