Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions psfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@
PSFile - Stand-alone PostScript files
"""

import time, StringIO
import time
try:
import StringIO
except ImportError:
import io as StringIO
try: basestring
except NameError: basestring = str

__version__ = '0.9'
__all__ = [ 'EPSFile', 'PSFile', 'paper_sizes' ]
Expand Down Expand Up @@ -77,9 +83,9 @@ def __init__(self, fname, ps_type="",
padding_bottom = padding_bottom if padding_bottom is not None else padding
padding_left = padding_left if padding_left is not None else padding

if self.xbase < margin_left:
if self.xbase is None or self.xbase < margin_left:
self.xbase = margin_left
if self.ybase < margin_bottom:
if self.ybase is None or self.ybase < margin_bottom:
self.ybase = margin_bottom
if self.width is None:
self.width = paper_width - margin_left - margin_right
Expand Down Expand Up @@ -320,7 +326,7 @@ def __init__(self, fname,

w = self.paper_width
h = self.paper_height
for name, dim in paper_sizes.iteritems():
for name, dim in paper_sizes.items():
if dim == (w,h):
paper = name
orientation = "Portrait"
Expand Down