2 from pdflib_py
import *
3 from math
import sin
,cos
5 PDF_open_file(p
, "textposition.pdf")
7 PDF_set_parameter(p
, "usercoordinates", "true")
11 PDF_begin_page(p
, width
, height
)
13 font
= PDF_load_font(p
, "Helvetica-Bold", "host", "")
15 PDF_setfont(p
, font
, 18.0)
19 matrices
= [[1,0,0,1,100,200],
20 [cos(a
),sin(a
),-sin(a
),cos(a
),400,75],
23 [1.9,0.5,0.6,1.4,50,-140],
24 [cos(b
),sin(b
),sin(b
),-cos(b
),100,300],
30 PDF_setmatrix(p
, m
[0],m
[1],m
[2],m
[3],m
[4],m
[5])
32 PDF_set_text_pos(p
, x
,y
)
33 w
= PDF_stringwidth(p
, "HELLO WORLD", font
, 18.0)
35 PDF_setrgbcolor_fill(p
, 0.0, 0.0, 0.0)
36 PDF_show(p
, "HELLO WORLD")
38 PDF_setrgbcolor_fill(p
, 0.0, 0.0, 1.0)
41 PDF_lineto(p
, x
+w
,y
+h
)
44 PDF_moveto(p
, x
-20,y
-20)
45 PDF_lineto(p
, x
-20,y
+20+h
)
46 PDF_lineto(p
, x
+20+w
,y
+20+h
)
47 PDF_lineto(p
, x
+20+w
,y
-20)
48 PDF_lineto(p
, x
-20,y
-20)