tags:

views:

226

answers:

3

I want to print a very large image generated by my program with 31279px in width with javascript but window.print() prints only a little part of the entire image.

Please any solution to this?

+1  A: 

Three choices:

  • Resize it (on the server-side perhaps) to fit the window. It would degrade print quality, but fast and easy.
  • GoogleMaps-style: cut it into small pieces, let user scroll them both ways and choose the window he wants to print. Buttons for "zoom in" and "zoom out" serving smaller/bigger-scale images. Cool and strong, but a lot of work.
  • Make a PDF with that image! No quality degrade, guaranteed looks.

I think you should really do PDF.

alamar
+1  A: 

Using CSS resize the image to 100% width of the window, this should theoretically work.

img#theImage {
     width:100%;
}
Georg
Good idea, but you should add a @media print block to it as well.
MiffTheFox
I wouldn't recommend that, since the user would have to download a few megabytes of image and thus would be nonplussed.Better fetch the resized version.
alamar
@alamar: it looks like he wants to have this high-res picture.
Georg
@MiffTheFox: And users looking at the picture should only see a small part of it? So many pixels would need huge scrollbars.
Georg
hi guy i do not want to resize it . it happen to be a big diagram of some sort!
Spikie
@MiffTheFox yes you are right but it is an internal project i just want the print out
Spikie
If it's a diagram, you clearly want to give it out as a paged PDF.
alamar
A: 

Have you tried another browser? I've heard that Firefox doesn't continue printing on the next side if the element is floated.


Another idea: Use css to show only part of the image and make those parts as big as one page is. This technique is called sprites.

Georg