beforeprint

print (媒体型)

仕様書

物理形

[13] 利用者エージェント利用者に対して物理形を得る (obtain a physical form) (または物理形の表現 (representation) を得る) 機会を要求できるようにすることが期待されています >>12。 ここで「物理形を得る」とは例えば印刷のことを、 「物理形の表現を得る」とは例えば PDF への変換のことをいいます >>15

[19] 利用者物理形を得る (または表現を得る) 機会を要求した時には、 printing steps を走らせるべきです >>15

[30] 「物理形を得る」が >>19>>26 で異なる意味で使われているように見えます。

[14] 実際に物理形を得る (または表現を得る) 際には、当該 Document印刷媒体用の新しいレンダリングを作成することが期待されています >>12


[58] 多くの Webブラウザーには、 「印刷」 や 「印刷プレビュー」 の機能が備わっています。 一部の Webブラウザーには、 PDF 出力機能が備わっています。 これらの機能が物理形を得る操作を呼び出します。

window.print (DOM)

[16] Window インターフェイスprint は、 次のようにします。 >>15

  1. [53] 文書を、文脈オブジェクト文書に設定します。
  2. [18] 文書ready for post-load tasksの場合、
    1. [50] printing steps を実行します。
  3. [51] それ以外の場合、
    1. [52] 文書print when loaded を、 に設定します。

[54] 文書は、 print when loaded フラグを持ちます。 初期値はです。

[33] print when loaded フラグが設定されると、後に stop parsing 手順が HTML構文解析器または XML構文解析器によって実行される際に、 printing steps が呼び出されます >>34

[37] つまり、 load (stops parsing) までprinting stepsの実行は遅延されます。

[44] ChromeexecCommand命令 print でも同じように動作します。

printing steps

[20] printing steps とは、次の手順です >>15

  1. [21] 利用者にメッセージを表示するか、ここで終わるか、あるいはその両方を実行して構いません。
  2. [40] 文脈オブジェクト文書活性砂箱化フラグ集合sandboxed modals flag が設定されていれば、
    1. [43] ここで停止します。
  3. [24] 印刷される文書とその子供閲覧文脈Windowbeforeprint 単純イベントを発火します。
  4. [26] 物理形を得る (または表現を得る) 機会を提供するべきです
  5. [29] 印刷される文書とその子供閲覧文脈Windowafterprint 単純イベントを発火します。

[39] 物理形を得る機会を提供するとは、具体的にはプラットフォームまたはアプリケーション印刷オプションを表すモーダルダイアログを表示することを指しています。 利用者はそのダイアログ上での操作により、実際に印刷を行うことを指示したり、 ダイアログを閉じて処理を継続することを指示したりできます。

[45] プラットフォームが提供する印刷ダイアログを表示する Webブラウザーが多いですが、 Chrome は独自のダイアログを持っています。 プラットフォームに登録されたプリンターの他に、 PDF として保存するオプションが用意されています。

onbeforeprint 属性、 onafterprint 属性

[32] Window オブジェクトbody 要素frameset 要素onbeforeprint 属性onafterprint 属性は、それぞれ Window オブジェクトイベント型 beforeprintafterprintイベントハンドラーです >>31

媒体型 print

[3] 媒体型 print は、印刷用の表示モードを表します。

印刷プレビュー

[35] 多くの Webブラウザーは、印刷機能と印刷プレビューモードを実装しています。

[36] 印刷プレビューモードでは、実際に印刷する場合と同じ形で画面上にレンダリングされます。

関連

スクリーンショット (Web)

歴史

[1] Printing the Web: Solutions and Techniques | Smashing Magazine (2007-02-24 00:44:42 +09:00 版) http://www.smashingmagazine.com/2007/02/21/printing-the-web-solutions-and-techniques/ (名無しさん 2007-02-23 16:09:40 +00:00)

[2] TRANS - 印刷用CSSをもっとよくするための4つのTips。 (2007-04-22 03:28:49 +09:00 版) http://d.hatena.ne.jp/aratako0/20070421/p1 (名無しさん 2007-04-23 01:23:19 +00:00)

[4] W3C Print Symposium 2006 (2006-10-23 20:51:46 +09:00 版) http://www.w3c.de/Events/2006/PrintSymposium_en.html

[5] CSS Print Profile ( ( 版)) http://www.w3.org/TR/2013/NOTE-css-print-20130314/#section-mediatypes

[6] The New Publishing - A W3C Workshop on the Open Web Platform and the Traditional Print Publishing Industry ( ( 版)) http://www.w3.org/2012/12/global-publisher/report.html

[7] [whatwg] window.print() when printing is not supported ( 版) http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-March/025597.html

[8] onloadwindow.print() する頁がありました。うざいですね。 window.open() と同じで制限するべきではないでしょうか。 (名無しさん 2007-07-01 12:42:56 +00:00)

[25] Remove the storage mutex due to lack of implementation · whatwg/html@1b918cf ( 版) https://github.com/whatwg/html/commit/1b918cf72fcbba011f83b92ab5d1f483fb1cafa3

[41] Issue 173 - chromium - Missing a Print Preview option - Monorail ( ()) https://bugs.chromium.org/p/chromium/issues/detail?id=173

[42] Use the Window's associated Document for allow-modals sandbox checks (domenic著, ) https://github.com/whatwg/html/commit/29ebd5b6e8c4ba4006115a784c5c6c87dc151489

[46] 22698 – <canvas>: API to make <canvas> prettier when printing () https://www.w3.org/Bugs/Public/show_bug.cgi?id=22698

[47] user prompts: drop mention of window.print (andreastt著, ) https://github.com/w3c/webdriver/commit/cbd6c0b5c9503f41a9249174385be988b9727f07

[48] Make clear that window.print user prompt · Issue #1090 · w3c/webdriver () https://github.com/w3c/webdriver/issues/1090

[49] user prompts: drop mention of window.print by andreastt · Pull Request #1091 · w3c/webdriver () https://github.com/w3c/webdriver/pull/1091

[55] Make print() run synchronously (TimothyGu著, ) https://github.com/whatwg/html/commit/d89b68a1006d1e211a33e266aa3c3207abafd715

[56] "Printing steps" should not run in parallel · Issue #4686 · whatwg/html () https://github.com/whatwg/html/issues/4686

[57] Make print() run synchronously by TimothyGu · Pull Request #4690 · whatwg/html () https://github.com/whatwg/html/pull/4690

[59] Editorial: nested browsing context is a member, not a type (annevk, , ) https://github.com/whatwg/html/commit/6b737bbc428facf34ec3728c0912cf9e172d0ea4