Printer compatability library source code ?

Is the source code available somewhere I don't want to emulate the VB 6.0 printer object - I just want to avoid using the stupid event driven .Net PrintDocument - I want to control page breaks myself - like in the VB Printer model. Having the source code would help.

Answer this question

Printer compatability library source code ?

  • Sean Shanny

    Hello Kathleen,

    Yes, I would appreciate it very much if you could explain the technique used !


  • Mark Challen

    Hi DrinkWater,

    Printer object is written in VB.Net. It is a layer of abstraction on the System.Drawing.PrintDocument that shipped with VS 2005.



  • luca82

    It would be nice to have the source code to be able to see exactly how the page breaks are done. That's really what I am trying to emulate but can't figure out how control the page breaks myself.

    Can you offer any guidance if you can't offer the source code


  • nikos_22

    Hello, Drinkwater,

    Currently only the binary is available. But if you want to work deeper on the technique details, we would like to discuss with you.



  • Daticus

    This is almost exactly what I want ! Any way to get the output into a PrintPreviewControl


  • Bilal Lodhi

    The following code shows how to control page breaks by yourself.   Hope it will solve your problem.

            Imports System.Drawing
            Imports System.Drawing.Printing

     

            Dim document As New PrintDocument
            Dim controller As PrintController = document.PrintController
            Dim pageSettings As PageSettings = document.DefaultPageSettings

            Dim printEventArgs As New PrintEventArgs
            Dim printPageEventArgs As New PrintPageEventArgs(Nothing, _
                pageSettings.Bounds, pageSettings.Bounds, pageSettings)

            Dim g As Graphics

            controller.OnStartPrint(document, printEventArgs)

            g = controller.OnStartPage(document, printPageEventArgs)
            g.DrawString("Page 1", SystemFonts.CaptionFont, Brushes.Black, 0, 0)
            controller.OnEndPage(document, printPageEventArgs)

            g = controller.OnStartPage(document, printPageEventArgs)
            g.DrawString("Page 2", SystemFonts.CaptionFont, Brushes.Black, 0, 0)
            controller.OnEndPage(document, printPageEventArgs)

            controller.OnEndPrint(document, printEventArgs)

     



  • Printer compatability library source code ?