We try to print the result of render action but the printing flow that is just created seems to be more larger than the paper size. So we want to adjust the printing area by a pretty common solution that is used with System.Drawing.Graphics component by DrawImage.
Rectangle printableFinal = new Rectangle(0, 0, 500, 500);
g.DrawImage(imgageToPrint, printableFinal);
Here is the end of our source code that provide a flow to be print :
[...]
// Définit l'évènement d'impression
printDocument.PrintPage += (sender, e) => PrintDOC(sender, e, wpfWindow);
// NOT WORKING CODE - Because "gdiRender.RasterImage" is NULL !!!
// Rectangle printableFinal = new Rectangle(0, 0, 500, 500);
// Bitmap imgageToPrint = gdiRenderer.RasterImage;
// imgageToPrintAP = gdiRenderer.GraphicsWrapper.IdMapRaster;
// g.DrawImage(imgageToPrintAP, printableFinal);
}
Printing action is working, our wpfWindow is perfectly print on the paper but element is to huge to fit on page. So we are trying to redure this element during the rendering process or just after to make the element be scale juste before the printing process.
We notice some problems on the component but we don't know if it is a bug or a bad use of it :
"gdiRenderer.RasterImage" provide a NULL value just after "gdiRenderer.Render(..." instruction
"gdiRenderer.IdMapRaster" provide a 180x180 empty image !
We need to catch the result flow of "gdiRenderer.Render" action.
How can we do that ?
Hello,
We try to print the result of render action but the printing flow that is just created seems to be more larger than the paper size. So we want to adjust the printing area by a pretty common solution that is used with System.Drawing.Graphics component by DrawImage. Rectangle printableFinal = new Rectangle(0, 0, 500, 500); g.DrawImage(imgageToPrint, printableFinal);
Here is the end of our source code that provide a flow to be print : [...] // Définit l'évènement d'impression printDocument.PrintPage += (sender, e) => PrintDOC(sender, e, wpfWindow);
// NOT WORKING CODE - Because "gdiRender.RasterImage" is NULL !!! // Rectangle printableFinal = new Rectangle(0, 0, 500, 500); // Bitmap imgageToPrint = gdiRenderer.RasterImage; // imgageToPrintAP = gdiRenderer.GraphicsWrapper.IdMapRaster; // g.DrawImage(imgageToPrintAP, printableFinal); }
Printing action is working, our wpfWindow is perfectly print on the paper but element is to huge to fit on page. So we are trying to redure this element during the rendering process or just after to make the element be scale juste before the printing process.
We notice some problems on the component but we don't know if it is a bug or a bad use of it :
"gdiRenderer.RasterImage" provide a NULL value just after "gdiRenderer.Render(..." instruction "gdiRenderer.IdMapRaster" provide a 180x180 empty image !
We need to catch the result flow of "gdiRenderer.Render" action. How can we do that ?
Thanks for helping us.
Regards,
Jean-Pascal
This work item was migrated from CodePlex
CodePlex work item ID: '1583' Vote count: '1'