2.0.0 • Published 3 years ago

print-html-block v2.0.0

Weekly downloads
17
License
MIT
Repository
github
Last release
3 years ago

Print Html Block

Usage

  1. Install plugin
npm install print-html-block
  1. Create html tags
<section id="section1">Print Me!</section>
<section id="section2">Don't print me.</section>
<button onclick="print()">Print</button>
  1. Import plugin in your .js file
import printHtmlBlock from 'print-html-block';

function print() {
  const selector = '#section1';
  const options = {
    importStyle: true
  };

  printHtmlBlock(selector, options);
};
  1. Finish. Click by "Print" button

Default options

NameDefailtDescription
debugfalseshow the iframe for debugging
importCSStrueimport parent page css
importStylefalseimport style tags
printContainertrueprint outer container/$.selector
loadCSS''path to additional css file - use an array [] for multiple
pageTitle''add title to print page
removeInlinefalseremove inline styles from print elements
removeInlineSelector'*'custom selectors to filter inline styles. removeInline must be true
printDelay333variable print delay
headernullprefix to html
footernullpostfix to html
basefalsepreserve the BASE tag or accept a string for the URL
formValuestruepreserve input/form values
canvasfalsecopy canvas content
doctypeString''enter a different doctype for older markup
removeScriptsfalseremove script tags from print content
copyTagClassesfalsecopy classes from the html & body tag
beforePrintEventnullcallback function for printEvent in iframe
beforePrintnullfunction called before iframe is filled
afterPrintnullfunction called before iframe is removed
2.0.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago