Sumatra PDF is a PDF, ePub, MOBI, CHM, XPS, DjVu, CBZ, CBR reader for Windows

API Pages per sheet

I was reading API and didn’t find out how to print 4 pages per sheet.
Is it possible?

n-up is a printer function, SumatraPDF and other apps supply all single pages to any print driver and if default print driver is versatile it places them 4 up at time in it’s output.

So in effect depends on the quality of software supplied with the printer.
If system print is defaulted to 2-up or 4-up then that’s what’s output.
image

So here is an ePub printed 4 up per page and then re-viewed as a single page

In SumatraPDF I can save those GhostScript outputs as PDF with 4-up pages so they are noticeably quicker to load or reprint to a more basic printer, but the file sizes are ginormous with 4 times the data per page
image
I would need to at least 1/4 the pixels per page to make them reasonable for viewing. but if I export as PNG they are readable but phenomenally smaller and can be collected and read as a group if stored in a zip.cbz
image
image

It works well in user interactive mode and printer supports it. But I want to print large files with n-up function in command line using API.
Any code examples?

SumatraPDF is a graphics interactive viewer, with limited support for interactive image printing and that is reflected by even more limited ability when used via CLI.

The core engine is Artifex MuPDF which is screen biased e.g. the GL viewer has no print ability even though it has a scriptable programming API. It is small brother of Artifex GhostScript which is biased to CLI Printing and has very limited viewer capability.

Thus it is better to use, as I did above, the n-up printer features found in GhostScript. But using SumatraPDF via CLI as an intermediary is not a good work flow.

For quality printer output it is best to use a printer quality tool.

Note there are very similar tools for page imposition thus to build a leaflet / booklet we may often use n-up re-arrangements to ensure a variety of mixes such as
8 | 1 3 | 6
7 | 2 4 | 5

and some are CLI tools that could juggle OR simply keep pages in conventional 4 up mode throughout a larger file.
I got very good fast results (244 pages in normal order very quickly reduced to 61 with minimal reduction in file vector contents that’s good to maintain quality) with Marcus Mays java tool nup_pdf © 2005 and the windows 2 portable files version compiled by Steven Lee n-up | RubyPDF Blog

1 Like

As a result of your query I have released my N-Up Addin Which like others can be run standalone, and could be modified to add a command line print rather than re-view.

However I guess you have by now found a more direct method.

1 Like

Thank you very much!