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.

Thu Feb 01, 2018 3:20 pm

Hello,
I have some difficult printing a pdf with big size to a plotter (an image in attachment).
The pdf file has already right size and i not want to scale it. (In attachment the file)
I try with code below but the result show only a portion of the content.
What is the problem? What I missed?
Thanks in advance
Code: Select all
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(path);
doc.PrintSettings.PrinterName = "PRINTER_NAME";
doc.PrintSettings.Copies = 1;

SizeF size = doc.Pages[0].Size;
PdfPageSettings settings = new PdfPageSettings();
settings.Size = new SizeF(size.Width, size.Height);
doc.PageSettings = settings;

PaperSize paper = new PaperSize("Custom", (int)size.Width, (int)size.Height);
paper.RawKind = (int)PaperKind.Custom;
doc.PrintSettings.PaperSize = paper;
doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.ActualSize, true);
 
doc.Print();

Degiorgi
 
Posts: 17
Joined: Thu Nov 02, 2017 3:22 pm

Fri Feb 02, 2018 6:18 am

Hello,

Thanks for your inquiry.
Please change the type of PdfSinglePageScalingMode to FitSize.
Code: Select all
 doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.FitSize, true);

If there is any confusion, welcome to write to us again.
Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Fri Feb 02, 2018 1:17 pm

Hello,
i tried this change but it doesn't works.
The result is an A4 format.

Degiorgi
 
Posts: 17
Joined: Thu Nov 02, 2017 3:22 pm

Mon Feb 05, 2018 5:42 am

Hello,

Thanks for your feedback and sorry for late reply as weekend.
The property FitSize means that the printed content is automatically adapted to the paper according to the aspect ratio of pdf page. I noticed that the aspect ratio of your paper is larger than the pdf page's, that's why you see a big blank area on the paper. In your case, you'd better use the paper which has the same aspect ratio as the pdf page. If there is any confusion, welcome to write to us again.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Fri Feb 09, 2018 8:23 am

Hello,

Greetings from E-iceblue.
How is your issue going?
Thanks in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Wed Feb 21, 2018 4:21 pm

hello,
I'm sorry for the late but i had the plotter out of use.
I tried to print follwing yours guide lines but the result is always the same: an A4 dimension file.
In debug I see correct values for PageSettings and PaperSize (In attach. same pictures of debug window) that reporting: Width = 2384.0 and Height = 3370 .
Here the code:
Code: Select all
private static void PrintPlotter(PdfDocument pdf)
        {
            SizeF size = pdf.Pages[0].Size;

            PdfPageSettings settings = new PdfPageSettings();
            settings.Size = new SizeF(size.Width, size.Height);
            pdf.PageSettings = settings;

            PaperSize paper = new PaperSize("Custom", (int)size.Width, (int)size.Height);
            paper.RawKind = (int)PaperKind.Custom;
            pdf.PrintSettings.PaperSize = paper;
            pdf.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.FitSize, true);
            pdf.Print();
        }


In attachment there is the file used to print (a0_vert.pdf).
Thanks in advance

Degiorgi
 
Posts: 17
Joined: Thu Nov 02, 2017 3:22 pm

Thu Feb 22, 2018 3:07 am

Hello,

Thanks for the information. The final printed result depends on the paper size on the printer, so you need to set the actual paper size not pdf page size, please kindly note that if you want to print big page size to a paper which size is smaller than it, the content needs to scale, otherwise it will be printed paritially, the behavior is same as Adobe's behavior.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu Feb 22, 2018 9:33 am

Hello, I understand that the final result depends on paper size on the printer and that printing a big file on a smallest paper it will be scaled using FitSize.
But I have the inverse problem: one big pdf file (A0 841 x 1189 mm) and I want to print it on a plotter which have a paper roll of 111,8 cm x 30,5 m .
For this I tried to print it without scaling using PdfSinglePageScalingMode.ActualSize but it doesn't work.

Degiorgi
 
Posts: 17
Joined: Thu Nov 02, 2017 3:22 pm

Fri Feb 23, 2018 8:35 am

Hello,

Thanks for your response. I have discussed the issue with our Dev team that it would be printed with A4 dimension if it don't specific the PaperSize, and we checked the attached image you attach in previous post, if the paper size is 111,8 cm x 30,5 m, from the picture, the printed result should be 841 x 1189 mm and the setting is ActualSize, because the A4 dimension size is only 21x29.7cm, if any doubt, you could try to print it with Adobe, the printing behavior in our product mimics it to achieve, if there is difference between them, please give us more information for us investigation further.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Feb 28, 2018 11:53 am

Hello,
thanks for your response. I tried to print with Adobe Acrobat Reader DC and i get a correct output when I select the checkbox "Select alimentation from document dimension" otherwise it select an A4 dimension by default. In attachment the screen shot of print tests.
Thank you so much,
Mauro

Degiorgi
 
Posts: 17
Joined: Thu Nov 02, 2017 3:22 pm

Thu Mar 01, 2018 3:14 am

Dear Mauro,

Thanks for your feedback.
If you have other questions, please feel free to contact us.
Wish you all the best!

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Fri Mar 02, 2018 2:50 pm

Hello,
I'm sorry but i need to print it silently. Can you provide me the code to print like the attachment into previous post where there is the checkbox checked?

Degiorgi
 
Posts: 17
Joined: Thu Nov 02, 2017 3:22 pm

Mon Mar 05, 2018 10:29 am

Hello,

Thanks for your feedback.
Sorry that our Spire.Pdf doesn't support the option at present, we will consider adding it as a new feature into our upgrade list, if it can be achieved in the future, we will let you know.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.PDF