Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.