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.
[269 byte] By [drinkwater] at [2008-3-7]
# 1

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.

Kathleen_MSFT at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Power Packs...
# 2

Hello Kathleen,

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

drinkwater at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Power Packs...
# 3

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.

Kathleen_MSFT at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Power Packs...
# 4

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 ?

drinkwater at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Power Packs...
# 5

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)

yfdong_MSFT at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Power Packs...
# 6

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

drinkwater at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic Power Packs...