DrawImage in PrintDocument — insert images to print, the problems with scaling

The problem is the following. When the event occurs, print the processed parameters of the PrintPageEventHandler delegate, where actually in one of the variables stores the Graphics object (the PrintPage event).
Trying to insert on the canvas to any image, and then actually view the standard preview control. And here the problems begin. The image is inserted, but all would be nothing, but it is scaled with some factor and the result is the pasted image becomes blurred as in the preview, and they print, in fact the original is lost.
Tried to insert image to change the resolution (SetResolution) that is stored in the Graphics object derived from the parameter of the delegate PrintPageEventHandler (I had 600dpi). Tried to change the PageScale to 1 (although this is depoltovice value). I tried to change the units to inches (inch) and points (point).
Many things tried, but it's not impossible to get a normal image. What can be the problem?
October 8th 19 at 00:11
1 answer
October 8th 19 at 00:13
Recently decided this question, did not understand as better to make. While the draft works like this
(though still slightly cuts off the edges). Copied part of the code:

 PrintDocument pd = new PrintDocument();
 printerU string = "PDF Printer";
 pd.PrinterSettings.PrinterName = printerU;
 PageHeight = pd.PrinterSettings.DefaultPageSettings.PaperSize.Height;
 PageWidth = pd.PrinterSettings.DefaultPageSettings.PaperSize.Width;
 pd.PrintPage += new PrintPageEventHandler(PrintImage);

 if (pd.PrinterSettings.IsValid)
 // Printer is invalid

 private void PrintImage(Object sender, PrintPageEventArgs e)
 System.Drawing.Image img =
 e.Graphics.DrawImage(img, 0, 0, PageWidth, PageHeight);
Please share code if you have a variant better 8-) - selmer_Beatty commented on October 8th 19 at 00:16

Find more questions by tags .NETC#Windows