I've been playing around with the `printer-driver-cups-pdf` printer today (as distinguished from the Firefox built-in Save-to-PDF print target) and I'm observing that **if I add and try to print to an "unusual"/nonstandard paper-size and try to print to it from Firefox, then I end up with A4-sized "paper", with a centered page of my custom size**. Whereas in Chrome, it just works; I end up with PDF-paper of the correct custom size that I configured. I think that might be what's going on here -- **I think maybe the receipt printer's e.g. 72x110mm page-size is being rejected by whatever bit of code is also rejecting my custom paper sizes, and we end up generating an A4-sized artifact with the 72x110mm output centered on it, and that's what we send to the printer, and it prints the top-left corner as best as it can, or something like that, which results in the rendering in comment 9. As an example: if I manually add the following 6x7in paper-size called `MyTestSize` to `/etc/cups/ppd/PDF.ppd`, with each line inserted into the appropriate section with the same info for other page-sizes... ``` *PageSize MyTestSize/My Test Size: "<</PageSize[432 504]/ImagingBBox null>>setpagedevice" *PageRegion MyTestSize/My Test Size: "<</PageSize[432 504]/ImagingBBox null>>setpagedevice" *ImageableArea MyTestSize/My Test Size: "0 0 432 504" *PaperDimension MyTestSize/My Test Size: "432 504" ``` ...(per e.g. [StackOverflow](https://stackoverflow.com/questions/1028891/whats-the-easiest-way-to-add-custom-page-sizes-to-a-ppd/3112256#3112256) or just cargo-culting from the existing ppd content), and I run `sudo service restart cups`, and then try to print to that paper size, then a few things go wrong: (a) it shows up in Firefox's print dialog as `6 x 7 " (Borderless)`, notably **not using the actual paper name that I specified in the PPD file**. (This is maybe a hint that it's being rejected or not fully picked up.) (b) the print job results in a PDF that shows an A4-sized piece of paper (confirmed in the PDF info shown by PDF.js), with the 6x7 page-content centered on it. (c) If I click out to the system print dialog and click the Page Setup tab, I see `Paper Size` is set to a weird name `custom_6x7in_6x7in_borderless`, which is odd. If I scroll up in the paper-size-list, I see that there's also a page size named "My Test Size" in the system print dialog's paper-size-list for this cups PDF printer (notably that name is not present in the Firefox built-in print dialog). It doesn't matter which of these two sizes that I choose for the paper size in the system-print-dialog print operation, though; I still get the output described in (b). In Chrome, all three of these work out correctly -- the paper shows up in the print dialog using the expected "My Test Size" name (in Chrome's print dialog as well as in the system-print-dialog), and I end up with a PDF that shows a 6x7 sheet of virtual paper (which is the same size as the page that's drawn onto it). [1] (I'm not entirely sure what qualifies as "nonstandard" for this assessment or who/where that's being judged) [2] note that the values in the PPD file seem to be in points, i.e. 1/72 of an inch.
Bug 1914238 Comment 11 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I've been playing around with the `printer-driver-cups-pdf` printer today (as distinguished from the Firefox built-in Save-to-PDF print target) and I'm observing that **if I add and try to print to an "unusual"/nonstandard paper-size and try to print to it from Firefox, then I end up with A4-sized "virtual paper" in the PDF, with a page of my custom size printed onto the center of that paper**. Whereas in Chrome, it just works; I end up with virtual paper of the correct custom size that I configured. I think that might be what's going on here -- **I think maybe the receipt printer's e.g. 72x110mm page-size is being rejected by whatever bit of code is also rejecting my custom paper sizes, and we end up generating an A4-sized artifact with the 72x110mm output centered on it, and that's what we send to the printer, and it prints the top-left corner as best as it can, or something like that, which results in the rendering in comment 9. As an example: if I manually add the following 6x7in paper-size called `MyTestSize` to `/etc/cups/ppd/PDF.ppd`, with each line inserted into the appropriate section with the same info for other page-sizes... ``` *PageSize MyTestSize/My Test Size: "<</PageSize[432 504]/ImagingBBox null>>setpagedevice" *PageRegion MyTestSize/My Test Size: "<</PageSize[432 504]/ImagingBBox null>>setpagedevice" *ImageableArea MyTestSize/My Test Size: "0 0 432 504" *PaperDimension MyTestSize/My Test Size: "432 504" ``` ...(per e.g. [StackOverflow](https://stackoverflow.com/questions/1028891/whats-the-easiest-way-to-add-custom-page-sizes-to-a-ppd/3112256#3112256) or just cargo-culting from the existing ppd content), and I run `sudo service restart cups`, and then try to print to that paper size, then a few things go wrong: (a) it shows up in Firefox's print dialog as `6 x 7 " (Borderless)`, notably **not using the actual paper name that I specified in the PPD file**. (This is maybe a hint that it's being rejected or not fully picked up.) (b) the print job results in a PDF that shows an A4-sized piece of paper (confirmed in the PDF info shown by PDF.js), with the 6x7 page-content centered on it. (c) If I click out to the system print dialog and click the Page Setup tab, I see `Paper Size` is set to a weird name `custom_6x7in_6x7in_borderless`, which is odd. If I scroll up in the paper-size-list, I see that there's also a page size named "My Test Size" in the system print dialog's paper-size-list for this cups PDF printer (notably that name is not present in the Firefox built-in print dialog). It doesn't matter which of these two sizes that I choose for the paper size in the system-print-dialog print operation, though; I still get the output described in (b). In Chrome, all three of these work out correctly -- the paper shows up in the print dialog using the expected "My Test Size" name (in Chrome's print dialog as well as in the system-print-dialog), and I end up with a PDF that shows a 6x7 sheet of virtual paper (which is the same size as the page that's drawn onto it). [1] (I'm not entirely sure what qualifies as "nonstandard" for this assessment or who/where that's being judged) [2] note that the values in the PPD file seem to be in points, i.e. 1/72 of an inch.