title: Inkscape extension in Python
body: <p>For my project work, I am using Inkscape for two tasks:</p>
  
  <ol>
  <li>To resize the page of a drawing (which I have created with another software) to fit exactly the drawing: <code>File</code> --> <code>Document Properties</code> --> <code>Resize page to content...</code></li>
  <li>Save the file as PDF</li>
  </ol>
  
  <p>This tasks are rather simple, however they are time-consuming for larger amount of drawings.</p>
  
  <p>I checked for macros functionality in Inkscape but there is no such thing. However I found out that Inkscape allows one to implement his own extension scripts using Python.</p>
  
  <p>If any of you has similar experience, could you help me implement the steps listed above as an Inkscape extension.</p>
  
  <p>Potentially useful link: <a href="http://wiki.inkscape.org/wiki/index.php/PythonEffectTutorial" rel="nofollow">http://wiki.inkscape.org/wiki/index.php/PythonEffectTutorial</a></p>
  
  <p><strong>EDIT</strong>: the accepted answer does not solve my request using internal python extension, but it solves the task by using the <code>inkscape</code> command-line options.</p>