How to print using paint ?

Post

Posted
Rating:
#1 (In Topic #676)
Avatar
Regular
tincho is in the usergroup ‘Regular’
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.

Code (gambas)

  1. Public Sub ButtonPrint_Click()
  2.   If PrinterOne.Configure() Then Return
  3.   PrinterOne.Print
  4.  
  5. Public Sub PrinterOne_Draw()
  6.   Paint.DrawText(TextArea1.Text, 10, 10)

But vector images are not very well quality.
the modified code is:

Code (gambas)

  1. Private px As Float = 72 / 25.4
  2. Private xrect As New Rect(0, 0, 297, 210)
  3.  
  4. Public Sub Form_Open()
  5.   HSplit1.Layout = [1, 2]
  6.   img = Image.Load("./test.svg")
  7.  
  8. Public Sub Button1_Click()
  9.   Plotter.PaperHeight = 210
  10.   Plotter.PaperWidth = 297
  11.   Plotter.MarginBottom = 0
  12.   If Plotter.Configure() Then Return
  13.   Plotter.Print
  14.  
  15. Public Sub Plotter_Draw()
  16.   Paint.DrawImage(img, 0, 0, 297 * px, 210 * px,, xrect)

Attachment
Online now: No Back to the top
1 guest and 0 members have just viewed this.