1

I have a this code

<?php echo '<img border="1" src="data:image/png;base64,' . base64_encode($row['image']) . '"  ;/>'; ?></br>

How do I print the img in a printer?

Schyron Sy
  • 13
  • 4
  • possible duplicate of [how to print a web page](http://stackoverflow.com/questions/5878562/how-to-print-a-web-page) – rjdown Mar 10 '15 at 12:30

1 Answers1

1

The JavaScript print() function can be called to open the print dialog in the browser. You could try adding a script element to your page that calls print:

<script type="text/javascript">print();</script>

I'm not sure how the timing would work, but you might need to do it on the onload event instead

<script type="text/javascript">
    window.onload = function() {
        print();
    };
</script>

or perhaps a setTimeout to delay the print call for a moment until the page is fully rendered.

CodingWithSpike
  • 42,906
  • 18
  • 101
  • 138