]> git.parisson.com Git - pdf.js.git/commitdiff
Not-printing sidebar, toolbar, shadows and pages that were not loaded (#384)
authornotmasteryet <async.processingjs@yahoo.com>
Sat, 27 Aug 2011 22:10:15 +0000 (17:10 -0500)
committernotmasteryet <async.processingjs@yahoo.com>
Sat, 27 Aug 2011 22:10:15 +0000 (17:10 -0500)
web/viewer.css
web/viewer.js

index 18da0b3d1edf0d1d1284ef6d9fb31f924633d733..bb7da000ed40f23e57742e6f65ac7e463de2f6c7 100644 (file)
@@ -210,3 +210,34 @@ canvas {
   -webkit-box-shadow: 0px 2px 10px #ff0;
 }
 
+/* === Printed media overrides === */
+@media print {
+  #sidebar {
+    display: none;
+  }
+
+  #controls {
+    display: none;
+  }
+
+  #viewer {
+    margin: 0;
+    padding: 0;
+  }
+
+  .page {
+    display: none;
+    margin: 0;
+  }
+
+  .page canvas {
+    box-shadow: none;
+    -moz-box-shadow: none;
+    -webkit-box-shadow: none;
+  }
+
+  .page[data-loaded] {
+    display: block;
+    page-break-after: always;
+  }
+}
index ec7ff3001bc2fba4370dbe6293760bf0dd687d5c..243afb7e5248d0beba7490f1cae79624cf8c64c5 100644 (file)
@@ -211,6 +211,7 @@ var PageView = function(container, content, id, width, height,
 
     while (div.hasChildNodes())
       div.removeChild(div.lastChild);
+    div.removeAttribute('data-loaded');
   };
 
   function setupLinks(canvas, content, scale) {
@@ -259,6 +260,7 @@ var PageView = function(container, content, id, width, height,
     this.content.startRendering(ctx, this.updateStats);
 
     setupLinks(canvas, this.content, this.scale);
+    div.setAttribute('data-loaded', true);
 
     return true;
   };