PDF to TXT COM gives me an error stating that the module cannot be found

Hello.  I am evaluating the “Text2PDF COM” product and am using Window 7 operating system and developing with Visual Studio 2010.  I cannot get past the:

PDF2TXTSetLicenseCode("XXXXXXXXXXXXXXX")

line of code.  It give me an error stating that the module cannot be found.  I have the DLL located in the C:\Windows\System32 folder and have altered the below declarations to point to it but it still won’t work.

Is this supported on Windows 7?  Do you know what I’m missing?

Thanks!

' Pdf2Txt function declarations
Private Declare Function PDF2TXT Lib "C:\Windows\System32\pdf2txt.dll" (ByVal Source As String, ByVal Dest As String) As Long
Private Declare Function PDF2TXTEx Lib "C:\Windows\System32\pdf2txt.dll" (ByVal Source As String, ByVal Dest As String, ByVal firstpage As Long, ByVal lastpage As Long, ByVal ownerpassword As String, ByVal userpassword As String) As Long
Private Declare Function pdf2txtex2 Lib "C:\Windows\System32\pdf2txt.dll" Alias "PDF2TXTEx2" (ByVal Source As String, ByVal Dest As String, ByVal firstpage As Long, ByVal lastpage As Long, ByVal ownerpassword As String, ByVal userpassword As String, ByVal encodename As String, ByVal noPageBreaks As Long) As Long
' Pdf2Txt parameter declarations
Private Declare Function SetTXTFormat Lib "C:\Windows\System32\pdf2txt.dll" (ByVal Source As Long) As Long
Private Declare Function SetZoomRatio Lib "C:\Windows\System32\pdf2txt.dll" (ByVal Source As Long) As Long
Private Declare Sub SetGetDocumentSummary Lib "C:\Windows\System32\pdf2txt.dll" (ByVal Source As Boolean)
Private Declare Sub SetPageSeparator Lib "C:\Windows\System32\pdf2txt.dll" (ByVal Source As String)
Private Declare Sub SetDeleteBlankLine Lib "C:\Windows\System32\pdf2txt.dll" (ByVal Source As Boolean)
' Pdf2Txt license declaration
Private Declare Sub PDF2TXTSetLicenseCode Lib "C:\Windows\System32\pdf2txt.dll" (ByVal szRegCode As String)
=======================================

Are you using 64bit Windows 7 system? If yes, you should put following DLL files to C:\windows\syswow64 folder,

encryptpdf.dll
pdf2txt.dll
pdfsdk.dll

also, please make sure encryptpdf.dll, pdfsdk.dll and pdf2txt.dll files are exist in same folder, otherwise, you will not able to load pdf2txt.dll library properly.

VeryPDF
=======================================
Hello and thank you for your help.  This did get me through the PDF2TXTSetLicenseCode function, but now fails at “SetTXTFormat(1)” with the below error:

A call to PInvoke function 'ConsoleApplication8!ConsoleApplication1.Module1::SetTXTFormat' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
===========================
Are you compile the project with "AnyCPU" target platform? If yes, please change it to "x86" target platform, then you can call SetTXTFormat() function properly.

You can also replace all "long" data type to "integer" data type, this will solve this problem for you too.

VeryPDF
===========================
Thanks!  My target platform was "x86" but the declarations were still using longs.  I changed them to Integer and now it's working.  I'll continue my testing.

Thanks again.
===========================
Thank you for your information.

VeryPDF

VN:F [1.9.20_1166]
Rating: 1.0/10 (1 vote cast)
VN:F [1.9.20_1166]
Rating: -1 (from 1 vote)
PDF to TXT COM gives me an error stating that the module cannot be found, 1.0 out of 10 based on 1 rating

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!