[Gambas-user] Postscript class

Marco Gusy picander78 at ...325...
Tue Jan 17 13:41:02 CET 2006


This isn't heavyly tested, I just translated it from Visual Basic code... but seems to work
Some instructions are in Italian :-) well if you like this i'm going to modify for world use...

Add this class to a new project, create a form with one button


PUBLIC SUB Button1_Click()
  DIM sh AS Process
  DIM f AS File
  DIM cls AS CPostscript
  cls = NEW CPostscript
  cls.InizializzaPS
  cls.x = 1
  cls.y = 2
  cls.fontsize = 20
  cls.Pr("Ciao! I can postscript with gambas!")
  cls.Linea(1, 2, cls.mdx, 2)


  cls.Linea(10, 3, 10, 13)
  cls.Linea(13, 3, 13, 13)

  cls.FontSize = 11

  cls.x = 10
  cls.y = 3 + cls.TH
  cls.Pr("Left orientation")

  cls.y = cls.y + cls.th * 2
  cls.x = 13
  cls.Right("Right orientation")

  cls.y = cls.y + cls.th * 2
  cls.x = 11.5
  cls.Center("CENTER!")

  cls.y = cls.y + cls.th * 2
  cls.x = 10
  cls.Justify("And of course i wrote a function supporting justified text", 3)


  cls.Linea(4, 2.9, 5, 5.5)
  cls.Linea(5, 5.5, 2.8, 3.9)
  cls.Linea(2.8, 3.9, 5.2, 3.9)
  cls.Linea(5.2, 3.9, 3.1, 5.5)
  cls.Linea(3.1, 5.5, 4, 2.9)
  cls.EndPS

  OPEN "/tmp/temp.ps" FOR WRITE CREATE AS #f
  PRINT #f, cls.PSstring;
  CLOSE #f

  EXEC ["kghostview", "/tmp/temp.ps"]
END
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CPostscript.class.bz2
Type: application/x-bzip2
Size: 2792 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20060117/7a2ca401/attachment.bin>


More information about the User mailing list