How to call PDF to Text Converter SDK/COM from both 32bit and 64bit applications? How to use PDF2TXTCOM.exe COM interface?

Greetings

My name is John. I work as a developer in a Danish company. I have been using your licensed version of pdf2txt for some time now, but now I have this small particular problem.

When trying to run my application in 32-bit mode on a 32-bit OS, I receive the following error:

"Retrieving the COM class factory for component with CLSID {-4022-457E-90EB-B0C619919C9E } failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

Do you have any suggestions for me?
Customer
--------------------------------------------------------

image
Thanks for your message, please download latest version of PDF2TXT SDK from following URL,

https://www.verypdf.com/app/pdf-to-txt-converter/index.html
https://www.verypdf.com/pdf2txt/sdk/pdf2txt_trial_version.zip

this version does include a PDF2TXTCOM.exe file, please by following steps to use this PDF2TXT COM from your both 32bit and 64bit applications,

1. Please use administrator privilege to run following command line to register PDF2TXTCOM.exe into your system first,

PDF2TXTCOM.exe /regserver

2. You can run following VBS (VB Script) to call PDF2TXTCOM.exe from your 64bit application,

=============================
Dim oTest
dim nRet

Set fso = CreateObject("Scripting.FileSystemObject")
strFolder = fso.GetParentFolderName(wscript.ScriptFullName)
destiantionPath = strFolder& "\verypdf.pdf"

Set oTest = CreateObject("PDF2TXTCOM.PDF2TXT")
oTest.com_SetTXTFormat 1
oTest.com_SetZoomRatio 90
oTest.com_PDF2TXTSetLicenseCode("XXXXXXXXXXXXXXXXXXXXXX")
nRet = oTest.com_Pdf2Txt(strFolder& "\sample1.pdf", strFolder& "\sample1-pdf2txt.txt")
nRet = oTest.com_Pdf2TxtEx(strFolder& "\sample1.pdf", strFolder& "\sample1-pdf2txtEx.txt",0,0,"","")
MsgBox "Convert Success!"
=============================

VeryPDF
--------------------------------------------------------
It did not work

I use Visual Studio 2012 and develop in c#.

What I am doing is the following:

I create a new project
I add the file "pdf2txt.dll" as a reference
I add the following line to the code: "PDF2TXT.CPDF2TXT pdf2txt = new PDF2TXT.CPDF2TXT();"

The error appears in the line above when I run my application in x64 platform target, but not when I run x86.

Customer
--------------------------------------------------------
Please add a reference to "PDF2TXTCOM.exe" instead of "pdf2txt.dll", then you can call "PDF2TXTCOM.PDF2TXT" from C# code to convert PDF file to text file.

btw, we have release a new version of PDF2TXT SDK today, please download it from following URL,

https://www.verypdf.com/pdf2txt/sdk/pdf2txt_trial_version.zip

after you download and unzip it to a folder, please go to "pdf2txt_COM_x64_C#" folder, you can compile and run this C# project, this C# project is work on both 32bit and 64bit systems.

1. Please use administrator privilege to run a CMD window, run following command line to register PDF2TXTCOM.exe into your system,

PDF2TXTCOM.exe /regserver

You can run following command line with administrator privilege to uninstall PDF2TXTCOM.exe from your system,

PDF2TXTCOM.exe /unregserver

PHP example source code to call "PDF2TXTCOM.PDF2TXT" COM Component,

<%
        strInFile = "D:\test.pdf"
        strOutFile = "D:\_out.txt"

      Set VeryPDFCom = Server.CreateObject("PDF2TXTCOM.PDF2TXT")
      VeryPDFCom.com_PDF2TXTSetLicenseCode("XXXXXXXXXXXXXXXXXXXXXX")
      nReturn = VeryPDFCom.com_Pdf2TxtEx(strInFile, strOutFile,0,0,"","")
      Response.write "Conversion finished."
%>

ASP example source code to call "PDF2TXTCOM.PDF2TXT" COM Component,

<%
        strInFile = "D:\test.pdf"
        strOutFile = "D:\_out.txt"

      Set VeryPDFCom = Server.CreateObject("PDF2TXTCOM.PDF2TXT")
      VeryPDFCom.com_PDF2TXTSetLicenseCode("XXXXXXXXXXXXXXXXXXXXXX")
      nReturn = VeryPDFCom.com_Pdf2TxtEx(strInFile, strOutFile,0,0,"","")
      Response.write "Conversion finished."
%>

C# example source code to call "PDF2TXTCOM.PDF2TXT" COM Component,

private void button1_Click(object sender, EventArgs e)
{
  string appPath = Path.GetDirectoryName(Application.ExecutablePath);
  string strPDFFile = appPath + "\\sample1.pdf";
  string strOutFile = appPath + "\\_sample1.txt";

  System.Type VeryPDFType = System.Type.GetTypeFromProgID("PDF2TXTCOM.PDF2TXT");
  PDF2TXTCOM.PDF2TXT VeryPDFCom = (PDF2TXTCOM.PDF2TXT)System.Activator.CreateInstance(VeryPDFType);
  VeryPDFCom.com_PDF2TXTSetLicenseCode("XXXXXXXXXXXXXXXXXXXXXX");
  int nReturn = VeryPDFCom.com_PDF2TXTEx(strPDFFile, strOutFile, 0, 0, "", "");
  MessageBox.Show("Converter finished.");
}

VB.NET example source code to call "PDF2TXTCOM.PDF2TXT" COM Component,

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  Dim strFolderDir As String = Application.StartupPath()
  Dim strInFile As String = strFolderDir & "\sample1.pdf"
  Dim strOutFile As String = strFolderDir & "\_sample1.txt"

  Dim VeryPDFCom As Object = CreateObject("PDF2TXTCOM.PDF2TXT")
  VeryPDFCom.com_PDF2TXTSetLicenseCode("XXXXXXXXXXXXXXXXXXXXXX")
  Dim strReturn As Integer = VeryPDFCom.com_Pdf2TxtEx(strInFile, strOutFile, 0, 0, "", "")
  MsgBox("Conversion finished.")
End Sub

VB Script example source code to call "PDF2TXTCOM.PDF2TXT" COM Component,

Dim oTest
dim nRet

Set fso = CreateObject("Scripting.FileSystemObject")
strFolder = fso.GetParentFolderName(wscript.ScriptFullName)
destiantionPath = strFolder & "\verypdf.pdf"

Set oTest = CreateObject("PDF2TXTCOM.PDF2TXT")
oTest.com_SetTXTFormat 1
oTest.com_SetZoomRatio 90
oTest.com_PDF2TXTSetLicenseCode("XXXXXXXXXXXXXXXXXXXXXX")
nRet = oTest.com_Pdf2Txt(strFolder & "\sample1.pdf", strFolder & "\sample1-pdf2txt.txt")
nRet = oTest.com_Pdf2TxtEx(strFolder & "\sample1.pdf", strFolder & "\sample1-pdf2txtEx.txt",0,0,"","")
MsgBox "Convert Success!"

VeryPDF

VN:F [1.9.20_1166]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
How to call PDF to Text Converter SDK/COM from both 32bit and 64bit applications? How to use PDF2TXTCOM.exe COM interface?, 10.0 out of 10 based on 1 rating

Related Posts

One Reply to “How to call PDF to Text Converter SDK/COM from both 32bit and 64bit applications? How to use PDF2TXTCOM.exe COM interface?”

  1. Please give full control permission to Everyone to “PDF2TXTCOM.PDF2TXT” DCOM, so that you will able to call “PDF2TXTCOM.PDF2TXT” from classic ASP code, please look at following web page to study how to give full control permission to “PDF2TXTCOM.PDF2TXT” DCOM,

    http://www.verydoc.com/blog/verydoc-release-notes-verydoc-releases-an-exe-com-of-verypdfcomruncmd-exe-today-verypdf-exe-com-does-allow-you-to-call-ms-office-and-any-exe-application-from-asp-php-c-net-etc-program-languag.html

    VN:F [1.9.20_1166]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.20_1166]
    Rating: 0 (from 0 votes)

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!