Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

There is a problem with the sizing of static frames when size is used…

… in @page. Since @frame is parsed before @page the size of the page has not been set and the dimensions of the frame are not accurately determined. If the following changes are made then the frame can be sized properly.
  • Loading branch information...
commit bc1ecca1f4eb80e7ded1372b2e4ae3c3d1e10c27 1 parent ef2458a
authored December 27, 2011

Showing 1 changed file with 6 additions and 3 deletions. Show diff stats Hide diff stats

  1. 9  xhtml2pdf/context.py
9  xhtml2pdf/context.py
@@ -184,10 +184,10 @@ def _pisaAddFrame(self, name, data, first=False, border=None, size=(0,0)):
184 184
         #if not (w and h):
185 185
         #    return None
186 186
         if first:
187  
-            return (name, None, data.get("-pdf-frame-border", border), x, y, w, h)
  187
+            return (name, None, data.get("-pdf-frame-border", border), x, y, w, h, data)
188 188
         
189 189
         return (name, data.get("-pdf-frame-content", None), 
190  
-                data.get("-pdf-frame-border", border), x, y, w, h)
  190
+                data.get("-pdf-frame-border", border), x, y, w, h, data)
191 191
 
192 192
     def atPage(self, name, pseudopage, declarations):
193 193
         c = self.c
@@ -246,7 +246,10 @@ def atPage(self, name, pseudopage, declarations):
246 246
         # Frames have to be calculated after we know the pagesize
247 247
         frameList = []
248 248
         staticList = []
249  
-        for fname, static, border, x, y, w, h in c.frameList:
  249
+        for fname, static, border, x, y, w, h, fdata in c.frameList:
  250
+            #fix frame sizing problem.
  251
+            if static:
  252
+                x, y, w, h = getFrameDimensions(fdata, c.pageSize[0], c.pageSize[1])
250 253
             x, y, w, h = getCoords(x, y, w, h, c.pageSize)
251 254
             if w <= 0 or h <= 0:
252 255
                 log.warn(self.c.warning("Negative width or height of frame. Check @frame definitions."))

1 note on commit bc1ecca

Chris Glass

Nice!

Please sign in to comment.
Something went wrong with that request. Please try again.