I'm receiving a "Exception has been thrown by the target of an invocation" error when attempting to merge two pdf documents using aspose.pdf.document.save.
Dim firstDoc As New Aspose.Pdf.Document(strFirstFileLocationAndName)
Dim secondDoc As New Aspose.Pdf.Document(strSecondFileLocationAndName)
firstDoc.Pages.Add(secondDoc.Pages)
firstDoc.Save(strFirstFileLocationAndName)
Stack Trace:
at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct&
signature, RuntimeType declaringType) at System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct signature,
RuntimeType declaringType) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture) at System.Security.Cryptography.CryptoConfig.CreateFromName(String name, Object[] args) at ..( ) at ..( , ) at ..() at ..(Stream ) at ..(Stream ) at Aspose.Pdf.Document.Save(Stream output) at Aspose.Pdf.Document.Save(String outputFileName) at LIBRARYNAME.DocumentCreation.MergePDFFiles(String strFirstFileLocationAndName, String strSecondFileLocationAndName) in
I have tested the scenario while using Aspose.Pdf for .NET 7.1.0 in VisualStudio 2005 project running over Windows XP-SP3, where I have specified .NET Framework 2.0 as Target platform and as per my observations, the PDF files are properly being concatenated. Can you please try using the latest release version and in case you still face the same problem or you have any further query, please feel free to contact. We are sorry for this inconvenience.
For your reference, I have also attached the resultant PDF that I have generated. Please take a look.
I updated my application to use Aspose.Pdf for .NET 7.1.0. However, it throws the exact same error. It's also now making the first pdf file unreadable after the attempted save.
A little more info:
I'm using Visual Studio 2010 SP1 to build a web application targeting .NET 4.0.
It works perfectly when deployed to our server running Windows Server 2003.
It throws the above error when deployed to either of our servers running Windows Server 2008 (One is running Standard while the other is running R2 Enterprise).
I have again tested the scenario where I have used VisualStudio 2011 to create a sample website targeting .NET Framework 4.0, Aspose.Pdf for .NET 7.1.0 and I have used Windows Server 2008 R2 Enterprise and I am unable to notice any issue/error while concatenating the PDF files. I have tested the scenario in both evaluation and licensed mode. Can you please prepare a sample project which can be used to replicate this issue. We are sorry for this inconvenience.
I've pulled the code out into a separate visual studio 2012 web site project which I've attached to this reply. The site runs perfect on my local machine and when published to our DEV server running Windows Server 2003. However, it fails when published to either of our PROD machines running Windows Server 2008. The error is the same as before:
Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType) at System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct signature, RuntimeType declaringType) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Security.Cryptography.CryptoConfig.CreateFromName(String name, Object[] args) at ..( ) at ..( , ) at ..() at ..(Stream ) at ..(Stream ) at Aspose.Pdf.Document.Save(Stream output) at Aspose.Pdf.Document.Save(String outputFileName) at _Default.Button1_Click(Object sender, EventArgs e)
Hi,<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>
Well, there is a similar issue reported by one of our other user regarding FIPS setting which we
are investigating at the moment. Our development team is unable to reproduce
the issue with the latest version of Aspose.Pdf for .NET. However, I am setting
up the environment of Windows Server 2008 R2 to check the issue regarding FIPS.
I will update you soon regarding my findings.<o:p></o:p>
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Sorry for the delay in response.
I am able to generate the issue regarding FIPS after
setting up the test environment. The issue is registered in our issue tracking
system with issue id:PDFNEWNET-33438. You
will be notified via this forum thread regarding any update against your
reported issue.
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Sorry
for a delay in response.
Our development
team is further investigating this issue. However, this is a complex issue and
it is taking some time to get a fix for it. Issue is basically caused due to
the use of MD5 to get hash of data in document saving algorithm which is causing
the problem. We will notify you via this forum thread
regarding any updates against the issue.
Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank
you for being patient.
I
am pleased to inform you that we have implemented our
own MD5 algorithm to replace MD5CryptoServiceProvider which we were using
previously and which was causing the problem. The new implementation will be
available in our upcoming release of Aspose.Pdf for .NET v7.3 (to be released
in early September 2012). At the moment we are in process of testing of the new
release. You will be notified as soon as the new release is available for
download.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.