Skip to main content
Known Participant
September 15, 2022
Answered

Javascript- printing multiple cropped pages in one sheet

  • September 15, 2022
  • 1 reply
  • 1473 views

I have a pdf file of 100 cropped A4 size pages- page widths are same, but cropped lengths are different. For example, first 3 cropped pages make an A4 page length (11 inches), next 2 pages makes an A4 page length. I want to print first 3 cropped pages in an A4 page and next 2 cropped pages in another A4 page.

 

Can 'multiple pages per sheet option' print one after another? As far as I know, it only prints pages as tiles in a page. I don't want tiled pages, I want one after another. What can I do to print these pages?

 

Can it be done through javascript ? Or any other third party softwares?
If javascript, how to approach it? Any ideas?

 

This topic has been closed for replies.
Correct answer try67

Yes, that should be possible, but each print command will have to be separate.

You should read the documentation of the PrintParams object to get started with this. It's not a trivial task, though.

1 reply

try67
Community Expert
Community Expert
September 15, 2022

Not quite sure that's what you mean, but in the Print dialog you can specify the page to print 1x4 to get four original pages onto one physical one, for example:

 

 

The pages will be automatically scaled to fit the paper you're printing them to.

Known Participant
September 15, 2022

Thank you! Thank you! Thank you! I don't know how but I completely missed that in the settings! When I tried, it was printing tiles of pages. Because I tried 2x4, 3x4 but never tried 1x4.

 

Now,
This solves part of my problem. If I take 1x4 for the entire document, in some output pages some parts are scaled down to fit the page. I dont want that. In my case, it is not 1x4 throughout the entire document. It is like 1x4 in the first page, 1x3 the next page...and so on. 

 

Now I have an idea that printing multiple pages a sheet can be done through javascript console.

 

So I want to write a code that takes all page lengths into an array and calculates how many cropped pages fits an A4 sized paper. Then the code sends that many pages for print at each print command and repeats the process. I think that is a way to handle the problem. Am I right? Is there a better or easier way? 

 

Any help, any idea, any piece of code is much appriciated.


 

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
September 15, 2022

Yes, that should be possible, but each print command will have to be separate.

You should read the documentation of the PrintParams object to get started with this. It's not a trivial task, though.