printing from a plugin

qex

Well-known member
Joined
Apr 2, 2003
Messages
78
I am using Divils plugin example and was playing with trying to print something from a plugin. I cant figure out how to get passed the fact that I dont have a parent form that this is all being created from. So the problem is that the ev.graphics is not created in the plugin. When the code is executed I get a object reference not set to an instance of an object for the line that is trying to Calculate the linesPerPage.

When I wrote this in a standalone it works though... I assume that is because the ev.graphics is coming from the form that I called my printpage sub in. Dont really understand the graphics stuff... among other things :)

Is there a way to do this. Can I create my own page on the fly that I can then access with the ev.graphics call?

Thanks

Code:
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
       

        
         Calculate the number of lines per page.
        linesPerPage = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics)
        
        .
        .
        .
    End Sub
 
Any help here would be appreciated... maybe this is just right in front of my face and Im missing it.
 
Is there some way that I can get the page bounds from the printer settings and then create my own graphics object of that size to print on. Im starting to confuse my self.
 
figured it out... I had declared printfont but I forgot to create a new instance of the object... Dumb Dumb Dumb
 
Back
Top