more parameter refactoring
[swftools.git] / spec / links.py
1 from sys import * 
2 from pdflib_py import * 
3 p = PDF_new() 
4 PDF_open_file(p, "links.pdf")
5
6 PDF_set_parameter(p, "usercoordinates", "true")
7 PDF_set_info(p, "Creator", "links.py")
8
9 width=200
10 height=200
11
12 PDF_begin_page(p, width, height)
13 def draw_link(x1,y1,x2,y2,url):
14     action = PDF_create_action(p, "URI", "url="+url);
15     optlist = "action={activate "+str(action)+"} linewidth=5"
16     PDF_create_annotation(p, x1,y1,x2,y2, "Link", optlist);
17 draw_link(0, 0, 100, 100, "http://www.swftools.org")
18 draw_link(0, 100, 100, 200, "http://www.quiss.org")
19 PDF_end_page(p)
20
21 PDF_begin_page(p, width, height)
22 draw_link(0, 0, 100, 100, "http://www.pdf2swf.org")
23 PDF_end_page(p)
24
25 PDF_close(p)
26 PDF_delete(p);