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.

Wed Sep 27, 2017 3:21 pm

Hi,

upgrading from version 3.9 to the latest 3.9.360 of Spire.PDF (.NET), Visual Studio notified me with a list of warnings 'PdfDocument.PrintDocument' is obsolete: 'This property may be removed in the future, please use the property of PrintSettings to setting or the method of Print to printing.'

How should I edit the instruction:
pdfdocument.PrintDocument.OriginAtMargins = true;

Where can I find the API reference?

Thanks.

mmassei
 
Posts: 4
Joined: Wed Sep 27, 2017 2:11 pm

Thu Sep 28, 2017 9:47 am

Hello mmassei,

Thanks for your inquiry.
Since we made some modification interiorly, and the settings under PrintDocument can be managed in other ways, we just maked it obsolete. Anyway, you can still utilize it if you like.
Concerning the margin settings, you could refer to the following code. There's no need to declare the pdfdocument.PrintDocument.OriginAtMargins = true; at present.
Code: Select all
 doc.PrintSettings.SetPaperMargins(40,40,40,40);

By the way, the API has not been updated so far. Once it is done, I will inform you.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Sat Sep 30, 2017 8:13 am

Hi mmasseim,

Have you tried the code I provided?
Your feedback will be greatly appreciated.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon Oct 02, 2017 3:01 pm

Hi Jane,

yes, I tried the code but it doesn't solve my inquiry.

My working code with v. 3.9 is:
Code: Select all
pdfdocument.PrinterName = printerConf.printerName;
pdfdocument.PrintDocument.DefaultPageSettings.PaperSize = new PaperSize("MyPaper", width, height);
pdfdocument.PrintDocument.PrintController = new StandardPrintController();
pdfdocument.PrintDocument.DefaultPageSettings.Landscape = false;
pdfdocument.PrintDocument.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
pdfdocument.PrintDocument.OriginAtMargins = true;
pdfdocument.PrintDocument.PrinterSettings.Copies = 1;
pdfdocument.PageScaling = PdfPrintPageScaling.ActualSize;
pdfdocument.PageSettings.Orientation = PdfPageOrientation.Portrait;


With v. 3.9.360, trying to replace all the PrintDocument occurrence with the equivalent in PrintSettings, I tried with the following code:

Code: Select all
pdfdocument.PrintSettings.PrinterName = printerConf.printerName;
pdfdocument.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.ActualSize, false );
pdfdocument.PrintSettings.PaperSize = new PaperSize("MyPaper", width, height);
pdfdocument.PrintSettings.SetPaperMargins(0, 0, 0, 0);
pdfdocument.PageSettings.Orientation = PdfPageOrientation.Portrait;
pdfdocument.PrintSettings.Landscape = false;
pdfdocument.PrintSettings.Copies = 1;


But this code prints the document starting at the left hard margin, while I need that the document starts at the left edge of the paper. That is the purpose of the instruction:
Code: Select all
pdfdocument.PrintDocument.OriginAtMargins = true;

mmassei
 
Posts: 4
Joined: Wed Sep 27, 2017 2:11 pm

Tue Oct 03, 2017 4:15 am

Dear mmassei,

Thanks for your feedback.
Could you please provide us with the input document to help us do further investigation ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Oct 03, 2017 3:13 pm

Hi Betsy,

here is the pdf we used to test the code.

Thanks

mmassei
 
Posts: 4
Joined: Wed Sep 27, 2017 2:11 pm

Wed Oct 04, 2017 9:37 am

Hello,

Thanks for your response.
My colleague gary has replied you in the email regarding this issue.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed Oct 04, 2017 2:05 pm

Thanks.

Marco

mmassei
 
Posts: 4
Joined: Wed Sep 27, 2017 2:11 pm

Return to Spire.PDF