List Info

Thread: Multipage Postscript printing from canvas




Multipage Postscript printing from canvas
country flaguser name
Switzerland
2007-02-20 05:04:17

Hi all,

 

In my application I am creating an editor using a scrollable canvas as the main widget. I want to provide a print option for the canvas, creating a multi-page A4/letter format postscript. I made the following method to split the content of the canvas into many postscript files, which will be later send to the printer or joined together to a single file, but I have many problems.

  1. How do I create an A4 or letter format page?
  2. What is the conversion between pixels in the Canvas and points in the postscript?
  3. What is the best way to split the pages?
  4. How do I merge everything into a multi-page postscript?

 

class InputCanvas(Canvas):

           ; …

           ; def printer(self,filename):

           ;           ;  bbox = map(int,self.canvas.cget("scrollregion").split())

           ;           ;  if bbox is None: return

           ;           ;  (x,y,w,h) = bbox

           ;           ;  height = 1000   ;           ;  # For the moment arbitrarily chosen!

           ;           ;  for y in range(0,h,height):

           ;           ;           ;   self.canvas.postscript(

           ;           ;           ;           ;    file=filename+str(y),

           ;           ;           ;           ;    colormode="color",

           ;           ;           ;           ;    y=y)

           ;           ;           ;           ;    #pageheight=12*96)

 

 

Vasilis

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )