{"action":"closed","issue":{"url":"https://api.github.com/repos/mozilla/pdf.js/issues/5505","labels_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5505/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5505/comments","events_url":"https://api.github.com/repos/mozilla/pdf.js/issues/5505/events","html_url":"https://github.com/mozilla/pdf.js/issues/5505","id":49855280,"number":5505,"title":"Image content in pattern objects don't print or are incorrectly scaled when printing in chrome","user":{"login":"jebramwell","id":6652852,"avatar_url":"https://avatars.githubusercontent.com/u/6652852?v=3","gravatar_id":"","url":"https://api.github.com/users/jebramwell","html_url":"https://github.com/jebramwell","followers_url":"https://api.github.com/users/jebramwell/followers","following_url":"https://api.github.com/users/jebramwell/following{/other_user}","gists_url":"https://api.github.com/users/jebramwell/gists{/gist_id}","starred_url":"https://api.github.com/users/jebramwell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jebramwell/subscriptions","organizations_url":"https://api.github.com/users/jebramwell/orgs","repos_url":"https://api.github.com/users/jebramwell/repos","events_url":"https://api.github.com/users/jebramwell/events{/privacy}","received_events_url":"https://api.github.com/users/jebramwell/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mozilla/pdf.js/labels/4-chrome-specific","name":"4-chrome-specific","color":"e102d8"},{"url":"https://api.github.com/repos/mozilla/pdf.js/labels/4-printing","name":"4-printing","color":"DDDDDD"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2014-11-24T04:22:22Z","updated_at":"2015-04-29T17:27:02Z","closed_at":"2015-04-29T17:27:02Z","body":"I have found that PDFs generated by win2PDF (a print to PDF driver for windows) are not printing correctly from PDFjs in chrome.\r\n\r\nI have tested a few versions of PDFjs \r\n* 1.0.277\r\n* 1.0.712\r\n* 1.0.907\r\n\r\nin several versions of chrome: \r\n* chromium 37\r\n* chrome 40.0.2214.10\r\n* chromium 41.0.2226.0\r\n\r\nall with the same result.\r\n\r\nI have found that I can \"correct\" the problem by undoing a \"hack\" put in place to improve print quality under firefox.\r\n\r\nin viewer.js\r\n```javascript\r\n this.beforePrint = function pageViewBeforePrint() {\r\n    var pdfPage = this.pdfPage;\r\n    console.log(\"PDF before print\");\r\n    var viewport = pdfPage.getViewport(1);\r\n    // Use the same hack we use for high dpi displays for printing to get better\r\n    // output until bug 811002 is fixed in FF.\r\n    var PRINT_OUTPUT_SCALE = 1;\r\n```\r\nI changed the line\r\n```javascript\r\n       var PRINT_OUTPUT_SCALE = 2;\r\n```\r\nto\r\n```javascript\r\n       var PRINT_OUTPUT_SCALE = 1;\r\n```\r\n\r\nand the printing issue goes away, however print quality does suffer.\r\n\r\nI suspected this has to do with pattern object because I generated a PDF from the same content/application using CutePDF and the resulting PDF doesn't have the same problem.  Comparing the two PDFs I found that Win2PDF is putting the images inside of pattern objects. \r\n\r\nWin2PDF version with issue printing in chrome:\r\n[PDFTest1.Win2PDF.pdf](https://pdf.yt/d/veavWBjq64E6ITKJ)\r\n\r\nThis is what the print preview looks like:\r\n![image](https://cloud.githubusercontent.com/assets/6652852/5160527/a2db62e6-735c-11e4-982d-c3773e672219.png)\r\nHere is the PDF generated if I have chrome create a PDF of the incorrect render\r\n[PDFTest1.Win2PDF.printpreview.pdf](https://pdf.yt/d/ogMiCAYiJCSgBgN_)\r\n\r\nCutePDF version that displays and prints fine:\r\n[PDFTest1.cutePDF.pdf](https://pdf.yt/d/F5HZpqF7MStQfGV8)\r\n\r\nI think what win2PDF is doing is silly, but it is an issue I have to deal with and it does suggest there is some general issue with how PDFjs is rendering patterns in chrome.\r\n\r\nI found a simple example of using patterns for tiling an image from [this site](http://www.readytext.co.uk/).\r\nI then viewed the PDF with PRINT_OUTPUT_SCALE set to 1, 2, and 3 and \"printed\" the result as a PDF.  \r\nOriginal: [patternfill.pdf](https://pdf.yt/d/TGAOAnw3am-z7NJX)\r\nprint 1x scale: [patternfill.1x.pdf](https://pdf.yt/d/ToywBeEKXS0GpoOr)\r\nprint 2x scale: [patternfill.2x.pdf](https://pdf.yt/d/2tBWN1ZfNUPoK1Jm)\r\nprint 3x scale: [patternfill.3x.pdf](https://pdf.yt/d/fNp8VZK4ZYfsL_28)\r\n\r\nI couldn't see a scaling issue in the preview window, but that may be because the tiled area is so small. The resulting PDFs clearly show the effect of PRINT_OUTPUT_SCALE on both the quality of the result and the mis-scaling of the tiled pattern.  So I guess if the intent of PRINT_OUTPUT_SCALE  is to improve detail in the printed output while not actually impacting relative scales then we might need to apply PRINT_OUTPUT_SCALE to pattern rendering in some way in chrome.  Or perhaps there is a bug in chrome.\r\n\r\nI repeated this test in firefox and I didn't see the same issue with the pattern repeating more often at higher PRINT_OUTPUT_SCALE values."}}