Hi Linda,
We are not using a StreamReader. I am using a third-party toolkit to print.
Here is the code which does the printing: -
Private Sub printDocument_PrintPage(ByVal sender As Object, ByVal e As
PrintPageEventArgs) Handles _printDocument.PrintPage
' see what page number we require and load that page
Dim pageNumber As Long = _printPages(_currentPrintPage)
Dim image As RasterImage = _rasterCodecs.Load(_viewerFilename, 0,
CodecsLoadByteOrder.BgrOrGrayOrRomm, pageNumber, pageNumber)
' find the image size in pixels at this resolution
Dim destRectangle As New Rectangle(0, 0, _
CType((CType(image.ImageWidth, Single) / CType(image.XResolution,
Single) * 100.0F), Integer), _
CType((CType(image.ImageHeight, Single) /
CType(image.YResolution, Single) * 100.0F), Integer))
' paint the image onto the printer
Dim rasterPaintProperties As RasterPaintProperties =
rasterPaintProperties.Default
rasterPaintProperties.PaintEngine = RasterPaintEngine.GdiPlus
image.Paint(e.Graphics, Rectangle.Empty, Rectangle.Empty,
destRectangle, e.MarginBounds, rasterPaintProperties)
' see if we need more pages
If _currentPrintPage < _printPages.GetLength(0) - 1 Then
_currentPrintPage += 1
e.HasMorePages = True
Else
e.HasMorePages = False
End If
End Sub
As you can see, it uses the e.Graphics object to do the painting (from the
third party imaging toolkit)
If the PrintDocument has all the pages in it, and the preview shows them -
why does it not print them all - what else happens at this stage?
Many thanks,
David
[quoted text, click to view] "David Whitchurch-Bennett" wrote:
> Hi there,
>
> I am using the PrintPreviewDialog control to print a document.
>
> Pages get added on the PrintDocument_PrintPage event using HasMorePages=True
> and this way a print document is created, with all my pages (11 in this case).
>
> The preview shows all 11 pages of this particular print document beatifully.
> Everything looks great until I click print....
>
> When I click the print button, only the last page is actually printed - what
> happened to pages 1-10?!?
>
> Am I missing something obvious here?
>
> Many thanks,
>