Hi,
When I merge pdf files using firstpdf.Pages.Add(secondpdf.Pages) I get this error:
can not read the file or assembly Aspose.Font, Version = 17.1.0.0, Culture = neutral, PublicKeyToken = 716fcc553a201e56 or one of its dependencies. The system can not find the specified file.
The problem happens in a web application (ASP.NET). I convert Word and Excel files to PDF using Aspose.Words and Aspose.Cells, and then I merge them with Aspose.Pdf
But now I tried the same code but in an console application with no errors.
Attached is the PDF files and this is the method that merges the files.
private void MergeDocuments() { string[] files = Directory.GetFiles( outputDir ); int i = 0; Aspose.Pdf.Document pdf = new Aspose.Pdf.Document( files[ 0 ] );
foreach ( string file in files ) {
if ( i == 0 ) { i++; continue; }
Aspose.Pdf.Document addPdf = new Aspose.Pdf.Document( file );
Thanks for sharing details and input file(s). I used your code and input file(s) in web application (ASP.NET) but I am sorry I was unable to get any exception. It generated the output file without throwing any exception. You may check the following code snippet which I used and attached output file.
private void MergeDocuments()
{
string[] files = Directory.GetFiles(Server.MapPath("Data/Test/"));
int i = 0;
Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(files[0]);
foreach (string file in files)
{
if (i == 0)
{
i++;
continue;
}
Aspose.Pdf.Document addPdf = new Aspose.Pdf.Document(file);
pdf.Pages.Add(addPdf.Pages);
}
pdf.Save(Path.Combine(Server.MapPath("Data/Test/"), "KMA Pärm.pdf"));
}
Moreover, please make sure that you are using valid license and double check that all necessary dll(s) are present in the bin folder of the web application. In case if you still face issue please share details with us i.e OS Version you are running application on, Target Framework of the Application.
I have a valid license, bought it a week ago. All dlls are present in bin folder. OS in my dev. environment is Windows 7 64 bit. Application is targeting .Net framework 3.5, and I have tested to use both Aspose.Pdf 2.0 and 3.5 with the same error.
Thanks for your patience and sharing details with us. I tested the scenario with your code snippet and input file(s) in an ASP.NET web application (Framework Version 3.5) and I managed to replicate the issue at my side. Therefore, I have logged this issue as PDFNET-42202 in our issue tracking system. We will further investigate the issue and keep you updated on status. Please have patience and spare us a little time. We are sorry for the inconvenience.
Hi,
Sorry if I nag, but do you have any information regarding the issue PDFNET-42202?
If not, I need to know so I can look for another solution that works.
I have tried to run the complete scenario with the latest version of Aspose.Pdf for .NET which is 17.2.0.0 and I did not face any issue in merging the documents. I have run the scenario in Web Application with target framework 3.5.
Please try merging the documents using latest version of our API which can be downloaded from here. In case if you still face any issue please feel free to contact us.
As shared earlier I have tried the same scenario which was previously causing error but with latest version of the API and I did not face any issue at all. Please share that are you using the same file(s) for merging process which have been shared within this thread? I have processed the same file(s) and generated the output.
Please check the attached file which I have generated at my end after merging. If you are using different files to merge then we will really appreciate if you share them so that we can try to test the scenario in our environment. We are sorry for this inconvenience.
Yes, I have tested with the files that I shared earlier in this thread.
Strange that I still have the same error when you successfully merged the files now after having the same error before. And as you can see in the error message I have version 17.2.0.0 now.
Could not load file or assembly ‘Aspose.Font, Version=17.2.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56’ or one of its dependencies. The system cannot find the file specified.
I will be working the weekend to see if I can find out why it throws the error, but I don’t know what I can try that I haven’t already tested. If you have anysuggestions onwhat Ican try,please do, because I wasrunning out ofideas andtime is running outfor me.
Thanks for your patience. I have again tested the whole scenario with ASP.NET Web Application (Framework 3.5) in both Visual Studio 2010 and 2015 and I am afraid that I still did not observe any issue. Moreover, we will really appreciate if you please share a sample project (web application) with us. It may help us reproducing the issue in our environment and share our findings with you accordingly.
Hi, It’s hardfor me to sharemore codethan Ialready didasthe web applicationis a major projectmanagement system with connectionsbetween severalother systems.
Asyoudoes not appear to be ableto solve my problem, Ihave to solve itin another way.Eitherby creating aWindows Serviceto make the merging orbuy anothersolution.
Seems like I should have evaluated it more before buying our Aspose.Total license.
Thanks for your patience. I have created a sample project for merging the documentation. Please check the attached web application (target framework 3.5). The attached application is running fine and merging documents without generating any issue at my side. Please try running the project in your environment and you may place your license file into Data folder of the project directory. In case if you still face any issue please feel free to let us know. We are sorry for the inconvenience.
I have tested the scenario on different operating systems i.e Windows 10 64-bit and Windows 7 64-bit and I am afraid that I was unable to notice any issue. It seems your environment specific issue. It would be kind of you if you please try to test the shared project on any other machine or in different environment and share details with us. It will really help us in understanding the problem and address it accordingly. We are sorry for the inconvenience.