Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Dec 18, 2020 7:20 am

I have a PDF that contains multiple pages,
Question: when print out, how to control how-many pages in each print-out A4 paper?

grchen168
 
Posts: 32
Joined: Sat Jan 24, 2015 4:48 pm

Fri Dec 18, 2020 10:07 am

Hello,

Thanks for your inquiry.
Please refer to the following code to print multiple pages in an A4 paper. If there are any other questions, please feel free to contact us.
Code: Select all
            PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile("test1.pdf");

            //Print 4 PDF pages per sheet
            pdf.PrintSettings.SelectMultiPageLayout(2, 2);
         
            pdf.PrintSettings.PaperSize = new PaperSize("A4",(int)PdfPageSize.A4.Width, (int)PdfPageSize.A4.Height);
            pdf.Print();


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Fri Dec 18, 2020 10:51 am

Thanks for the reply.
But, what I want to achieve is : how to programatically
(1) print each page into each paper,
(2). print every 2 pages into each paper,
(3) print every n pages into each paper

grchen168
 
Posts: 32
Joined: Sat Jan 24, 2015 4:48 pm

Mon Dec 21, 2020 3:09 am

Hello,

Thanks for your feedback and sorry for the late reply as weekend.
The method “SelectMultiPageLayout” in the code I provided above can be used to control how many pages are printed per sheet. Please refer to the following code to achieve your requirements.

Code: Select all
//(1) print each page into each paper
//by default, it print one page into each paper, or you can use this line
pdf.PrintSettings.SelectMultiPageLayout(1, 1); //(1 row, 1 column), it print 1*1 page into each paper

// (2) print every 2 pages into each paper
pdf.PrintSettings.SelectMultiPageLayout(2, 1); //(2 rows, 1 column), it print 2*1 pages into each paper
//pdf.PrintSettings.SelectMultiPageLayout(1, 2);// or (1 row, 2 columns), it print 1*2 pages into each paper

//(3) print every n pages into each paper
pdf.PrintSettings.SelectMultiPageLayout(i, j); // (i rows, j columns), it print i*j pages into each paper


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Mon Dec 21, 2020 4:03 am

it works.
Thank you.

grchen168
 
Posts: 32
Joined: Sat Jan 24, 2015 4:48 pm

Mon Dec 21, 2020 6:56 am

You are welcome. If there are any other questions, please do not hesitate to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF