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.

Mon Dec 24, 2018 6:01 pm

In the previous versions I was able to loop through the available installed printer page sizes like so:

Code: Select all
               if (paperSize != null)
                {
                    foreach (PaperSize pSize in doc.PrintDocument.PrinterSettings.PaperSizes)
                    {
                        if (pSize.PaperName.ToLower() == paperSize.ToLower())
                        {
                            doc.PrintDocument.PrinterSettings.DefaultPageSettings.PaperSize = pSize;
                            doc.PrintDocument.DefaultPageSettings.PaperSize = pSize;
                            doc.PrintSettings.PaperSize = pSize;
                            pSizeFound = true;
                            break;
                        }
                    }


I see the the PrintDocument class is obsolete now. Is there a replacement for PDFdocument.PrintDocument.PrinterSettings.PaperSizes in the PrintSettings class?

buc
 
Posts: 3
Joined: Mon Dec 24, 2018 5:54 pm

Tue Dec 25, 2018 2:06 am

Hi,

Thank you for your inquiry.
Please refer to the following code.
Code: Select all
PrintDocument printDoc = new PrintDocument();
if (paperSize != null)
{
    foreach (PaperSize pSize in printDoc.PrinterSettings.PaperSizes)
    {
        if (pSize.PaperName.ToLower() == paperSize.ToLower())
        {
            printDoc.PrinterSettings.DefaultPageSettings.PaperSize = pSize;
            printDoc.DefaultPageSettings.PaperSize = pSize;
            doc.PrintSettings.PaperSize = pSize;
            pSizeFound = true;
            break;
        }
    }
}



Sincerely,
Jane
E-iceblue support team
User avatar

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

Thu Dec 27, 2018 2:51 am

Hi,

Greetings from e-iceblue!
Have you tried the code?
Your feedback would be greatly appreciated!

Sincerely,
Jane
E-iceblue support team
User avatar

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

Thu Dec 27, 2018 8:07 pm

How do I load the PDF to a PrintDocument if PdfDocument.PrintDocument is obsolete? For example this works but it says it's obsolete

Code: Select all
   PdfDocument doc = new PdfDocument();
                doc.LoadFromFile(file.FullName);
                PrintDocument printDoc = doc.PrintDocument;

buc
 
Posts: 3
Joined: Mon Dec 24, 2018 5:54 pm

Fri Dec 28, 2018 1:50 am

Hi,

The property "PrintDocument" is deprecated. Please handle the print settings under the attribute "doc.PrintSettings".
If you can't find the settings, just tell us and we will share the code with you.

Sincerely,
Jane
E-iceblue support team
User avatar

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

Fri Jan 04, 2019 1:48 am

Hi,

Greetings from e-iceblue!
Has your issue been resolved? Your feedback would be greatly appreciated!

Sincerely,
Jane
E-iceblue support team
User avatar

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

Mon Jan 07, 2019 2:50 pm

I was also having licensing issues so I moved to another PDF library, thanks for your help.

buc
 
Posts: 3
Joined: Mon Dec 24, 2018 5:54 pm

Tue Jan 08, 2019 1:30 am

Hi,

Thank you for your feedback.
Just feel free to contact us if you need any assistance in the future! :)

Sincerely,
Jane
E-iceblue support team
User avatar

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

Return to Spire.PDF

cron