3 sys.path += ["../scripts/"]
6 # a test for transparency groups:
7 # form xobjects used for doing transparency groups can do savestate (q)
8 # without ever needing to do a corresponding restorestate (Q) because
9 # their content stream is self-contained.
11 # Test that this doesn't confuse the pdf reader.
15 page = file.add_page(612,100)
17 group1 = file.create_object("/XObject", "/Form")
21 10 10 m 70 10 l 70 70 l 10 70 l 10 10 l f
22 10 10 m 70 10 l 70 70 l 10 70 l 10 10 l s
25 30 30 m 90 30 l 90 90 l 30 90 l 30 30 l f
26 30 30 m 90 30 l 90 90 l 30 90 l 30 30 l s
27 1.0 0 0 1.0 1000 1000 cm q
28 1.0 0 0 1.0 1000 1000 cm q
29 1.0 0 0 1.0 1000 1000 cm q
30 1.0 0 0 1.0 1000 1000 cm q
34 group1["/Group"] = pdf.PDFDict({"/S": "/Transparency", "/CS": "/DeviceRGB", "/I": isolated, "/K": knockout})
35 group1["/BBox"] = pdf.PDFArray([0, 0, 100, 100])
37 gs = file.create_object("/ExtGState")
39 gs["/CA"] = "1.0" # stroke alpha
40 gs["/ca"] = "1.0" # fill alpha
42 resources = file.create_object("/Resources")
43 resources["/XObject"] = pdf.PDFDict({"/mygroup": group1})
44 resources["/ExtGState"] = pdf.PDFDict({"/gs0": gs})
46 page.header["/Resources"] = resources
52 0 40 m 612 40 l 612 60 l 0 60 l 0 40 l f
53 q /gs0 gs 1.0 0 0 1.0 0 0 cm /mygroup Do Q
57 file.write("transpstack.pdf")