Support reverse order in `pageRanges` param in `/chromium/pdf` REST API
A problem I need to generated PDF file with footer only on last page but the only working solution which I found has drawback - empty page on the end of the document. In this case I can just drop last page to get desired document.
Solution
Support reverse order indices in pageRanges param in /chromium/pdf REST API like in following console tools.
You can reference page numbers in reverse order by prefixing them with the letter r. For example, page r1 is the last page of the document, r2 is the next-to-last page of the document, and rend is the first page of the document. You can use this prefix in ranges, too, for example r3-r1 is the last three pages of a PDF.
qpdf:
A number preceded by r counts from the end, so r1 is the last page, r2 is the second-to-last page, etc.
Alternatives
Use console tools like pdftk or qpdf to drop unwanted pages after generating PDF.
Source: browserless/browserless