Page 1 of 1

How to print using paint ?

Posted: Thursday 20th May 2021 12:16pm
by tincho
Hi,
I want to print in my local printer with paint from two sources an SVG file and a Paint class.
I use as base the Printing_Example from Cogier, in Gambas Farm, then i modify it.
Public Sub ButtonPrint_Click()
  If PrinterOne.Configure() Then Return
  PrinterOne.Print
End

Public Sub PrinterOne_Draw()
  Paint.DrawText(TextArea1.Text, 10, 10)
End
But vector images are not very well quality.
the modified code is:
Private img As Image
Private px As Float = 72 / 25.4
Private xrect As New Rect(0, 0, 297, 210)

Public Sub Form_Open()
  HSplit1.Layout = [1, 2]
  img = Image.Load("./test.svg")
End

Public Sub Button1_Click()
  Plotter.PaperHeight = 210
  Plotter.PaperWidth = 297
  Plotter.MarginBottom = 0
  If Plotter.Configure() Then Return
  Plotter.Print
End

Public Sub Plotter_Draw()
  Paint.DrawImage(img, 0, 0, 297 * px, 210 * px,, xrect)
End