diff options
Diffstat (limited to 'doc/language-bindings/python-intro.html')
-rw-r--r-- | doc/language-bindings/python-intro.html | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/doc/language-bindings/python-intro.html b/doc/language-bindings/python-intro.html new file mode 100644 index 00000000..6236219b --- /dev/null +++ b/doc/language-bindings/python-intro.html @@ -0,0 +1,114 @@ +<html lang="en"> + <head> + <title>Ghostscript language bindings</title> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"> + <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,200i,300,300i,400,400i,600,600i,700,700i,900,900i" rel="stylesheet"> + <link rel="shortcut icon" type="image/png" href="../images/favicon.png"> + <link href="css/default.css" rel="stylesheet" type="text/css" /> + <script type="text/javascript" src="js/default.js"></script> + </head> + + <body> + + <header><h1></h1><div class="menu-icon" onclick="javascript:showMenu();"></div></header> + + <div id="burger-menu"> + <div class="navigation"> + <div class="title first">Introduction</div> + <div class="link"><a href="index.html">About our APIs</a></div> + <div class="link"><a href="demo-code.html">Demo code</a></div> + + <div class="title">C#</div> + <div class="link"><a href="c-sharp-intro.html">Overview</a></div> + <div class="link"><a href="c-sharp-ghost-api.html">GhostAPI</a></div> + <div class="link"><a href="c-sharp-ghost-net.html">GhostNET</a></div> + <div class="link"><a href="c-sharp-ghost-mono.html">GhostMono</a></div> + + <div class="title">Java</div> + <div class="link"><a href="java-intro.html">Overview</a></div> + <div class="link"><a href="java-gsjavajar.html">gsjava.jar</a></div> + + <div class="title">Python</div> + <div class="link selected"><a href="python-intro.html">Overview</a></div> + <div class="link"><a href="python-gsapi.html">gsapi.py</a></div> + </div> + </div> + <div class="main"> + + <div class="left"> + <div class="title first">Introduction</div> + <div class="link"><a href="index.html">About our APIs</a></div> + <div class="link"><a href="demo-code.html">Demo code</a></div> + + <div class="title">C#</div> + <div class="link"><a href="c-sharp-intro.html">Overview</a></div> + <div class="link"><a href="c-sharp-ghost-api.html">GhostAPI</a></div> + <div class="link"><a href="c-sharp-ghost-net.html">GhostNET</a></div> + <div class="link"><a href="c-sharp-ghost-mono.html">GhostMono</a></div> + + <div class="title">Java</div> + <div class="link"><a href="java-intro.html">Overview</a></div> + <div class="link"><a href="java-gsjavajar.html">gsjava.jar</a></div> + + <div class="title">Python</div> + <div class="link selected"><a href="python-intro.html">Overview</a></div> + <div class="link"><a href="python-gsapi.html">gsapi.py</a></div> + </div> + + <div class="middle"> + +<!-- note: don't tab indent <article> as it has <pre> code which will have its layout adversly affected --> +<article class="markdown-body entry-content"><h1 id="python-overview">Python overview</h1> +<div class="banner"> +<div class="python-text"></div> +<div class="vendor-logo python-logo"></div> +</div> + +<h2 id="about">About</h2> +<p>The <code>Python</code> API is provided by the file <a href="python-gsapi">gsapi.py</a> - this is the binding to the Ghostscript <code>C</code> library.</p> +<p>In the <a href="https://github.com/ArtifexSoftware/ghostpdl">GhostPDL repository</a> sample <code>Python</code> examples can be found in <code>/demos/python/examples.py</code>.</p> +<h2 id="platform-setup">Platform & setup</h2> +<h3 id="building-ghostscript">Building Ghostscript</h3> +<p>Ghostscript should be built as a shared library for your platform.</p> +<p>See <a href="index.html#building-ghostscript">Building Ghostscript</a>.</p> +<h2 id="specifying-the-ghostscript-shared-library">Specifying the Ghostscript shared library</h2> +<p>Two environmental variables can be used to specify where to find the Ghostscript shared library.</p> +<p><code>GSAPI_LIB</code> sets the exact path of the Ghostscript shared library, otherwise, <code>GSAPI_LIBDIR</code> sets the directory containing the Ghostscript shared library.</p> +<p>If neither is defined we will use the OS's default location(s) for shared libraries.</p> +<p>If <code>GSAPI_LIB</code> is not defined, the leafname of the shared library is inferred +from the OS type - <code>libgs.so</code> on Unix, <code>libgs.dylib</code> on MacOS, <code>gsdll64.dll</code> on Windows 64.</p> +<h2 id="api-test">API test</h2> +<p>The <code>gsapi.py</code> file that provides the <code>Python</code> bindings can also be used to test the bindings, by running it directly.</p> +<p>Assuming that your Ghostscript library has successfully been created, then from the root of your <code>ghostpdl</code> checkout run:</p> +<h4 id="windows">Windows</h4> +<div class="tag shellCommand"> from ghostpdl</div> + +<pre><code>// Run gsapi.py as a test script in a cmd.exe window: +set GSAPI_LIBDIR=debugbin&& python ./demos/python/gsapi.py + +// Run gsapi.py as a test script in a PowerShell window: +cmd /C "set GSAPI_LIBDIR=debugbin&& python ./demos/python/gsapi.py"</code></pre><h4 id="linux-openbsd-macos">Linux/OpenBSD/MacOS</h4> +<div class="tag shellCommand"> from ghostpdl</div> + +<pre><code>// Run gsapi.py as a test script: +GSAPI_LIBDIR=sodebugbin ./demos/python/gsapi.py</code></pre><p>If there are no errors then this will have validated that the Ghostscript library is present & operational.</p> +</article> + + </div> <!-- /middle --> + + <div class="right"> + <div class="link"><a href="#about">About</a></div> + <div class="link"><a href="#platform-setup">Platform & setup</a></div> + <div class="sub-link"><a href="#building-ghostscript">Building Ghostscript</a></div> + <div class="link"><a href="#specifying-the-ghostscript-shared-library">Specifying the Ghostscript shared library</a></div> + <div class="link"><a href="#api-test">API test</a></div> + </div> + + </div> + + <footer></footer> + + </body> + +</html> |