Code Monkey home page Code Monkey logo

print-html-block's Introduction

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

Name Defailt Description
debug false show the iframe for debugging
importCSS true import parent page css
importStyle false import style tags
printContainer true print outer container/$.selector
loadCSS '' path to additional css file - use an array [] for multiple
pageTitle '' add title to print page
removeInline false remove inline styles from print elements
removeInlineSelector '*' custom selectors to filter inline styles. removeInline must be true
printDelay 333 variable print delay
header null prefix to html
footer null postfix to html
base false preserve the BASE tag or accept a string for the URL
formValues true preserve input/form values
canvas false copy canvas content
doctypeString '' enter a different doctype for older markup
removeScripts false remove script tags from print content
copyTagClasses false copy classes from the html & body tag
beforePrintEvent null callback function for printEvent in iframe
beforePrint null function called before iframe is filled
afterPrint null function called before iframe is removed

print-html-block's People

Contributors

denisoed avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.