Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Nov 26, 2012 4:01 pm

Hi

I have implemented a function which itinerates through a datatable, and converts word-documents referenced in the datatable to pdf documents. The total number of conversions will be around 3000.

During the conversion process however the usage of the internal memory of the server rocks sky high, which indicates that there is some sort of memory leak in my code.

This is my code:
"
Public Function Convert2PDF(ByVal oldname As String)
'Create word document
Dim NewDoc As New Document()
[ I create the instance ]

'load a document
NewDoc.LoadFromFile("c:\websites\data\searchengine\jenrick1\" & oldname)
[ I load a word document into the instance ]

Dim newname = ""
Dim test = generics.logevent("convert", 1, "oldname " & "c:\websites\data\searchengine\jenrick1\" & oldname)
[ I print a test string into a log file ]

Dim arrName = oldname.Split(".")
Dim iCnt = 0
test = generics.logevent("convert", 1, "arr len " & arrName.Length)
For iCnt = 0 To arrName.Length - 2
newname = newname & arrName(iCnt) & "."
Next
newname = newname & "pdf"
[ I determine the new name based upon the old name ]

test = generics.logevent("convert", 1, "newname " & "c:\websites\data\searchengine\jenrick1\" & newname)
[ I print the new name as a string into a logfile ]

'Save doc file.
Try
NewDoc.SaveToFile("c:\websites\data\searchengine\jenrick1\" & newname, FileFormat.PDF)
Catch e As Exception
test = generics.logevent("convert", 1, "newname " & "c:\websites\data\searchengine\jenrick1\" & newname & " not saved ")
End Try
[ I save the file as a pdf file ]

NewDoc.Close()
[ I close the instance ]

Return 1
End Function
"

If I monitor my logging and the server performance, it looks like it crashes while trying to convert a docx document.

What is going wrong?
I am using the latest Spire.Doc version.

KR

Henk Jelt Hoving

henkjelt
 
Posts: 3
Joined: Wed Nov 21, 2012 1:57 pm

Tue Nov 27, 2012 7:31 am

Hello Henk Jelt,

Thanks for your inquiry.
Could you please provide us some word-documents? So that we can quickly reproduce your problem, and work out a solution for you. Thank you!

Best regards,
Amy
E-iceblue support
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Mon Dec 03, 2012 7:18 am

Hello Henk Jelt,

Did you still have the problem? We don't receive your sample word-documents at present. Could you please provide us some word-documents? In this case, we can quickly reproduce your problem, and work out a solution for you soon. Thank you!

Best regards,
Amy
E-iceblue support
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc