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 Oct 26, 2021 11:03 am

We are currently using spire.pdf 7.10.
I'm trying to print pdf's (in this case photo's saved in pdf-format) A4 size.
I load the document into a Sprire pdf document and try to influence the way the document is printed by using this statement
I then save the document to a memorystream and send it back to the frontend as a byte[].

Code: Select all
                            PdfDocument doc = new PdfDocument(document);
                            doc.PrintSettings.SelectSinglePageLayout(Spire.Pdf.Print.PdfSinglePageScalingMode.FitSize, true, 100f);

                            MemoryStream docstream = new MemoryStream();
                            doc.SaveToStream(docstream);

                            return docstream.ToArray();


The frontend uses PdfToPrinter to actually send the document to the printer.
However, no matter how I change the printsettings, PdfToPrinter keeps printing multiple pages on one page.

So the final question is: Are the printsettings actually stored in the document itself of is that simply a wrong assumption?

rijsbergen
 
Posts: 4
Joined: Fri Jul 21, 2017 8:36 am

Wed Oct 27, 2021 2:26 am

Hello,

Thank you for contacting.
Kindly note that the printsettings weren't stored in document itself, like you print a PDF file in Adobe, they will make effect while doing printing. Besides, our Spire.PDF also supports printing. You can refer to the following code to print your PDF. If there is still any question, just feel free to write back.
Code: Select all
PdfDocument doc = new PdfDocument(document);
//PrintSettings
pdf.PrintSettings.SelectSinglePageLayout(Spire.Pdf.Print.PdfSinglePageScalingMode.FitSize, true, 100f);
//Set the printer
pdf.PrintSettings.PrinterName = @"your printer name";
//Print
pdf.Print();

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Wed Oct 27, 2021 1:30 pm

Thanks for your reply.
Using the spire print is not possible in our case since we use spire on the backend to generate/modify pdf documents.
The actual printing is done locally by the frontend which is a Delphi application.

But at least now I understand why my efforts to influence the printsettings had no result at all.

rijsbergen
 
Posts: 4
Joined: Fri Jul 21, 2017 8:36 am

Thu Oct 28, 2021 3:08 am

Hello,

Thanks for your feedback.
Yes, when using our Spire.PDF printing function in backend program, it is impossible to call the frontend client -side printer directly. It only can invoke the printer installed on the server side. Anyway, if there is anything else we can do for you in the future, just feel free to let us know.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF