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 May 10, 2021 12:03 pm

Hi,

I am trying to print an existing pdf file with FreeSpire.PDF in c# .NET.

I follow the examples I can find and have the following code.

Code: Select all
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(pdfTemplate);
doc.PrintDocument.Print();


I get the following error.
Code: Select all
'PdfDocument' does not contain a definition for 'PrintDocument' and no accessible extension method 'PrintDocument' accepting a first argument of type 'PdfDocument' could be found (are you missing a using directive or an assembly reference?)


I assumed that printing documents is not part of the free version, but from what I can see in the documentation, it should be.

Any thoughts? :)

Thanks for your help.

lemaao86
 
Posts: 1
Joined: Mon May 10, 2021 11:55 am

Tue May 11, 2021 2:58 am

Hello,

Thanks for your inquiry.
Did you install Free Spire.PDF from NuGet in your .NET Core app? Kindly note that for .NET Core Apps, if you install our Free Spire.PDF from NuGet, it will use the .NETStandard dlls by default. Sorry that our .NETStandard dlls do not support printing at present.

To solve this issue, I recommend you can download the FreeSpire.PDF v7.2.0 from our website, manually reference the .NETCore dlls and then install the following library in your .NET Core App.
netcoreapp2.0
System.Drawing.Common >= 4.5.0
System.Text.Encoding.CodePages >= 4.5.0

netcoreapp3.0
System.Drawing.Common >= 4.7.0
System.Text.Encoding.CodePages >= 4.7.0

Besides, the method “doc.PrintDocument.Print();” is obsoleted, please use the new method “doc.Print()” to print PDF files.
If there is any question, please feel free to write back.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue May 18, 2021 7:38 am

Brian.Li wrote:Hello,

Thanks for your inquiry.
Did you install Free Spire.PDF from NuGet in your .NET Core app? Kindly note that for .NET Core Apps, if you install our Free Spire.PDF from NuGet, it will use the .NETStandard dlls by default. Sorry that our .NETStandard dlls do not support printing at present.

To solve this issue, I recommend you can download the from our website, manually reference the .NETCore dlls and then install the following library in your .NET Core App.
netcoreapp2.0
System.Drawing.Common >= 4.5.0
System.Text.Encoding.CodePages >= 4.5.0

netcoreapp3.0
System.Drawing.Common >= 4.7.0
System.Text.Encoding.CodePages >= 4.7.0

Besides, the method “doc.PrintDocument.Print();” is obsoleted, please use the new method “doc.Print()” to print PDF files.
If there is any question, please feel free to write back.

Sincerely,
Brian
E-iceblue support team


Hi Brian,

Is this the same with full Spire.PDF version? For both the Free and Paid for version v6.2 from NuGet appears to have the print API, but anything above does not

alfie196
 
Posts: 4
Joined: Tue May 18, 2021 7:22 am

Tue May 18, 2021 9:12 am

Hello,

Thanks for your inquiry.

For the free version, starting from Free Spire.PDF v6.10.6, we have removed the .NETCore dlls from the NuGet package. Therefore, when using Spire.PDF v6.10.6 and later versions, you need to download our component from our website if you want to use the print function.

As for the paid version, we have removed the .NETCore dlls from the NuGet package starting from Spire.PDF v6.9.16. But you can install this Nuget package (Spire.PDF.NETCore) to directly use our .NETCore dlls.

If you have any other questions, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue May 18, 2021 10:02 am

Thanks.

I'm hoping to evaluate the full version, but I am awaiting a response from sales, they seems to be a lot slower than support! :lol:

alfie196
 
Posts: 4
Joined: Tue May 18, 2021 7:22 am

Tue May 18, 2021 10:35 am

Hello,

Thanks for your response.
Sorry that our sales team was not able to respond to you in time due to the time difference.
Our working time is GMT +8 9:00 AM to 18:00 PM, and our sales team is currently off work. We will get back to you as soon as possible after we start work tomorrow morning. Sorry for the inconvenience caused.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Wed May 19, 2021 8:35 am

Thanks for your help.

Are there any API documents? I can find examples, but it would be handy to have the full API docs for development.

alfie196
 
Posts: 4
Joined: Tue May 18, 2021 7:22 am

Wed May 19, 2021 8:53 am

Hello,

Thanks for your response.
Here is the online API doc of Spire.PDF for .NET for your kind reference.
https://www.e-iceblue.com/Tutorials/API/Spire.PDF.html

Or you can download the API document in .chm format from the link below.
https://www.e-iceblue.com/downloads/att ... PdfAPI.zip

If there are any other questions, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Wed May 19, 2021 10:20 am

Perhaps I am misunderstanding what you meant in your previous post. I have the Spire.PDF NuGet 7.5 package and the Spire.PDF.NETCore 7.5 NuGet package

However

Code: Select all
                                   PdfDocument doc = new PdfDocument();
                                    doc.LoadFromFile(filePath);
                                    doc.PrintSettings.PrinterName = printerSettings.PrinterName;
                                    doc.Print();


Does not compile

Severity Code Description Project File Line Suppression State
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?)
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?)


What else could I be missing?

alfie196
 
Posts: 4
Joined: Tue May 18, 2021 7:22 am

Thu May 20, 2021 3:49 am

Hello,

Thanks for your feedback.
Please note that the Spire.PDF NuGet 7.5 package and the Spire.PDF.NETCore 7.5 package are not compatible. To use the PDF printing function, you only need to install the Spire.PDF.NETCore 7.5 NuGet package.

Please remove the Spire.PDF NuGet 7.5 package from your project and try it again. If there are any questions, just feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Fri May 28, 2021 11:23 am

Hello,

Greeting from E-iceblue!
How is your issue now? Could you please give us some feedback at your convenience?

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF