@@ -6,39 +6,100 @@ Printing plug-in for jQuery
66* Preserve page CSS/styling
77** or add new CSS; the world is your oyster!
88* Preserve form entries
9-
10- ### Non-features
11- really 'Issues'
12- * canvas/svg elements such as map routes are not preserved
9+ * ** 1.9.0 adds experimental canvas support**
1310
1411## Usage
1512### Basic
1613``` javascript
17- $ (' selector' ).printThis ();
14+ $ (' selector' ).printThis ();
15+ ```
16+
17+ ### Advanced Features
18+ ``` javascript
19+ $ (' #kitty-one, #kitty-two, #kitty-three' ).printThis ({
20+ importCSS: false ,
21+ loadCSS: " " ,
22+ header: " <h1>Look at all of my kitties!</h1>"
23+ });
24+ ```
25+
26+ #### debug
27+ Debug leaves the iframe visible on the page after ` printThis ` runs, allowing you to inspect the markup and CSS.
28+
29+ #### importCSS
30+ Copy CSS ` <link> ` tags to the printThis iframe. On by default.
31+
32+ #### importStyle
33+ Copy CSS ` <style> ` tags to the printThis iframe. Off by default.
34+
35+ #### printContainer
36+ Includes the markup of the selected container, not just its contents. On by default.
37+
38+ #### loadCSS
39+ Provide a URL for an additional stylesheet to the printThis iframe. Empty string (off) by default.
40+
41+ #### pageTitle
42+ Use a custom page title on the iframe. This may be reflected on the printed page, depending on settings. Blank by default.
43+
44+ #### removeInline
45+ Eliminates any inline style attributes from the content. Off by default.
46+
47+ #### printDelay
48+ The amount of time to wait before calling ` print() ` in the printThis iframe. Defaults to 333 milliseconds.
49+ Appropriate values depend heavily on the content and network performance. Graphics heavy, slow, or uncached content may need extra time to load.
50+
51+ #### header & footer
52+ A string or jQuery object to prepend or append to the printThis iframe content. ` null ` by default.
53+
54+ ``` javascript
55+ $ (' #mySelector' ).printThis ({
56+ header: " <h1>Amazing header</h1>"
57+ });
58+
59+ $ (' #mySelector' ).printThis ({
60+ footer: $ (' .hidden-print-header-content' )
61+ });
1862```
1963
20- ### Advanced
21- $('#kitty-one, #kitty-two, #kitty-three').printThis({
22- importCSS: false,
23- loadCSS: "",
24- header: "<h1>Look at all of my kitties!</h1>"
25- });
64+ #### base
65+ The ` base ` option allows several behaviors.
66+ By default it is ` false ` , meaning a the current document will be set as the base URL.
67+
68+ If set to ` true ` , a ` <base> ` attribute will be set if one exists on the page.
69+ If none is found, the tag is omitted, which may be suitable for pages with Fully Qualified URLs.
70+
71+ When passed as a string, it will be used as the ` href ` attribute of a ` <base> ` tag.
72+
73+ #### formValues
74+ This setting attempts to copy the current values of form elements into the printThis iframe. On by default.
75+
76+ Complex field values, such as those containing quotations or mark-up, may have difficulties. Please report any unexpected behavior.
77+
78+ #### canvas -- Experimental
79+ As of 1.9.0 you may be able to duplicate canvas elements to the printThis iframe. Disabled by default.
80+ This has received only limited testing and so may not work in all browsers and situations.
81+
82+ #### doctypeString
83+ A doctype string to use on the printThis iframe. Defaults to the HTML5 doctype.
2684
2785### All Options
2886``` javascript
29- $ (" #mySelector" ).printThis ({
30- debug: false , * show the iframe for debugging
31- importCSS: true , * import page CSS
32- importStyle: false , * import style tags
33- printContainer: true , * grab outer container as well as the contents of the selector
34- loadCSS: " path/to/my.css" , * path to additional css file - use an array [] for multiple
35- pageTitle: " " , * add title to print page
36- removeInline: false , * remove all inline styles from print elements
37- printDelay: 333 , * variable print delay; depending on complexity a higher value may be necessary
38- header: null , * prefix to html
39- base: false * preserve the BASE tag, or accept a string for the URL
40- formValues: true * preserve input/ form values
41- });
87+ $ (" #mySelector" ).printThis ({
88+ debug: false , * show the iframe for debugging
89+ importCSS: true , * import page CSS
90+ importStyle: false , * import style tags
91+ printContainer: true , * grab outer container as well as the contents of the selector
92+ loadCSS: " path/to/my.css" , * path to additional css file - use an array [] for multiple
93+ pageTitle: " " , * add title to print page
94+ removeInline: false , * remove all inline styles from print elements
95+ printDelay: 333 , * variable print delay; depending on complexity a higher value may be necessary
96+ header: null , * prefix to html
97+ footer: null , * postfix to html
98+ base: false * preserve the BASE tag, or accept a string for the URL
99+ formValues: true * preserve input/ form values
100+ canvas: false * copy canvas elements (experimental)
101+ doctypeString: " ..." * enter a different doctype for older markup
102+ });
42103```
43104
44105## Please read
0 commit comments