简体   繁体   中英

How do i print all image in web page? (Printer)

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM