I have a C# .Net windows service, and a Aspose.Total.lic file that I’ve successfully used in other types of .net projects, but for some reason I have a problem when I call the PdfFileEditor’s .Extract Method after I apply the license.
I apply the license the same way as I have in all my other .Net projects. I add the .lic file to the solution, and set it’s build action to Embedded Resource. I’m then setting the licenses as follows:
Aspose.Words.License awlic = new Aspose.Words.License();
Aspose.Pdf.License aplic = new Aspose.Pdf.License();
Aspose.Pdf.Kit.License apklic = new Aspose.Pdf.Kit.License();
awlic.SetLicense(“Aspose.Total.lic”);
aplic.SetLicense(“Aspose.Total.lic”);
apklic.SetLicense(“Aspose.Total.lic”);
I even wrapped this in a try catch and it never throws an error. So I would assume it applies the license correctly, but the OutputStream that supposed to come back out of the PDFFileEditor.Extract method comes back empty after I apply the license, when I do an OutputStream.GetBuffer() it returns byte[0], but when it’s working I’ll get byte[4194304] as an example. But the bool value of that .Extract call still returns true, as if it dropped what it’s suppose to into OutputStream.
If I remove the license… no problems at all… other than having the unwanted evaluation copy at the top of my PDFs.
The only caveat that I can see between this project and others, is that I’m applying the license to multiple products, where others only use one of your products at a time. And the other is that this is within a Windows Service, and my other projects were WinForms or Console Apps.
Of course this is happening to me on a rollout night, when I expected applying of the license file to be the least of my worries.
Any help would be greatly appreciated.
just bumping this, since i posted well after close of business. maybe someone can help me if they see this post.
Hi Brick,
Can you please make sure that the same code and the PDF file are working fine in a normal application, other than Windows Service? Also, please share a small sample application along with the problematic input PDF file with us, so we could test the scenario at our end. You’ll be updated with the results accordingly. You can attach the sample application with this post; however, please do not attach the license with the post rather follow the instructions on this page to send license file.
We’re sorry for the inconvenience and looking forward to help you out.
Regards,
Attached you will find a sample self containing project that does exactly the same thing as I described in the Windows Service. So it's not an issue of it being a windows service vs. a windows console app. Ultimately they're the same thing... an exe.
I've taken the license file out of the project, and will be sending to you via the requested method.
Once I comment out the licensing, it works fine. Please note that the directory it's reading PDFs from and writing to is a folder named "PDF" in the bin/debug directory. You will need to add Network Service in permissions on this folder, in order for the writes to occur.
Hi Brick,
I have tested this issue using the latest version but I couldn’t notice any such problem either by using the license or without it. Could you please download the latest version and try with that? Moreover, your license will not work with the latest version, however you can get a temporary license from this link for testing purposes. If your issue is resolved, you might upgrade your license later.
I hope this helps. If you have any further questions, please do let us know.
Regards,
Is there any particular reason you decided to use the latest version? Did you run the app as I sent it at all, or did you immediately change references to the latest version? I don't see why I would have to upgrade product(s) and my license in order to get a product that was already purchased to work.
Can you not test my app using the versions of the .dll's that were with it? I assure you it is having the same problem I describe.
Aspose.Pdf.Kit version that I'm working with is 3.4 and Aspose.Pdf version 4.0
the same thing happens for me, even after applying the latest assembly, and applying the temp license.
Hi Brick,
I have tested this issue with the version 3.4.0 as well and successfully created the output file with or without using the license. I have done that using your sample project. The output memory stream always contain the data; however, while writing the PDF file to disk I had to change the following two lines of code:
fileStream.Write(outstream1.GetBuffer(), 0, int.Parse(outstream1.Position.ToString()));
fileStream.Close();
with the following ones:
fileStream.Close();
And the output file generated successfully. Could you please try to change the above two lines and see if it works for you? If it still doesn't resolve the issue then please try to create a new project and copy the code to that new application and try with that. If you still find problem then please do let us know.
We're sorry for the inconvenience and looking forward to help you out.
Regards,
well... sure enough that worked! I still don't see how applying the license would affect the original two lines of code that I had, because it worked fine without the license file. At this point i could care less... since it works!
thank you again for all of your help!.