8
10
self.OptionParser.add_option("-s", "--size", action="store", type="string", dest="page_size", default="a4", help="Page size")
9
11
self.OptionParser.add_option("-o", "--orientation", action="store", type="string", dest="page_orientation", default="vertical", help="Page orientation")
19
if self.options.page_size == "a5":
24
if self.options.page_size == "a4":
29
if self.options.page_size == "a3":
34
if self.options.page_size == "letter":
39
if self.options.page_orientation == "horizontal":
40
width, height = height, width
12
43
root = self.document.getroot()
13
root.set("width", "12in")
14
root.set("height", "12in")
15
if self.options.page_size == "a4" and self.options.page_orientation == "vertical":
16
root.set("width", "210mm")
17
root.set("height", "297mm")
18
if self.options.page_size == "a4" and self.options.page_orientation == "horizontal":
19
root.set("height", "210mm")
20
root.set("width", "297mm")
22
if self.options.page_size == "a5" and self.options.page_orientation == "vertical":
23
root.set("width", "148mm")
24
root.set("height", "210mm")
25
if self.options.page_size == "a5" and self.options.page_orientation == "horizontal":
26
root.set("width", "210mm")
27
root.set("height", "148mm")
29
if self.options.page_size == "a3" and self.options.page_orientation == "vertical":
30
root.set("width", "297mm")
31
root.set("height", "420mm")
32
if self.options.page_size == "a3" and self.options.page_orientation == "horizontal":
33
root.set("width", "420mm")
34
root.set("height", "297mm")
36
if self.options.page_size == "letter" and self.options.page_orientation == "vertical":
37
root.set("width", "8.5in")
38
root.set("height", "11in")
39
if self.options.page_size == "letter" and self.options.page_orientation == "horizontal":
40
root.set("width", "11in")
41
root.set("height", "8.5in")
44
root.set("id", "SVGRoot")
45
root.set("width", str(width) + units)
46
root.set("height", str(height) + units)
47
root.set("viewBox", "0 0 " + str(width) + " " + str(height) )
49
namedview = root.find(inkex.addNS('namedview', 'sodipodi'))
51
namedview = inkex.etree.SubElement( root, inkex.addNS('namedview', 'sodipodi') );
53
namedview.set(inkex.addNS('document-units', 'inkscape'), units)
55
# Until units are supported in 'cx', etc.
56
namedview.set(inkex.addNS('cx', 'inkscape'), str(self.uutounit( width, 'px' )/2.0 ) )
57
namedview.set(inkex.addNS('cy', 'inkscape'), str(self.uutounit( height, 'px' )/2.0 ) )