Jump to content

GD Image not printing


Driftek

Recommended Posts

I have created an image using the GD Library use Ajax to change parts of the image. For some reason it just wont print. When I print the image it is only printing the layer of the image that is hard coded.  I can save the image then print it but other than that it wont work, it only prints the hard coded layers and not the data pulled out of variables.

 

 

 

http://www.driftek.com/customersites/welspun/beta/createabed.php

 

 

If you go to the link above and make a few layer changes and try to print the image you will see the issue. Any help is appreciated.

Link to comment
https://forums.phpfreaks.com/topic/286292-gd-image-not-printing/
Share on other sites

When it comes to your printing JS I would recommend you avoid the popup and instead replace the current page with just the image. For example:

 

HTML gets setup like this

<style type="text/css">
#printView { display: none; }
body.print #printView { display: block; }
body.print #buildView { display: none; }
</style>
<body>
 <div id="printView"><p>Hit CTRL+P to print</p><img id="printImage"></div>
 <div id="buildView">...current content...<button type="button" id="printButton">PRINT</button></div>
</body>
//Using jQuery for simplicity
jQuery(function($){
    $('#printButton').click(function(){
        $('body').addClass('print');

        var url = $('#bed').attr('src');
        $('#printImage').attr('src', url);
    });
});
Fiddle demo

 

When I tried the page in Chrome the print didn't do anything because chrome was blocking your popup window. Even after I enabled popups all I got was a blank window with no image. The above solution would work better and more consistently.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.