Question : Is there a way to convert a printdocument to a bitmap?

I have a print document that prints 15 individual pages to the printer.  I would like to use the same code to print the document to bitmaps.  My ultimate goal is to create a powerpoint presentation using the individual pages as pictures.  I already know how to automate powerpoint but need some direction for creating bitmaps of the pages.  I do know how to create bitmaps with code, but am looking for the best method of using the code to send the pages to the printer or create a powerpoint presentation. Right now, I create the document and then use Pd.print (Dim pd As New PrintDocument) to send the document to the printer.  Is there some way to send the PD.print to bitmaps instead?  

Answer : Is there a way to convert a printdocument to a bitmap?

You draw on the graphics supplied via the "e" parameter in the PrintPage() event right?

Just pass that to a routine that accepts a graphics.  This way both the PrintPage() event can use and you can pass it a graphics from an image:

        Private Sub PD_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PD.PrintPage
            DrawingRoutine(e.Graphics)
    End Sub
 
    ...
        Dim bmp As New Bitmap(someWidth, someHeight)
        Dim G As Graphics = Graphics.FromImage(bmp)
        DrawingRoutine(G)
        G.Dispose()
 
    Private Sub DrawingRoutine(ByVal g As Graphics)

    End Sub
Random Solutions  
 
programming4us programming4us