Code

replaceing the cut-marks extension by the printing-marks
authoraurium <aurium@users.sourceforge.net>
Mon, 1 Dec 2008 02:21:04 +0000 (02:21 +0000)
committeraurium <aurium@users.sourceforge.net>
Mon, 1 Dec 2008 02:21:04 +0000 (02:21 +0000)
share/extensions/cut-marks.inx [deleted file]
share/extensions/cut-marks.pl [deleted file]
share/extensions/inkex.py
share/extensions/printing-marks.inx [new file with mode: 0644]
share/extensions/printing-marks.py [new file with mode: 0644]

diff --git a/share/extensions/cut-marks.inx b/share/extensions/cut-marks.inx
deleted file mode 100644 (file)
index 1f05ae6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">\r
-       <_name>Add Cut Marks</_name>\r
-       <id>org.inkscape.printing.addcutmarks</id>\r
-
-  <param name="use-rect" type="boolean" _gui-text="Use the selected rect to define the margin"></param>
-
-  <param name="sep" type="description">•••••••••••••••••••••••••••••••••••••••••••••</param>
-
-  <_param name="info1" type="description">The fields above are needed only if you don't use a rect:</_param>
-
-  <param name="unit" type="enum" _gui-text="Measurement unit:">
-    <item>cm</item>
-    <item>mm</item>
-    <item>in</item>
-    <item>px</item>
-  </param>
-  <param name="margin-r" type="float" min="0.0" _gui-text="Margin right">1.0</param>
-  <param name="margin-l" type="float" min="0.0" _gui-text="Margin left">1.0</param>
-  <param name="margin-t" type="float" min="0.0" _gui-text="Margin top">1.0</param>
-  <param name="margin-b" type="float" min="0.0" _gui-text="Margin bottom">1.5</param>
-
-       <effect>\r
-               <object-type>all</object-type>\r
-               <effects-menu>\r
-                       <submenu _name="Printing"/>\r
-               </effects-menu>\r
-       </effect>\r
-
-       <script>\r
-               <command reldir="extensions" interpreter="perl">cut-marks.pl</command>\r
-       </script>\r
-
-</inkscape-extension>
diff --git a/share/extensions/cut-marks.pl b/share/extensions/cut-marks.pl
deleted file mode 100644 (file)
index dba846d..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/perl
-
-BEGIN {
-  # adding the inkscape extension dir in the include path list.
-  my $path = `inkscape -x`;
-  $path =~ s/\r?\n//;
-  push @INC, $path;
-}
-
-use strict;
-
-use Inkscape;
-my $inkscape = Inkscape->new;
-
-my %args = $inkscape->getArgs();
-my $svg = $inkscape->getSVG();
-
-my $unit = $args{unit};
-my $ml = $svg->convertUnit( $args{'margin-r'}.$unit, 'px' );
-my $mr = $svg->convertUnit( $args{'margin-l'}.$unit, 'px' );
-my $mt = $svg->convertUnit( $args{'margin-t'}.$unit, 'px' );
-my $mb = $svg->convertUnit( $args{'margin-b'}.$unit, 'px' );
-
-my ( $cw, $ch ) = $svg->getCanvasSize( 'px' );
-
-if ( $args{'use-rect'} ) {
-  if ( ! $args{id}[0] ) {
-    warn "You asked to use a rect to define the margin, but you didn\'t select an element.\n";
-    exit 1;
-  }
-  $unit = '';
-  my ( $x, $y ) = $svg->getElPosition( $args{id}[0] );
-  my ( $w, $h ) = $svg->getElSize( $args{id}[0] );
-  $mr = $x;
-  $ml = $cw - ( $x + $w );
-  $mt = $y;
-  $mb = $ch - ( $y + $h );
-}
-
-# Positions for the cut lines:
-my $cutR = $mr;
-my $cutL = $cw - $ml;
-my $cutT = $mt;
-my $cutB = $ch - $mb;
-
-# Printing test attributes:
-my $ptaCX = $cw - ( $ml / 2 );
-my $ptaCY = $ch / 4;
-my $ptaR = $ml / 2.5;
-$ptaR = $cw / 50  if ( ($cw / 50) < $ptaR );
-my $ptaBoxW = $ptaR / 1.5;
-
-my $theX = 'M '.($ptaCX-$ptaR).','.$ptaCY.' L '.($ptaCX+$ptaR).','.$ptaCY.
-           'M '.$ptaCX.','.($ptaCY-$ptaR).' L '.$ptaCX.','.($ptaCY+$ptaR);
-
-sub generateGradientTest {
-  my ( $color, $x, $y ) = @_;
-  my $boxes = '';
-  for ( my $i=0; $i<10; $i++ ) {
-    $boxes .= '<rect
-    fill="'.$color.'" fill-opacity="'.(1/($i+1)).'"
-    stroke="'.$color.'" stroke-width="0.5"
-    x="'.$x.'" y="'.($y+($ptaBoxW*$i)).'"
-    width="'.$ptaBoxW.'" height="'.$ptaBoxW.'" />';
-  }
-  return $boxes;
-}
-
-my $gradBoxes =
-     generateGradientTest( "#000", $ptaCX-$ptaBoxW-1, $ptaCY+$ptaR+10 ) .
-     generateGradientTest( "#FF0", $ptaCX+1, $ptaCY+$ptaR+10 ) .
-     generateGradientTest( "#0FF", $ptaCX-$ptaBoxW-1, $ptaCY+$ptaR+12+($ptaBoxW*10) ) .
-     generateGradientTest( "#F0F", $ptaCX+1, $ptaCY+$ptaR+12+($ptaBoxW*10) );
-
-my $marks = <<END_XML ;
-  <g
-     inkscape:groupmode="layer"
-     inkscape:label="Cut Marks"
-     sodipodi:insensitive="true"
-     style="display:inline">
-    <path fill="none" stroke="#000" stroke-width="0.5" d="
-      M $cutR,0 L $cutR,$cutT M $cutR,$cutB L $cutR,$ch
-      M $cutL,0 L $cutL,$cutT M $cutL,$cutB L $cutL,$ch
-      M 0,$cutT L $cutR,$cutT M $cutL,$cutT L $cw,$cutT
-      M 0,$cutB L $cutR,$cutB M $cutL,$cutB L $cw,$cutB
-      " />
-    <circle class="test-print-align"
-      fill="none" stroke="#000" stroke-width="0.5"
-      r="$ptaR" cx="$ptaCX" cy="$ptaCY" />
-    <path class="test-print-align"
-      fill="none" stroke="#000" stroke-width="0.5" d="$theX" />
-    $gradBoxes
-  </g>
-END_XML
-
-$svg->{code} =~ s!</svg>!$marks</svg>!g;
-
-print $svg->{code};
index 01488880bf93e38fe5e2eea9b63ac5d12ea47819..d395769d3a44a2f4c364d4cd7d7dc7884e2182bc 100755 (executable)
@@ -55,6 +55,9 @@ def unittouu(string):
             pass
     return retval
 
+def uutounit(val, unit):
+    return val/uuconv[unit]
+
 try:
     from lxml import etree
 except:
diff --git a/share/extensions/printing-marks.inx b/share/extensions/printing-marks.inx
new file mode 100644 (file)
index 0000000..011fc74
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">\r
+  <_name>Add Printing Marks</_name>\r
+  <id>org.inkscape.printing.marks</id>\r
+  <dependency type="executable" location="extensions">printing-marks.py</dependency>\r
+  <dependency type="executable" location="extensions">inkex.py</dependency>\r
+\r
+  <param name="tab" type="notebook">\r
+    <page name="tab" _gui-text="Marks">\r
+      <param name="crop_marks"          type="boolean"    _gui-text="Crop Marks">true</param>\r
+      <param name="bleed_marks"         type="boolean"    _gui-text="Bleed Marks">false</param>\r
+      <param name="registration_marks"  type="boolean"    _gui-text="Registration Marks">true</param>\r
+      <param name="star_target"         type="boolean"    _gui-text="Star Target">false</param>\r
+      <param name="colour_bars"         type="boolean"    _gui-text="Coulour Bars">true</param>\r
+      <param name="page_info"           type="boolean"    _gui-text="Page Information">false</param>\r
+    </page>\r
+    <page name="tab" _gui-text="Positioning">\r
+      <param name="where" type="enum" _gui-text="Set crop marks to">\r
+        <item>selection</item>\r
+        <item>canvas</item>\r
+      </param>\r
+      <param name="unit" type="enum" _gui-text="Unit">\r
+        <item>px</item>\r
+        <item>pt</item>\r
+        <item>in</item>\r
+        <item>cm</item>\r
+        <item>mm</item>\r
+      </param>\r
+      <param name="crop_offset"     type="float"  min="0.0"  max="9999.0"  _gui-text="Offset:">5</param>\r
+      <_param name="bleed_settings" type="description">Bleed Margin</_param>\r
+      <param name="bleed_top"       type="float"  min="0.0"  max="9999.0"  _gui-text="Top:">5</param>\r
+      <param name="bleed_bottom"    type="float"  min="0.0"  max="9999.0"  _gui-text="Bottom:">5</param>\r
+      <param name="bleed_left"      type="float"  min="0.0"  max="9999.0"  _gui-text="Left:">5</param>\r
+      <param name="bleed_right"     type="float"  min="0.0"  max="9999.0"  _gui-text="Right:">5</param>\r
+    </page>\r
+  </param>\r
+\r
+  <effect>\r
+    <object-type>all</object-type>\r
+    <effects-menu>\r
+      <submenu _name="Printing"/>\r
+    </effects-menu>\r
+  </effect>\r
+\r
+  <script>\r
+    <command reldir="extensions" interpreter="python">printing-marks.py</command>\r
+  </script>\r
+\r
+</inkscape-extension>\r
diff --git a/share/extensions/printing-marks.py b/share/extensions/printing-marks.py
new file mode 100644 (file)
index 0000000..b75f325
--- /dev/null
@@ -0,0 +1,419 @@
+#!/usr/bin/env python\r
+'''
+This extension allows you to draw crop, registration and other\r
+printing marks in Inkscape.\r
+
+Authors:
+  Nicolas Dufour - Association Inkscape-fr
+  Aurelio A. Heckert <aurium(a)gmail.com>
+
+Copyright (C) 2008 Authors
+\r
+This program is free software; you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published by\r
+the Free Software Foundation; either version 2 of the License, or\r
+(at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program; if not, write to the Free Software\r
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+'''\r
+\r
+import inkex, simplestyle, math\r
+\r
+class Printing_Marks (inkex.Effect):\r
+
+    # Default parameters
+    stroke_width = 0.25\r
+    mark_size = inkex.unittouu('1cm')\r
+    min_mark_margin = inkex.unittouu('3mm')\r
+
+    def __init__(self):\r
+        inkex.Effect.__init__(self)\r
+        self.OptionParser.add_option("--tab",\r
+                                     action="store", type="string",\r
+                                     dest="tab")\r
+        self.OptionParser.add_option("--where",\r
+                                     action="store", type="string",\r
+                                     dest="where_to_crop", default=True,\r
+                                     help="Apply crop marks to...")\r
+        self.OptionParser.add_option("--crop_marks",\r
+                                     action="store", type="inkbool",\r
+                                     dest="crop_marks", default=True,\r
+                                     help="Draw crop Marks?")\r
+        self.OptionParser.add_option("--bleed_marks",\r
+                                     action="store", type="inkbool",\r
+                                     dest="bleed_marks", default=False,\r
+                                     help="Draw Bleed Marks?")\r
+        self.OptionParser.add_option("--registration_marks",\r
+                                     action="store", type="inkbool",\r
+                                     dest="reg_marks", default=False,\r
+                                     help="Draw Registration Marks?")\r
+        self.OptionParser.add_option("--star_target",\r
+                                     action="store", type="inkbool",\r
+                                     dest="star_target", default=False,\r
+                                     help="Draw Star Target?")\r
+        self.OptionParser.add_option("--colour_bars",\r
+                                     action="store", type="inkbool",\r
+                                     dest="colour_bars", default=False,\r
+                                     help="Draw Colour Bars?")\r
+        self.OptionParser.add_option("--page_info",\r
+                                     action="store", type="inkbool",\r
+                                     dest="page_info", default=False,\r
+                                     help="Draw Page Information?")\r
+        self.OptionParser.add_option("--unit",\r
+                                     action="store", type="string",\r
+                                     dest="unit", default=100.0,\r
+                                     help="Draw measurment")\r
+        self.OptionParser.add_option("--crop_offset",\r
+                                     action="store", type="float",\r
+                                     dest="crop_offset", default=0,\r
+                                     help="Offset")\r
+        self.OptionParser.add_option("--bleed_top",\r
+                                     action="store", type="float",\r
+                                     dest="bleed_top", default=0,\r
+                                     help="Bleed Top Size")\r
+        self.OptionParser.add_option("--bleed_bottom",\r
+                                     action="store", type="float",\r
+                                     dest="bleed_bottom", default=0,\r
+                                     help="Bleed Bottom Size")\r
+        self.OptionParser.add_option("--bleed_left",\r
+                                     action="store", type="float",\r
+                                     dest="bleed_left", default=0,\r
+                                     help="Bleed Left Size")\r
+        self.OptionParser.add_option("--bleed_right",\r
+                                     action="store", type="float",\r
+                                     dest="bleed_right", default=0,\r
+                                     help="Bleed Right Size")\r
+\r
+
+    def draw_crop_line(self, x1, y1, x2, y2, name, parent):\r
+        style = { 'stroke': '#000000', 'stroke-width': str(self.stroke_width), 'fill': 'none'}\r
+        line_attribs = {'style': simplestyle.formatStyle(style),\r
+                        'id': name,\r
+                        'd': 'M '+str(x1)+','+str(y1)+' L '+str(x2)+','+str(y2)}\r
+        inkex.etree.SubElement(parent, 'path', line_attribs)\r
+\r
+    def draw_bleed_line(self, x1, y1, x2, y2, name, parent):\r
+        style = { 'stroke': '#000000', 'stroke-width': str(self.stroke_width), 'fill': 'none',\r
+                  'stroke-miterlimit': '4', 'stroke-dasharray': '4, 2, 1, 2',\r
+                  'stroke-dashoffset': '0' }\r
+        line_attribs = {'style': simplestyle.formatStyle(style),\r
+                        'id': name,\r
+                        'd': 'M '+str(x1)+','+str(y1)+' L '+str(x2)+','+str(y2)}\r
+        inkex.etree.SubElement(parent, 'path', line_attribs)\r
+\r
+    def draw_reg_circles(self, cx, cy, r, name, colours, parent):\r
+        for i in range(len(colours)):\r
+            style = {'stroke':colours[i], 'stroke-width':str(r / len(colours)),\r
+                     'fill':'none'}\r
+            circle_attribs = {'style':simplestyle.formatStyle(style),\r
+                              inkex.addNS('label','inkscape'):name,\r
+                              'cx':str(cx), 'cy':str(cy),\r
+                              'r':str((r / len(colours)) * (i + 0.5))}\r
+            inkex.etree.SubElement(parent, inkex.addNS('circle','svg'),\r
+                                   circle_attribs)\r
+\r
+    def draw_reg_marks(self, cx, cy, rotate, name, parent):\r
+        colours = ['#000000','#00ffff','#ff00ff','#ffff00','#000000']\r
+        g = inkex.etree.SubElement(parent, 'g', { 'id': name })\r
+        for i in range(len(colours)):\r
+            style = {'fill':colours[i], 'fill-opacity':'1', 'stroke':'none'}
+            r = (self.mark_size/2)\r
+            step = r\r
+            stroke = r / len(colours)\r
+            regoffset = stroke * i\r
+            regmark_attribs = {'style': simplestyle.formatStyle(style),\r
+                               'd': 'm' +\
+                               ' '+str(-regoffset)+','+str(r)  +\\r
+                               ' '+str(-stroke)   +',0'        +\\r
+                               ' '+str(step)      +','+str(-r) +\\r
+                               ' '+str(-step)     +','+str(-r) +\\r
+                               ' '+str(stroke)    +',0'        +\\r
+                               ' '+str(step)      +','+str(r)  +\\r
+                               ' '+str(-step)     +','+str(r)  +\\r
+                               ' z',\r
+                               'transform': 'translate('+str(cx)+','+str(cy)+ \
+                                            ') rotate('+str(rotate)+')'}\r
+            inkex.etree.SubElement(g, 'path', regmark_attribs)\r
+\r
+    def draw_star_target(self, cx, cy, name, parent):\r
+        r = (self.mark_size/2)\r
+        style = {'fill':'#000', 'fill-opacity':'1', 'stroke':'none'}\r
+        d = ' M 0,0'\r
+        i = 0\r
+        while i < ( 2 * math.pi ):\r
+            i += math.pi / 16\r
+            d += ' L 0,0 ' +\\r
+                 ' L '+ str(math.sin(i)*r) +','+ str(math.cos(i)*r) +\\r
+                 ' L '+ str(math.sin(i+0.09)*r) +','+ str(math.cos(i+0.09)*r)\r
+        regmark_attribs = {'style':simplestyle.formatStyle(style),\r
+                          inkex.addNS('label','inkscape'):name,\r
+                          'transform':'translate('+str(cx)+','+str(cy)+')',\r
+                          'd':d}\r
+        inkex.etree.SubElement(parent, inkex.addNS('path','svg'), regmark_attribs)\r
+
+    def draw_coluor_bars(self, cx, cy, rotate, name, parent):
+        g = inkex.etree.SubElement(parent, 'g', {
+                'id':name,
+                'transform':'translate('+str(cx)+','+str(cy)+\
+                            ') rotate('+str(rotate)+')' })\r
+        l = self.mark_size / 3\r
+        for bar in [{'c':'*', 'stroke':'#000', 'x':0,        'y':-(l+1)},
+                    {'c':'r', 'stroke':'#0FF', 'x':0,        'y':0},
+                    {'c':'g', 'stroke':'#F0F', 'x':(l*11)+1, 'y':-(l+1)},
+                    {'c':'b', 'stroke':'#FF0', 'x':(l*11)+1, 'y':0}
+                   ]:
+            i = 0\r
+            while i <= 1:
+                cr = '255'
+                cg = '255'
+                cb = '255'
+                if bar['c'] == 'r' or bar['c'] == '*' : cr = str(255*i)
+                if bar['c'] == 'g' or bar['c'] == '*' : cg = str(255*i)
+                if bar['c'] == 'b' or bar['c'] == '*' : cb = str(255*i)
+                r_att = {'fill':'rgb('+cr+','+cg+','+cb+')',
+                         'stroke':bar['stroke'],
+                         'x':str((l*i*10)+bar['x']), 'y':str(bar['y']),
+                         'width':str(l), 'height':str(l)}
+                r = inkex.etree.SubElement(g, 'rect', r_att)\r
+                i += 0.1
+\r
+    def effect(self):\r
+
+        if self.options.where_to_crop == 'selection' :
+            inkex.errormsg('Sory, the crop to selection is a TODO feature')
+\r
+        # Get SVG document dimensions\r
+        svg = self.document.getroot()\r
+        width  = inkex.unittouu(svg.get('width'))\r
+        height = inkex.unittouu(svg.attrib['height'])\r
+\r
+        # Convert parameters to user unit\r
+        offset = inkex.unittouu(str(self.options.crop_offset) + self.options.unit)\r
+        bt = inkex.unittouu(str(self.options.bleed_top)    + self.options.unit)\r
+        bb = inkex.unittouu(str(self.options.bleed_bottom) + self.options.unit)\r
+        bl = inkex.unittouu(str(self.options.bleed_left)   + self.options.unit)\r
+        br = inkex.unittouu(str(self.options.bleed_right)  + self.options.unit)\r
+        # Bleed margin
+        if bt < offset : bmt = 0
+        else :           bmt = bt - offset\r
+        if bb < offset : bmb = 0
+        else :           bmb = bb - offset\r
+        if bl < offset : bml = 0
+        else :           bml = bl - offset\r
+        if br < offset : bmr = 0
+        else :           bmr = br - offset\r
+
+        # Define the new document limits\r
+        left   = - offset\r
+        right  = width + offset\r
+        top    = - offset\r
+        bottom = height + offset
+\r
+        # Create a new layer\r
+        layer = inkex.etree.SubElement(svg, 'g')\r
+        layer.set('id', 'printing-marks')\r
+        layer.set(inkex.addNS('label', 'inkscape'), 'Printing Marks')\r
+        layer.set(inkex.addNS('groupmode', 'inkscape'), 'layer')\r
+\r
+        # Crop Mark\r
+        if self.options.crop_marks == True:\r
+            # Create a group for Crop Mark\r
+            g_attribs = {inkex.addNS('label','inkscape'):'CropMarks',
+                                                    'id':'CropMarks'}\r
+            g_crops = inkex.etree.SubElement(layer, 'g', g_attribs)\r
+\r
+            # Top left Mark\r
+            self.draw_crop_line(0, top,
+                                0, top - self.mark_size,
+                                'cropTL1', g_crops)\r
+            self.draw_crop_line(left, 0,
+                                left - self.mark_size, 0,
+                                'cropTL2', g_crops)\r
+\r
+            # Top right Mark\r
+            self.draw_crop_line(width, top,
+                                width , top - self.mark_size,
+                                'cropTR1', g_crops)\r
+            self.draw_crop_line(right, 0,
+                                right + self.mark_size, 0,
+                                'cropTR2', g_crops)\r
+\r
+            # Bottom left Mark\r
+            self.draw_crop_line(0, bottom,
+                                0, bottom + self.mark_size,
+                                'cropBL1', g_crops)\r
+            self.draw_crop_line(left, height,
+                                left - self.mark_size, height,
+                                'cropBL2', g_crops)\r
+\r
+            # Bottom right Mark\r
+            self.draw_crop_line(width, bottom,
+                                width, bottom + self.mark_size,
+                                'cropBR1', g_crops)\r
+            self.draw_crop_line(right, height,
+                                right + self.mark_size, height,
+                                'cropBR2', g_crops)\r
+\r
+        # Bleed Mark\r
+        if self.options.bleed_marks == True:\r
+            # Create a group for Bleed Mark\r
+            g_attribs = {inkex.addNS('label','inkscape'):'BleedMarks',
+                                                    'id':'BleedMarks'}\r
+            g_bleed = inkex.etree.SubElement(layer, 'g', g_attribs)\r
+\r
+            # Top left Mark
+            self.draw_bleed_line(-bl, top - bmt,
+                                 -bl, top - bmt - self.mark_size,
+                                 'bleedTL1', g_bleed)\r
+            self.draw_bleed_line(left - bml, -bt,
+                                 left - bml - self.mark_size, -bt,
+                                 'bleedTL2', g_bleed)\r
+\r
+            # Top right Mark\r
+            self.draw_bleed_line(width + br, top - bmt,
+                                 width + br, top - bmt - self.mark_size,
+                                 'bleedTR1', g_bleed)\r
+            self.draw_bleed_line(right + bmr, -bt,\r
+                                 right + bmr + self.mark_size, -bt,
+                                 'bleedTR2', g_bleed)\r
+\r
+            # Bottom left Mark\r
+            self.draw_bleed_line(-bl, bottom + bmb,\r
+                                 -bl, bottom + bmb + self.mark_size,\r
+                                 'bleedBL1', g_bleed)\r
+            self.draw_bleed_line(left - bml, height + bb,\r
+                                 left - bml - self.mark_size, height + bb,\r
+                                 'bleedBL2', g_bleed)   \r
+\r
+            # Bottom right Mark\r
+            self.draw_bleed_line(width + br, bottom + bmb,\r
+                                 width + br, bottom + bmb + self.mark_size,\r
+                                 'bleedBR1', g_bleed)\r
+            self.draw_bleed_line(right + bmr, height + bb,\r
+                                 right + bmr + self.mark_size, height + bb,\r
+                                 'bleedBR2', g_bleed)\r
+\r
+        # Registration Mark\r
+        if self.options.reg_marks == True:\r
+            # Create a group for Registration Mark\r
+            g_attribs = {inkex.addNS('label','inkscape'):'RegistrationMarks',
+                                                    'id':'RegistrationMarks'}\r
+            g_center = inkex.etree.SubElement(layer, 'g', g_attribs)
+\r
+            # Left Mark
+            cx = max( bml + offset, self.min_mark_margin )\r
+            self.draw_reg_marks(-cx - (self.mark_size/2),
+                                (height/2) - self.mark_size*1.5,\r
+                                '0', 'regMarkL', g_center)\r
+\r
+            # Right Mark\r
+            cx = max( bmr + offset, self.min_mark_margin )\r
+            self.draw_reg_marks(width + cx + (self.mark_size/2),
+                                (height/2) - self.mark_size*1.5,\r
+                                '180', 'regMarkR', g_center)\r
+\r
+            # Top Mark\r
+            cy = max( bmt + offset, self.min_mark_margin )\r
+            self.draw_reg_marks((width/2) - self.mark_size*1.5,
+                                -cy - (self.mark_size/2),\r
+                                '90', 'regMarkT', g_center)\r
+\r
+            # Bottom Mark\r
+            cy = max( bmb + offset, self.min_mark_margin )\r
+            self.draw_reg_marks((width/2) - self.mark_size*1.5,\r
+                                height + cy + (self.mark_size/2),\r
+                                '-90', 'regMarkB', g_center)\r
+\r
+        # Star Target\r
+        if self.options.star_target == True:\r
+            # Create a group for Star Target\r
+            g_attribs = {inkex.addNS('label','inkscape'):'StarTarget',
+                                                    'id':'StarTarget'}\r
+            g_center = inkex.etree.SubElement(layer, 'g', g_attribs)\r
+
+            if height < width :\r
+                # Left Star\r
+                cx = max( bml + offset, self.min_mark_margin )\r
+                self.draw_star_target(-cx - (self.mark_size/2),
+                                      (height/2),\r
+                                      'starTargetL', g_center)
+                # Right Star\r
+                cx = max( bmr + offset, self.min_mark_margin )\r
+                self.draw_star_target(width + cx + (self.mark_size/2),
+                                      (height/2),\r
+                                      'starTargetR', g_center)\r
+            else :\r
+                # Top Star\r
+                cy = max( bmt + offset, self.min_mark_margin )\r
+                self.draw_star_target((width/2),
+                                      -cy - (self.mark_size/2),\r
+                                      'starTargetT', g_center)\r
+                # Bottom Star\r
+                cy = max( bmb + offset, self.min_mark_margin )\r
+                self.draw_star_target((width/2),\r
+                                      height + cy + (self.mark_size/2),\r
+                                      'starTargetB', g_center)\r
+
+\r
+        # Colour Bars\r
+        if self.options.colour_bars == True:\r
+            # Create a group for Colour Bars\r
+            g_attribs = {inkex.addNS('label','inkscape'):'ColourBars',
+                                                    'id':'PrintingColourBars'}\r
+            g_center = inkex.etree.SubElement(layer, 'g', g_attribs)\r
+
+            if height > width :\r
+                # Left Bars\r
+                cx = max( bml + offset, self.min_mark_margin )\r
+                self.draw_coluor_bars(-cx - (self.mark_size/2),
+                                      height/2,
+                                      90,\r
+                                      'PrintingColourBarsL', g_center)\r
+                # Right Bars\r
+                cx = max( bmr + offset, self.min_mark_margin )\r
+                self.draw_coluor_bars(width + cx + (self.mark_size/2),
+                                      height/2,
+                                      90,\r
+                                      'PrintingColourBarsR', g_center)\r
+            else :\r
+                # Top Bars\r
+                cy = max( bmt + offset, self.min_mark_margin )\r
+                self.draw_coluor_bars(width/2,
+                                      -cy - (self.mark_size/2),
+                                      0,\r
+                                      'PrintingColourBarsT', g_center)\r
+                # Bottom Bars\r
+                cy = max( bmb + offset, self.min_mark_margin )\r
+                self.draw_coluor_bars(width/2,
+                                      height + cy + (self.mark_size/2),
+                                      0,\r
+                                      'PrintingColourBarsB', g_center)\r
+\r
+\r
+        # Page Information\r
+        if self.options.page_info == True:\r
+            # Create a group for Page Information\r
+            g_attribs = {inkex.addNS('label','inkscape'):'PageInformation',
+                                                    'id':'PageInformation'}\r
+            g_pag_info = inkex.etree.SubElement(layer, 'g', g_attribs)
+            y_margin = max( bmb + offset, self.min_mark_margin )\r
+            txt_attribs = {'style':'font-size:12px;font-style:normal;font-weight:normal;fill:#000000;font-family:Bitstream Vera Sans,sans-serif;text-anchor:middle;text-align:center',
+                           'x':str(width/2), 'y':str(height+y_margin+self.mark_size+20)}\r
+            txt = inkex.etree.SubElement(g_pag_info, 'text', txt_attribs)
+            txt.text = 'Page size: ' +\
+                       str(round(inkex.uutounit(width,self.options.unit),2)) +\
+                       'x' +\
+                       str(round(inkex.uutounit(height,self.options.unit),2)) +\
+                       ' ' + self.options.unit\r
+\r
+\r
+if __name__ == '__main__':\r
+    e = Printing_Marks()\r
+    e.affect()\r