We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Releasing conection to PDF.kit.dll

Hello. I have VB project that has multiple forms for data entry. Each form corresponds with PDF - fields from each VB form are mapped into different PDF file. I noticed that when user has the project open, fills out form and previews PDF - it opens up the connection to Aspose.Pdf.Kit.dll. What is the correct way to release the connection to this dll? Should I release it on each form or only once on exit from the project? I do have the line

Imports Aspose.Pdf.Kit - for each form and then later have a code to map the fields.

Please let me know if that's correct way to do it. Also noticed that if I need to copy newer version of my project's exe file into production - sometimes it'll allow me to rename existing exe and copy new one in, but it user has pdf.kit.dll connection opened - it won't allow me to copy new exe at all. Please advise!

Hi Alla,

The Aspose.Pdf.Kit classes provide Close or Save methods where necessary. These methods should be enough to remove any connections to the Aspose.Pdf.Kit. Please make sure that you’re using these methods properly. Moreover, you also need to close any streams if you’re using FileStream or MemoryStream objects to read or write files.

However, if it doesn’t resolve your issue then please share a sample project which can help us reproduce the issue at our end. As far as the matter to rename an existing EXE is concerned, I believe if the application is running you wouldn’t be able to do this; this issue doesn’t seem to be caused by the Aspose.Pdf.Kit, rather it is the required behavior of the executable. Nevertheless, if you think I haven’t understood this problem correctly then please elaborate it a little bit.

We’re sorry for the inconvenience and looking forward to help you out.

Thank you for your reply, Shahzad. Please let me know where can I find the examples of Close and Save methods? I use form.close command to close the form. When you said to use Close and Save methods - did you mean to close form or close connection to dll?

I attached the code behind one of the forms. Please let me know where should I put the code to close dll.

Hi Alla,

In case of Form class, the Save method call is enough to close the Form object. A I mentioned earlier, there is no specific Close/Save method to close connection of Aspose.Pdf.Kit for .NET DLL. What I meant was to just close or save (as appropriate) the particular object you’re working with; for example, in case of Form object, you called the Save method, which is enough to close the connection.

I’m afraid, in order to understand the issue, we’ll need some more help from your end. Can you please share a sample project which can depict the problem at our end? This will help us diagnose the problem and then resolve it.

We’re sorry for the inconvenience and appreciate your cooperation.

Sorry - I'm confused. In the first response you said "The Aspose.Pdf.Kit classes provide Close or Save methods where necessary". Now you are saying "A I mentioned earlier, there is no specific Close/Save method to close connection of Aspose.Pdf.Kit for .NET DLL." So which one is the correct statement?

In the prior response I attached the sample of the code for one of the forms. Were you able to review it? Please let me know if that's correct way to use your DLL. This project is still in developing stage but will be released in production in the next week or so. Will it be a problem for 20-30 users opening the project and use simultaneous connection to Aspose.PDF.Kit.dll? Since we just started using your DLL and not sure how it will behave in multi-user environment - it's very important for me to know that I have setup connection to your DLL correctly. Please review my example and let me know. I appreciate your help.

Hi Alla,

I’m very sorry for causing the confusion.

I would like to clarify that individual classes of Aspose.Pdf.Kit provide either Close or Save methods to close the current object. For example, Form class provides Save method, PdfConverter class provides Close method, and PdfViewer class provides ClosePdfFile method. These methods are used to close the related objects i.e. Form.Save method will close the current Form object. So, when you are done with a particular object just call these methods (Save, Close or ClosePdfFile etc.); this should be enough to avoid any issues.

Yes, I had reviewed the attached code and it is fine. For example, once you worked with Form object you called the Form.Save method, it not only saved any input data but also closed the Form object. The way you have used the code is perfectly fine.

Moreover, there shouldn’t be any problem while using Aspose.Pdf.Kit in multi-user environment. Nevertheless, you might consider running your application in multi-user environment for testing purposes, and if you think some issue is caused by Aspose.Pdf.Kit then please do let us know.

I hope this helps. Please contact us in case you have any further questions or concerns.

Thank you for clarifying it! Yes - we'll test the project in the 4 buildings first and later move it to 41. I'll let you know if we run into problems. I do have another question about previewing the pdf part:

PDFCreateError = 0

If (File.Exists(OutputFileName)) Then

pInfo.FileName = OutputFileName

Dim p As Process = Process.Start(pInfo)


MessageBox.Show("There is no such file." & System.Environment.NewLine & "Make sure that PDF was created for this Resident and all fields were filled for merging.", "Message", MessageBoxButtons.OK)

PDFCreateError = 1

End If

Do I need to close (release) pInfo or Process? If yes - how? Do I set it to Nothing (pInfo=Nothing)? I appreciate your help.

Hi Alla,

Can you please share which object pInfo is representing? Moreover, I don’t think you need to release the Process object, however you might need to view the details on this [link].

If you have any further questions, please do let us know.

Sorry about that. It’s

Public pInfo As ProcessStartInfo = New ProcessStartInfo

I believe I took this sample of the code from your website - therefore didn't enclose whole code... Thank you for the link. I didn't see anywhere that they actually close the process. I guess it's OK to leave code as is?

Also - I asked before - do I need to have the line

Imports Aspose.Pdf.Kit

for each form? Currently I do have it for each form, but set the license for the first form only and seems to be working. Just wanted to make sure that it's correct way to do it. Thank you for your help!

Hi Alla,

You need to use ‘Imports Aspose.Pdf.Kit’ statement in each form, however setting license is required only once. You can also set the license only once in MyApplication_Startup event in ApplicationEvents.vb class in a VB.NET Windows application.

I hope this helps. If you have any further questions, please do let us know.