googleスプレッドシートをPDF化するときの自分用設定をブックマークレット化してみました。
javascript:(function(){const current = location.href;if (current.match(/^.+docs\.google\.com\/spreadsheets\/d\//)) {const m = current.match(/^.+\/d\/(.+)\/edit#gid=(.+)$/);const printUrl = `https://docs.google.com/spreadsheets/d/${m[1]}/export?exportFormat=pdf&format=pdf&size=A4&portrait=false&sheetnames=false&printtitle=false&fitw=true&pagenumbers=false&gridlines=false&top_margin=0.75&bottom_margin=0.75&left_margin=0.25&right_margin=0.25&horizontal_alignment=LEFT&vertical_alignment=TOP&fzr=false&gid=${m[2]}`;window.open(printUrl);}})()
下記のように各種パラメータを設定しています。
-
exportFormat=pdf
format=pdf
PDF形式 -
size=A4
A4サイズ -
portrait=false
横向き印刷 -
sheetnames=false
シート名を印刷しない -
printtitle=false
タイトルを印刷しない -
fitw=true
幅に揃える -
pagenumbers=false
ページ番号を表示しない -
gridlines=false
グリッド線を印刷しない -
top_margin=0.75
bottom_margin=0.75
上下余白0.75インチ(プリセットの余白「狭」) -
left_margin=0.25
right_margin=0.25
左右余白0.25インチ(プリセットの余白「狭」) -
horizontal_alignment=LEFT
vertical_alignment=TOP
左上寄せ -
fzr=false
固定行を表示しない
コード
(function(){
const current = location.href;
if (current.match(/^.+docs\.google\.com\/spreadsheets\/d\//)) {
const m = current.match(/^.+\/d\/(.+)\/edit#gid=(.+)$/);
const printUrl = `https://docs.google.com/spreadsheets/d/${m[1]}/export?exportFormat=pdf&format=pdf&size=A4&portrait=false&sheetnames=false&printtitle=false&fitw=true&pagenumbers=false&gridlines=false&top_margin=0.75&bottom_margin=0.75&left_margin=0.25&right_margin=0.25&horizontal_alignment=LEFT&vertical_alignment=TOP&fzr=false&gid=${m[2]}`;
window.open(printUrl);
}
})()