Re: Converting a (big) canvas to an image



Helmut Giese schrieb:
Hello out there,
as far as I can tell from various articles on the wiki printing a big
(potentially larger than screen size) canvas will be difficult (on
Windows).
However, if it were possible to convert the whole canvas to an image,
I think it would be a much easier task to later break this image up
into smaller (page size) parts and then print those. Or maybe the user
is already content to have an image - who knows.

I don't think there exists a package which does this (at least I
haven't found anything), but I wouldn't mind having a go at it and
fight with the Windows API to achieve what I'm after.

Question: What were the (conceptual) steps to transform the complete
content of a canvas - currently visible or not - into an image (on
Windows)?
Side note: If it makes this task easier I could restrict the canvas to
not contain embedded widgets.
Side note 2: If this restriction is not enough I could further
restrict the canvas to not contain embedded images, either.

Any hints, links or ideas will be greatly appreciated.
Best regards
Helmut Giese

You need a bitmap, in order to
generate an image of it!

So an image can only contain those
parts visible in your canvas.

what you could do is: scrolling through
the scrollregion and then make a series
of screenshots --either with what you found
in the wiki, or tkpath 0.3 surface --maybe
surface works offscreen, but I doubt it.


Printing on Windows:
The problem is the size of a resulting
bitmap.

If you have a source image 100x100
and send it to a printer, then the bitmap
must be expanded to the resolution of
your printer aka 1200000x1200000 (1200dpi
printer). --you won't have enough memory
for doing this, and its slow.
Consequently: You can't use Bitblt!

Use: stretchDIBBitblt instead for printing.


-roger


.



Relevant Pages

  • Re: Obstacles for Tcl/Tk commercial application development ?
    ... problem if you insist that generating postscript is the best and only ... the canvas postscript. ... Windows is harder because it's not already ... Complaining it's a problem with Windows printing ...
    (comp.lang.tcl)
  • Re: Obstacles for Tcl/Tk commercial application development ?
    ... Lack of a good printing is a big problem. ... I just did some successful experimentation using the img::window extension, a Tk canvas, and the canvas2Photo routine by George Petasis detailed here: ... Wrap those images in simple HTML and save the HTML as a file with some JavaScript to bring up the printer dialog immediately: ... Essentially we're using the browser as a print preview but the printer dialog is also coming up immediately and we let the browser handle the complexities of printing. ...
    (comp.lang.tcl)
  • Re: array of labels or array of buttons
    ... I'd want the printing to work on any printer. ... hands you a canvas. ... > have its transparent property set to transparent. ... them in the constructor, ...
    (alt.comp.lang.borland-delphi)
  • Re: Problems printing text on top of img
    ... need to ensure the printing happens in the right order, ... private void button1_Click(object sender, System.EventArgs e) ... I doubt if some other event causes invalidation of the canvas and the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: printing under MS win
    ... | works just fine (to a user-selected file, or an "lpr" device specified ... I'm printing PostScript (the default from a canvas). ...
    (comp.lang.python)