szaman
szaman

Reputation: 6756

Print all div content with jquery printElement

I am trying to print my div content using printElement plugin. The div has a lot of text with in so there is a scrollbar. The problem is that plugin prints only the part of text which is actually on the screen. How can I print all of the text?

EDIT:

I need a solution which will print this div with styles which are in external css.

Upvotes: 6

Views: 49011

Answers (3)

Jason
Jason

Reputation: 7682

https://github.com/jasonday/printThis

Configurable with additional css files, and other options.

Upvotes: 1

user357086
user357086

Reputation: 404

<div class="printclass">Print</div>
  <div id="mydivid">
        Your content goes here
  </div>
</div>

<script type="text/javascript">
$(function(){
    $( ".printclass" )
    .attr( "href", "javascript:void(0)")
    .click(function(){
    // Print the DIV.
    $( "#mydivid" ).print();         
    // Cancel click event.
    return( false );
    });

});
</script>

Upvotes: 0

Related Questions