jampez77
jampez77

Reputation: 5241

jQuery printElement not printing whole image

I'm using printElement to print a base64 encoded image (1000 x 5883).

Everything is OK apart from it will only print one page when the image itself is about 4/5 pages long.

Not sure if it's because my image is base64 encoded or if i'm using the printElement function incorrectly.

Any help would be appreciated

Thanks in advance

Upvotes: 0

Views: 2463

Answers (2)

James Dayeh
James Dayeh

Reputation: 526

I have found a solution using this code.

$('#result').css('display', 'block');
$('#result').printElement({ printMode: 'popup' });
$('#result').css('display', 'none');

toggling the visibility made the print work correctly ! Now it is printing the whole picture. Enjoy :)

Upvotes: 0

narasimha v
narasimha v

Reputation: 86

use this code

<a id="print" style="cursor:pointer">Print</a>
<img src="bluemoon.jpg" id="tes" align="middle"  class="b" width="100%"/>
<script type="text/javascript">
$(document).ready(function(){
$('#print').click(function(){
    $('#tes').printElement(
        {
            printBodyOptions:
            {
                styleToAdd:'padding:10px;margin:10px;color:#FFFFFF !important;width:100%!important;',
                classNameToAdd : 'b',
                leaveOpen:true
            }
        });
    })

})
</script>

Upvotes: 3

Related Questions