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 Apr 18, 2019 1:33 pm

Good morning,
I want know if new free Spire.PDF working only with Framework 4.6 and upper.
When compiling project in C# the instruction "doc.PrintDocument" generate a "warning CS0618: 'PdfDocument.PrintDocument' is obsolete: 'This property may be removed in the future,please use the property of PdfDocument.PrintSettings or the method of PdfDocument.Print.'" but with "PdfDocument.PrintSettings" and "PdfDocument.Print" don't have a method in these property for printing.
Thank you for your attenction.

petrigno
 
Posts: 2
Joined: Sun Jun 25, 2017 6:45 am

Fri Apr 19, 2019 3:46 am

Hi,

Thanks for your inquiry.
Our free Spire.PDF is not only working with Framework 4.6 and upper, but also working with other Framework version. For an instance, the dlls in .NET 3.5 folder (under the free Spire.PDF package) is compatible with .NET Framework 3.5, 4, 4.5 and upper.
Kindly note that we made adjustments about printing, the "doc.PrintDocument" was obsoleted in newer version. Please replace it with the "doc.PrintSettings". Sample code is given as follows. If there is any question, please feel free to contact us.
Code: Select all
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(filePath);
doc.PrintSettings.PrinterName = "PrinterName";
doc.Print();

Sincerely,
Nina
E-iceblue support team
User avatar

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

Fri Apr 19, 2019 10:37 am

Thank you for your fast replay, I would like to inform you that if you use an HP multifunction printer the file is not printed and the printer stops responding, you must turn it off and on again, I will try to send the PDF image as a print to see if the problem is solved. If you have any suggestions for solving the problem it is welcome.
Another question, it is possible to select the type of paper on which to print based on the name by selecting it from the list of predefined formats for the printer, in C# (Windows) I read the names with "PrinterSetting.PaperSizeCollection" and I create a variable pointer to the paper that I have to use the example "int Card Type" when I have to print I select the type of paper I want to use with the "printDoc.DefaultPageSettings.PaperSize = printDoc.PrinterSettings.PaperSizes [Paper Type];" function, this system is particularly useful for a label printer of the DYMO where I select the type of label that I have to print based on the name example "99015" "33038" etc., is it possible to do a similar thing also with your Spire.PDF?
Thank you for your answer.

petrigno
 
Posts: 2
Joined: Sun Jun 25, 2017 6:45 am

Mon Apr 22, 2019 7:44 am

Hello,

Thanks for your feedback and sorry for late reply as weekend.
1) I did a test to print my Pdf via "HP LaserJet P1007" printer, but didn't notice the issue that the printer stops responding when printing. I guess the issue might be related to your printer itself. You could open your Pdf file in Adobe and directly print it via your HP printer to check if the issue occurs in this occasion.
2) Please refer to the following code to achieve your demand. If there is any question, please feel free to write back.
Code: Select all
//Load Pdf file
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(FileName);
PaperSize p = null;
PrintDocument printDoc = new PrintDocument();
//Loop through the paper in the printer to select the paper size you need
foreach (PaperSize ps in printDoc.PrinterSettings.PaperSizes)
{
    if (ps.PaperName.Equals("A3"))
    {
        p = ps;
        break;
    }
}
//Set the size of the paper size to A3
doc.PrintSettings.PaperSize = p;
//Print with FitSize mode
doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.FitSize, true);
doc.Print();

Sincerely,
Nina
E-iceblue support team
User avatar

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

Fri Apr 26, 2019 12:29 pm

Hi,

How is your issue now? Could you please give us some feedback about your convenience? Thanks in advance.

Sincerely,
Nina
E-iceblue support team
User avatar

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

Return to Spire.PDF