Driftek Posted February 18, 2014 Share Posted February 18, 2014 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. Quote Link to comment Share on other sites More sharing options...
.josh Posted February 18, 2014 Share Posted February 18, 2014 you need to show some actual (relevant) code that creates the image. Quote Link to comment Share on other sites More sharing options...
.josh Posted February 18, 2014 Share Posted February 18, 2014 also, are you sure it doesn't work? I added an accent pillow and a scarf and the image shows both items and when i print, it shows both items. Perhaps it's just bad logic or typo for one of the specific items? Quote Link to comment Share on other sites More sharing options...
Driftek Posted February 18, 2014 Author Share Posted February 18, 2014 Weird. It works in Firefox but not in Internet Explorer. Quote Link to comment Share on other sites More sharing options...
kicken Posted February 18, 2014 Share Posted February 18, 2014 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.