How to print using paint ?

Post your Gambas programming questions here.
Post Reply
User avatar
tincho
Posts: 41
Joined: Wednesday 10th July 2019 1:12pm

How to print using paint ?

Post by tincho » Thursday 20th May 2021 12:16pm

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
Attachments
plotter-0.0.1.tar.gz
(17.28 KiB) Downloaded 25 times

Post Reply