toPdf paints each sheet as the Copy Picture command in Microsoft Excel paints it: the cells as on screen, with charts and pictures. It paints row and column headers only when you set labels: true. It needs skia-canvas and @reductoai/portable-fonts (see Installation).
toPdf is in @reductoai/xlsx/node only. To get a picture in the browser, see PNG.
Every sheet
toPdf returns the bytes and does not write a file:
One sheet
Give the sheet names or zero-based indexes insheets. Each sheet is one page, in the order you give.
One range
Give an A1 range inrange. Put the sheet name before !, and the PDF has one page. Without a sheet name, each sheet in sheets, or each visible sheet, gives one page of that range.
Options
Each page is the size of its sheet’s picture, at 0.75 points for each sheet pixel.
toPdf does not divide a sheet into printed pages. A page holds at most 1,000 rows and 100 columns (see Limits).