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 Mar 27, 2024 12:04 am

I'm currently using the FreeSpirePDF Library. I noticed that there is an Updated Library (v10.2.0) on NuGet. After installation, I found that the PDFDocument Print function is no longer available. How am I supposed to output a PDF to the Printer?

FastTrak
 
Posts: 1
Joined: Wed Jun 26, 2013 2:39 am

Wed Mar 27, 2024 3:42 am

Hello,

Thanks for your inquiry.
Our latest version of Free Spire.PDF does not remove the printing method. How did you use it? Please provide us with your test code so that we can investigate more accurately. Thanks in advance.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 203
Joined: Mon Dec 27, 2021 2:23 am

Wed Mar 27, 2024 9:26 am

Hello,

I have a similar issue:
Code: Select all
using ClientUtils.Interfaces;
using Spire.Pdf;
using Spire.Pdf.Print;

namespace ClientUtils;

public class Printer : IPrinter
{
    public void Print(string fullFilePath, string printerName)
    {
        PdfDocument doc = new ();
        doc.LoadFromFile(fullFilePath, FileFormat.PDF);
       
        if (!string.IsNullOrEmpty(printerName))
        {   
            doc.PrintSettings.PrinterName = printerName;
        }
       
        doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.ActualSize, false);

        doc.PrintSettings.SetPaperMargins(0, 0, 0, 0);
       
        doc.Print();
    }
}

this can be compiled using FreeSpire.PDF 8.6.0 or SpirePdf 10.3.7 but not using FreeSpire.PDF 10.2.0:

Screenshot 2024-03-27 102232.png

0>Printer.cs(16,17): Error CS1061 : 'PdfDocument' does not contain a definition for 'PrintSettings' and no accessible extension method 'PrintSettings' accepting a first argument of type 'PdfDocument' could be found (are you missing a using directive or an assembly reference?)
0>Printer.cs(19,13): Error CS1061 : 'PdfDocument' does not contain a definition for 'PrintSettings' and no accessible extension method 'PrintSettings' accepting a first argument of type 'PdfDocument' could be found (are you missing a using directive or an assembly reference?)
0>Printer.cs(22,13): Error CS1061 : 'PdfDocument' does not contain a definition for 'PrintSettings' and no accessible extension method 'PrintSettings' accepting a first argument of type 'PdfDocument' could be found (are you missing a using directive or an assembly reference?)
0>Printer.cs(24,13): Error CS1061 : 'PdfDocument' does not contain a definition for 'Print' and no accessible extension method 'Print' accepting a first argument of type 'PdfDocument' could be found (are you missing a using directive or an assembly reference?)
0>------- Finished building project: ClientUtils. Succeeded: False. Errors: 4. Warnings: 1

Sincerely

Alex

A_Alison
 
Posts: 4
Joined: Wed Mar 27, 2024 9:15 am

Wed Mar 27, 2024 10:01 am

Hello,

Thanks for your feedback.
Sorry, I'm not quite sure how you compiled your project. On my end, using Free Spire.PDF 10.2.0 to test the code you provided, no errors occurred. I speculate that this may be related to your project environment. Could you please investigate it yourself first, such as creating a simpler project to only import our Free Spire.PDF 10.2.0 and testing the printing function. If there are still issues, please provide us with a simple project so that we can further investigate. Thanks in advance.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 203
Joined: Mon Dec 27, 2021 2:23 am

Wed Mar 27, 2024 3:56 pm

Hi,

it compile if my project targets
Code: Select all
<TargetFramework>net48</TargetFramework>


and I have the issue if it targets
Code: Select all
<TargetFramework>net6.0</TargetFramework>

or
Code: Select all
<TargetFramework>netstandard2.1</TargetFramework>


best

A_Alison
 
Posts: 4
Joined: Wed Mar 27, 2024 9:15 am

Wed Mar 27, 2024 5:56 pm

yes the version 10.2.0 of FreeSpire.PDF does not support .Net6.0 anymore :(

A_Alison
 
Posts: 4
Joined: Wed Mar 27, 2024 9:15 am

Thu Mar 28, 2024 2:08 am

Hello,

Thanks for more information.
Yes, we have made adjustments to the latest Free Spire.PDF which ow only includes .NET Framework 4.8 and .NET Standard 2.0 dlls. Your .NET 6.0 project can only use the .NET Standard 2.0 dlls, but it doesn't support printing functionality. Therefore, we suggest that you upgrade to the latest commercial version(Spire.PDF Pack(Hot Fix) Version:10.3.7), but please note that the commercial version currently only supports printing on Windows systems.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 203
Joined: Mon Dec 27, 2021 2:23 am

Thu Mar 28, 2024 6:13 am

Hello,

thanks for your answer.

Best Regards,

A_Alison
 
Posts: 4
Joined: Wed Mar 27, 2024 9:15 am

Return to Spire.PDF

cron