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

Posted on 2009-12-23
Last Modified: 2012-05-08
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?  
Question by:GCCal
    LVL 85

    Accepted Solution

    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
        End Sub
            Dim bmp As New Bitmap(someWidth, someHeight)
            Dim G As Graphics = Graphics.FromImage(bmp)
        Private Sub DrawingRoutine(ByVal g As Graphics)

        End Sub

    Author Closing Comment

    Oh yes, I see how that will work.  Many thanks and I will try it out in my application.


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now