1
Good night,
I have developed a program and need to implement PDF printing functionality.
Doing research on the Internet I found what I need, but there’s a problem. When I run the code in a separate console program, it opens the window of the option to choose the printer and then prints. I implemented this code in my project, but is presenting the following error:
Error 1 Could not load file or Assembly 'file://C: Job Projects NET CORREIOS Ctzemisetiqcorreios Ctzemisetiqcorreios bin Debug Spire.License.dll' or one of its dependencies. Operation without support. (HRESULT exception: 0x80131515) C: Work Projects NET POST OFFICE Ctzemisetiqcorreios Ctzemisetiqcorreios SGEN Ctzemisetiqcorreios
I’m using external dll:
using Spire.Pdf; using Spire.pdf.Annotations; using Spire.pdf.Widget;
These libraries are attached inside the debug folder and in the project release folder, but have not solved.
The method is as follows::
// Bibliotecas externas
using Spire.Pdf;
using Spire.Pdf.Annotations;
using Spire.Pdf.Widget;
private void PrintPdf(string pstrNomeArqTxt)
{
PdfDocument doc = new PdfDocument();
//Set the printer and select the pages you want to print
PrintDialog dialogPrint = new PrintDialog();
dialogPrint.AllowPrintToFile = true;
dialogPrint.AllowSomePages = true;
dialogPrint.PrinterSettings.MinimumPage = 1;
dialogPrint.PrinterSettings.MaximumPage = doc.Pages.Count;
dialogPrint.PrinterSettings.FromPage = 1;
dialogPrint.PrinterSettings.ToPage = doc.Pages.Count;
if (dialogPrint.ShowDialog() == DialogResult.OK)
{
//Set the pagenumber which you choose as the start page to print
doc.PrintFromPage = dialogPrint.PrinterSettings.FromPage;
//Set the pagenumber which you choose as the final page to print
doc.PrintToPage = dialogPrint.PrinterSettings.ToPage;
//Set the name of the printer which is to print the PDF
doc.PrinterName = dialogPrint.PrinterSettings.PrinterName;
PrintDocument printDoc = doc.PrintDocument;
dialogPrint.Document = printDoc;
printDoc.Print();
}
}
Does anyone know what is causing the mistake ?
Thank you
As Errorlog himself says he is unable to find Spire.License.dll you copied this dll to your project?
– JcSaint
Good morning, Jcsaint copied yes.. I managed to solve the problem in debug mode. I removed the dll’s that were in the debug folder and put loose in the bin folder and it worked. Now the problem is in release mode, the error remains. I did the same procedure and did not solve it. I am thinking about what to do to solve now.
– Diego Farias
Diego has a look at this post: http://stackoverflow.com/q/368384/2588695
– JcSaint