There is a nice GAS script to print a Google sheet in google app script print button
As discussed on the Google Cloud Connect (https://www.cloudconnect.goog/message/77627), we are trying to identify a way to control the margins.
There is also a similar question over on the Google Product Forums at https://productforums.google.com/forum/#!topic/docs/DQxnJwoDn0c
You might find this script useful.
I think that it might answer your question on the margins plus it has a few other helpful settings that you can play with.
function printPdf() {
SpreadsheetApp.flush();
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var gid = sheet.getSheetId();
var pdfOpts = '&size=A3&fzr=true&portrait=false&fitw=true&gridlines=false&printtitle=true&sheetnames=true&pagenumbers=true&attachment=false&gid='+gid;
var url = ss.getUrl().replace(/edit$/, '') + 'export?format=pdf' + pdfOpts
var app = UiApp.createApplication().setWidth(300).setHeight(100);
app.setTitle('Your Print Preview is Ready');
var link = app.createAnchor('Open Print Preview', url).setTarget('_new');
app.add(link);
ss.show(app);
}
See also: Printing a sheet to PDF
This was also reported in this thread. I suggest to file a feature request for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With