Forum moved here!

# Home / API N-Up Pages per sheet

Stars

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

GitHubRulesOK

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.

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

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

Stars

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?

GitHubRulesOK

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

GitHubRulesOK

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.

Stars

Thank you very much!

Stars

Hi!

PDF N-UP Maker has an error with non ASCII file path. Doy you have another program to make 4-up pdf file?

GitHubRulesOK

You should find that cpdf which I use for the alternative 2-up = 4 page to a spread view is possibly more internationally aware, but not as versatile for this task it will ONLY place 2 pages stacked so needs an extra rotate for viewing. I see your OP was for 4-Up so it would need 2-UP (-twoup) twice and have added another alternative 4-up HOWEVER for viewing I occasionally encountered problems with modified PDF internals, but when using for printing they may not be a problem to you.

For printing there are many versatile imposition tools (normally for making booklet layouts) which at their simplest level offer to do N-Up without rotation, the difficulty is testing each one for a wide range of usage needs. And here I concentrate on those useful to SumatraPDF viewing so seek to retain bookmarks, searching etc…

I do not know your workflow but if it is automated you can work around the language problem with a latin folder name. something like…

set folder=c:\temp\ру́сскую
copy %folder%\*.* c:\temp\english
n-up c:\temp\english
copy c:\temp\english %folder%

GitHubRulesOK

@Stars
Quick test of 2-UP shows it seems to work OK with non latin characters see image added to above post.
So I will possibly edit N-Up to also avoid the language problem

GitHubRulesOK

@Stars
I have updated my N-Up-PDF.cmd Right Click RAW button to download, I note you are using nup_pdf direct from command line so will need to wrap your use in a similar way to first copy to %windir%\temp before processing then rename the result so only need the last half a dozen or so lines from my script.

Let me know that that method works, especially that you get no UAC problems.