[Gambas-user] Postscript class

Pablo Vera pvera at ...729...
Tue Jan 17 14:46:08 CET 2006


Great work Marco!

Could you post also the VB code ?, I do lot of VB programming and that 
class would be really helpful.

Saludos,
Pablo Vera

Marco Gusy wrote:
> 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




More information about the User mailing list