[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2009-12-23
Medium Priority
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 86

Accepted Solution

Mike Tomlinson earned 2000 total points
ID: 26117464
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

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


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

873 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