Julian Diaz avatar Julian Diaz committed efbb3e0

Windows Support added

Comments (0)

Files changed (2)

     
     brew install poppler
 
+For **Windows** you will need to install this two packages:
+
+* `Xpdf package <http://www.foolabs.com/xpdf/download.html>`__
+* `NetPbm for Windows package <http://gnuwin32.sourceforge.net/packages/netpbm.htm>`__
+  
+  If you don't want to install these packages, you can use only the files nedded.
+  
+    From Xpdf
+
+    * ``pdftoppm`` 
+  
+    From NetPbm
+  
+    * ``pnmcrop.exe`` 
+    * ``pnmtopng.exe``
+    * ``libnetpbm10.dll``
+    * ``libpng13.dll``
+    * ``rgb.txt``
+
+    Put these files in one folder and add the folder to the system path. 
+
+    Also, you need to create a new system variable *RGBDEF=C:\\TikzSphinx\\rgb.txt* assuming you copy the files to the C:\\TikzSphinx folder.
+
+  Additional note to windows install: If using an earlier version of the extension, you may need to modify the tikz.py file. Line
+
+    .. code-block:: python
+
+      p1 = Popen(['pnmcrop', 'tikz-1.ppm'], stdout=PIPE, stderr=PIPE)
+
+    To:
+
+    .. code-block:: python
+
+      p1 = Popen(['pnmcrop', 'tikz-000001.ppm'], stdout=PIPE, stderr=PIPE) 
+
 Configuration
 -------------
 

sphinxcontrib/tikz.py

     
 from sphinx.util.compat import Directive
 
+_Win_ = sys.platform[0:3] == 'win'
+
 class TikzExtError(SphinxError):
     category = 'Tikz extension error'
 
     # stdout, stderr = p1.communicate()
 
     try:
-        p = Popen(['pdftoppm', '-r', '120', '-singlefile', 'tikz.pdf', 'tikz'],
+        if _Win_:
+            p = Popen(['pdftoppm', '-r', '120', 'tikz.pdf', 'tikz'], 
+                  stdout=PIPE, stderr=PIPE)
+        else:
+            p = Popen(['pdftoppm', '-r', '120', '-singlefile', 'tikz.pdf', 'tikz'],
                   stdout=PIPE, stderr=PIPE)
     except OSError, e:
         if e.errno != ENOENT:   # No such file or directory
 
     elif self.builder.config.tikz_proc_suite == 'Netpbm':
         try:
-            p1 = Popen(['pnmcrop', 'tikz.ppm'], stdout=PIPE, stderr=PIPE)
+            if _Win_:
+                p1 = Popen(['pnmcrop', 'tikz-000001.ppm'], stdout=PIPE, stderr=PIPE)
+            else:
+                p1 = Popen(['pnmcrop', 'tikz.ppm'], stdout=PIPE, stderr=PIPE)
         except OSError, err:
             if err.errno != ENOENT:   # No such file or directory
                 raise
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.