Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Sun Jan 22, 2023 10:02 am

Our software generates dynamic pages based on Word templates using Spire.Doc. These are then saved/mailed/etc ... as a .pdf document using 'doc.SaveToFile("example.pdf", Spire.Doc.FileFormat.PDF);'.

Some of these pages we generate are 'labels' which have to fit the physical paper exactly. However, when our customers download and print the generated PDF, Adobe selects page scaling 'fit_to_page' by default, and this messes up the margins.

Spire.PDF has an option to alter this behavior using the line 'pdf.PrintSettings.SelectSinglePageLayout(Spire.Pdf.Print.PdfSinglePageScalingMode.ActualSize);'. However, it would be nice if we could pass this parameter directly when saving our word as a file/stream from our Spire.Document.

pbo
 
Posts: 19
Joined: Fri Oct 23, 2015 1:46 pm

Mon Jan 23, 2023 2:19 am

Hello,

Thank you for your inquiry.
Please note that converting Word to PDF is the function of Spire.Doc, while printing PDF is the function of Spire.PDF. So there is no setting for this parameter when converting Word to PDF.
If this line of code ("pdf. PrintSettings. SelectSinglePageLayout (Spire.Pdf.Print.PdfSinglePageScalingMode.ActualSize);") is not set to print the PDF document, the printer's property settings will be used by default to the print document.
Our suggestion is that you change the default print of the printer to print according to the actual size or use the print setting function of our spire.PDF. But when using our product, please use spire.office, which includes Spire.PDF and Spire.Doc, so that the program will not report errors.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Doc