Open Iragael opened 9 months ago
I rely on Page Sizer too. This is a major problem. It's bad enough that I can't download and install it on another account, via the Google store, but they removed it from the account I was already using it on! Help!
@Iragael @GeorgeLLL Paste this and tinker with the sizes in the source code. Not perfect, but works.
/* Easy way to configure the page size in Google Docs to any of the A sizes in portrait or landscape: 4A0, 2A0, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10
Google Docs does not support custom page sizes, with this addon you can set any of the A* page sizes and toggle between portrait and landscape mode.
Size Width x Height (mm) Width x Height (in) 4A0 1682 x 2378 mm 66.2 x 93.6 in 2A0 1189 x 1682 mm 46.8 x 66.2 in A0 841 x 1189 mm 33.1 x 46.8 in A1 594 x 841 mm 23.4 x 33.1 in A2 420 x 594 mm 16.5 x 23.4 in A3 297 x 420 mm 11.7 x 16.5 in A4 210 x 297 mm 8.3 x 11.7 in A5 148 x 210 mm 5.8 x 8.3 in A6 105 x 148 mm 4.1 x 5.8 in A7 74 x 105 mm 2.9 x 4.1 in A8 52 x 74 mm 2.0 x 2.9 in A9 37 x 52 mm 1.5 x 2.0 in A10 26 x 37 mm 1.0 x 1.5 in DL 220 x 110 mm C4 229 x 324 mm C5 162 x 229 mm C6 114 x 162 mm C6/5 114 x 229 mm
This addon only sets the page size and page orientation. Use File → Page setup to set all other page settings. As that dialog does not support custom page sizes it will reset your page size. Simply use the Add-ons → Set A Page Size menu again to set your custom page size. /
var sizes_paper_data = { "4A0 (1682 x 2378 mm)" : { "PAGE_WIDTH": 4768, "PAGE_HEIGHT": 6741 }, "2A0 (1189 x 1682 mm)" : { "PAGE_WIDTH": 3370, "PAGE_HEIGHT": 4768 }, "A0 (841 x 1189 mm)" : { "PAGE_WIDTH": 2384, "PAGE_HEIGHT": 3370 }, "A1 (594 x 841 mm)" : { "PAGE_WIDTH": 1684, "PAGE_HEIGHT": 2384 }, "A2 (420 x 594 mm)" : { "PAGE_WIDTH": 1191, "PAGE_HEIGHT": 1684 }, "A3 (297 x 420 mm)" : { "PAGE_WIDTH": 842 , "PAGE_HEIGHT": 1191 }, "A4 (210 x 297 mm)" : { "PAGE_WIDTH": 595 , "PAGE_HEIGHT": 842 }, "A5 (148 x 210 mm)" : { "PAGE_WIDTH": 420 , "PAGE_HEIGHT": 595 }, "A6 (105 x 148 mm)" : { "PAGE_WIDTH": 298 , "PAGE_HEIGHT": 420 }, "A7 (74 x 105 mm)" : { "PAGE_WIDTH": 210 , "PAGE_HEIGHT": 298 }, "A8 (52 x 74 mm)" : { "PAGE_WIDTH": 147 , "PAGE_HEIGHT": 210 }, "A9 (37 x 52 mm)" : { "PAGE_WIDTH": 105 , "PAGE_HEIGHT": 147 }, "A10 (26 x 37 mm)" : { "PAGE_WIDTH": 74 , "PAGE_HEIGHT": 105 }, };
var sizes_envelopes_data = { "DL (220 x 110 mm)" : { "PAGE_WIDTH": 624 , "PAGE_HEIGHT": 312 }, "C4 (229 x 324 mm)" : { "PAGE_WIDTH": 649 , "PAGE_HEIGHT": 918 }, "C5 (229 x 162 mm)" : { "PAGE_WIDTH": 649 , "PAGE_HEIGHT": 459 }, "C6 (162 x 114 mm)" : { "PAGE_WIDTH": 459 , "PAGE_HEIGHT": 323 }, "C6/5 (229 x 114 mm)" : { "PAGE_WIDTH": 649 , "PAGE_HEIGHT": 323 }, };
var sizes_paper = Object.keys(sizes_paper_data); var sizes_envelopes = Object.keys(sizes_envelopes_data);
function funcName(size) { return Utilities.computeDigest(Utilities.DigestAlgorithm.MD2, size).reduce(function(result, value) { return result.concat(Math.abs(value)); },"set"); }
eval(sizes_paper.map(function(size) { return function ${funcName(size)}() { setPageSize(sizes_paper_data["${size}"]) }
}).join(';\n'));
eval(sizes_envelopes.map(function(size) { return function ${funcName(size)}() { setPageSize(sizes_envelopes_data["${size}"]) }
}).join(';\n'));
function onOpen(e) { var ui = DocumentApp.getUi(); var menu = ui.createAddonMenu(); sizes_paper.forEach(function(size) { menu.addItem(size, funcName(size)); }); menu.addSeparator(); sizes_envelopes.forEach(function(size) { menu.addItem(size, funcName(size)); }); menu.addSeparator().addItem("Portrait ⇄ Landscape", "togglePortraitLandscape").addToUi(); }
function onInstall(e) { onOpen(e); }
function setPageSize(size_dict) { DocumentApp.getActiveDocument().getBody().setAttributes(size_dict); }
function togglePortraitLandscape() { var body = DocumentApp.getActiveDocument().getBody(); var attributes = body.getAttributes(); var width = attributes["PAGE_WIDTH"]; var height = attributes["PAGE_HEIGHT"]; body.setAttributes({ "PAGE_WIDTH" : height, "PAGE_HEIGHT" : width, }); }
/*
Copyright (c) 2017 Zalando SE / Schlomo Schapiro
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@Lolol4572, where have I to paste it? Need to make custom page size too.
Page Sizer is no more available on Google Workspace marketplace (404 error page) Please help!
https://chrome.google.com/webstore/detail/page-sizer/acgkneeneageffjinlglednnehpelffb
I rely on Page Sizer too. This is a major problem. It's bad enough that I can't download and install it on another account, via the Google store, but they removed it from the account I was already using it on! Help!
If you simply want to use it in specific Google Docs, and it's worth the effort for you, you can simply copy the code of the add-on into that specific Doc, and it works well.
Here's a step by step:
Thanks for the advice. I sometimes need to define a non-standard (unique) page size, not an ISO or other standard paper size, so I will give @YisroelTech's instructions a try next time I need this. Thanks, again.
Page Sizer is no more available on Google Workspace marketplace (404 error page) Please help!
https://chrome.google.com/webstore/detail/page-sizer/acgkneeneageffjinlglednnehpelffb