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.

Tue Apr 27, 2021 4:03 am

I use Free.Spire.PDF to print pdf files. I want to set the number of copies to print and set the size when printing. However both are inactive.
Please guide me

thiennhc
 
Posts: 8
Joined: Tue Apr 27, 2021 3:59 am

Tue Apr 27, 2021 7:09 am

Hello,

Thanks for your inquiry
I tried to set the number of copies to print and set the size using the following code with FreeSpire.PDF v7.2.0, and found it works well. If you are not using this code, please give it a try.
Code: Select all
            PdfDocument pdf = new PdfDocument();
            pdf.LoadFromFile("print.pdf");
            PaperSize paperSize = pdf.PrintSettings.PaperSize;
            pdf.PrintSettings.PaperSize = new PaperSize("custom", 516, 356);
            pdf.PrintSettings.Copies = 2;
            pdf.Print();


If there are still any issues, to help us investigate further, please provide us with your input file and your OS information (e.g. Windows7, 64bit). Thanks in advance

Sincerely,
Brian
E-iceblue support team
User avatar

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

Tue Apr 27, 2021 7:18 am

I use your code, but when printing with Microsoft Print to PDF, then opening the PDF file with Acrobat, the page size is 8.27x11.69 inch, which is the size of A4. Is there any way to print out and change this page size?
Also Copies doesn't work, always print out a copy

thiennhc
 
Posts: 8
Joined: Tue Apr 27, 2021 3:59 am

Tue Apr 27, 2021 7:56 am

On page size, I see content as the print out with size settings are correct in the source code. Meanwhile I want to set the size of the paper when I print it out
As for copies, I want when printing with Microsoft Print to PDF, the copies will be printed in the file in sequential order
I am using Win 10 64 bit, latest Spire version

Is there any way to do it?

thiennhc
 
Posts: 8
Joined: Tue Apr 27, 2021 3:59 am

Tue Apr 27, 2021 10:43 am

Hello,

Thanks for your feedback.
I tested the code with the printer “Microsoft Print to PDF”, and I did find that the page size of the print file is always A4. I have posted it to our Dev team with the ticket SPIREPDF-4253 and they will investigate further. If there is any update, we will let you know.

As for copies, I tested the code below with both FreeSpire.PDF v7.2.0 and the latest commercial version Spire.PDF v7.4.13, but the printout contains multiple copies. To help us further investigate this issue, please provide us with your test PDF file and tell us your project target framework (e.g. .NET Framework 4.5). Thanks in advance.
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("test.pdf");
pdf.PrintSettings.PrinterName = "Microsoft Print to PDF";
pdf.PrintSettings.Copies = 4;
pdf.PrintSettings.PrintToFile("result.pdf");
pdf.Print();

Sincerely,
Brian
E-iceblue support team
User avatar

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

Wed Apr 28, 2021 3:16 am

Thanks for your feedback
Sorry for the security, I cannot send the file to you, we are using Net Framework 4.5
As for copies, how are you performing?
If setting Copies = 4, will it print out a file containing 4 identical contents from top to bottom, or output 4 files?

thiennhc
 
Posts: 8
Joined: Tue Apr 27, 2021 3:59 am

Wed Apr 28, 2021 10:19 am

Hello,

Thanks for your feedback.
To protect your privacy, your could send your test file to us ([email protected]) via email. Don’t worry, we promise to keep your document confidential and we will not use it for any other purpose.
For copies, the code I used is the one I provided above, it will print out a file containing 4 identical contents. Here I uploaded my .exe file, you can click the file “25285Demo.exe” to run it directly on your side.

Sincerely,
Brian
E-iceblue support team
User avatar

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

Thu Apr 29, 2021 5:15 am

Thanks for the feedback
I tested the application you sent, and it copied exactly as I wanted
But my application doesn't work like that
Can you share the code with me?
And are you on the commercial version of Spire.PDF? I'm using Free.Spire.PDF

thiennhc
 
Posts: 8
Joined: Tue Apr 27, 2021 3:59 am

Thu Apr 29, 2021 6:07 am

Hello

Thanks for your response.
I did use Free.Spire.PDF, not the commercial version. This is my test project, you can check if there is any difference with your project.

Sincerely,
Brian
E-iceblue support team
User avatar

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

Thu Apr 29, 2021 6:15 am

Thanks for your feedback
Are you using C # WinForm?
I am using C # WPF, maybe it is the main cause
I will check and feedback

thiennhc
 
Posts: 8
Joined: Tue Apr 27, 2021 3:59 am

Thu Apr 29, 2021 6:47 am

I'm using C # WPF, so you can check the setting PrintSetting.Copies help me work on WPF not?

thiennhc
 
Posts: 8
Joined: Tue Apr 27, 2021 3:59 am

Thu Apr 29, 2021 11:47 am

Hello,

Thanks for your feedback.
I created a WPF project and tested your case, but I still did not reproduce your issue. Here I uploaded my new test project, please run it directly on your side. You can check if there is any difference with your project.


Sincerely,
Brian
E-iceblue support team
User avatar

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

Sat May 08, 2021 7:17 am

Hello,

Have you run the project we provided to you? What is the result? Any feedback will be greatly appreciated.

Sincerely,
Brian
E-iceblue support team
User avatar

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

Mon Jun 28, 2021 6:11 am

Hello,

Thanks for your patience.
This is to give you an update on the issue SPIREPDF-4253. After further investigation by our Dev team, we found this issue is caused by the printer "Microsoft Print to PDF" not supportting setting custom print paper sizes. If you directly use the printing API of C# (without our Spire.PDF) to customize the paper, the paper size of the printout is always A4 and cannot be changed. You can verify this by testing the code below on your side. Hope you can understand.
Code: Select all
            PrintDocument print = new PrintDocument();
            print.DefaultPageSettings.PaperSize = new PaperSize("custom", 516, 356);
            print.Print();


Sincerely,
Brian
E-iceblue support team
User avatar

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

Fri Sep 17, 2021 2:31 pm

I have a licensed version of spire.pdf. I'm trying to use pdfspire.PrintSettings.Copies = 3 but it is not printing 3 identical copies. Is this property works? I'm using vb.net

surendrak
 
Posts: 1
Joined: Fri Sep 17, 2021 2:27 pm

Return to Spire.PDF