Есть замечательная программа docs2text (http://www.textlib.com). Точнее, это называется библиотекой.
Назначение- конвертация в текст вордовских и pdf файлов.
Проблема в том, что как я не пытался, не смог ее запустить.
Есть краткая дока:
Не очень понятно, наверное надо использовать ObjCreate.
Проблема в том, что в директории установки программы лежит dll.
Что делать с ней - ума не приложу.
Также там лежит код для vb6
Так, понятно. Пишем:
А вот и нет. Ничего не получается. Даже объект не создается.
И дальше я бы зашел в тупик.
Хорошо, берем код от ASP Demo (лежит там же,какой язык - вообще не знаю)
Класс.
Пишем
Откуда они взяли CDocComTxt? В хелпе ни слова. Ну ладно, объект создается. (или это ссылка на объект?)
Дальше облом.
Я пытался
Не получается. Голову сломал.
Назначение- конвертация в текст вордовских и pdf файлов.
Проблема в том, что как я не пытался, не смог ее запустить.
Есть краткая дока:
The functions below are methods of the DocCom class
GetText extracts all required information from the document given. Implemented as Unicode. Ansi version also available.
int GetText(
LPCTSTR lpbstrFileName,
OutPutStruc lpOutPutStruc
);
lpFileName - [in] Pointer to the BSTR string that specifies the name of a document to open; Format of the given document detected automatically and doesn't need to be specified anywhere.
lpOutPutStruc – [in, out] Pointer to OutPutStruc structure:
struct OutPutStruc {
BSTR pText;
BSTR pTitle;
BSTR pAuthor;
BSTR pPassword;
};
pText – Pointer to a document's text;
pTitle– Pointer to a title's text;
pAuthor- Pointer to an author's text;
pPassword- Pointer to a password string for a pdf password protected documents (see detailed information below), make sure this field is zeroed before usage;
GetText extracts all required information from the document given. Implemented as Unicode. Ansi version also available.
int GetText(
LPCTSTR lpbstrFileName,
OutPutStruc lpOutPutStruc
);
lpFileName - [in] Pointer to the BSTR string that specifies the name of a document to open; Format of the given document detected automatically and doesn't need to be specified anywhere.
lpOutPutStruc – [in, out] Pointer to OutPutStruc structure:
struct OutPutStruc {
BSTR pText;
BSTR pTitle;
BSTR pAuthor;
BSTR pPassword;
};
pText – Pointer to a document's text;
pTitle– Pointer to a title's text;
pAuthor- Pointer to an author's text;
pPassword- Pointer to a password string for a pdf password protected documents (see detailed information below), make sure this field is zeroed before usage;
Не очень понятно, наверное надо использовать ObjCreate.
Проблема в том, что в директории установки программы лежит dll.
Что делать с ней - ума не приложу.
Также там лежит код для vb6
Attribute VB_Name = "doctxt"
Public Enum docStatus
doc_OK = 0
doc_Corrupted = -1
doc_Unsupported = -2
doc_Encrypted = -3
doc_PdfPassword = -4
End Enum
Sub Main()
Dim doctxt As DocCom.DocCom
Dim pStructure As DocCom.OutPutStruc
Set doctxt = New DocCom.DocCom
Call doctxt.GetText("test.doc", pStructure)
MsgBox pStructure.pText, vbOKOnly
End Sub
Public Enum docStatus
doc_OK = 0
doc_Corrupted = -1
doc_Unsupported = -2
doc_Encrypted = -3
doc_PdfPassword = -4
End Enum
Sub Main()
Dim doctxt As DocCom.DocCom
Dim pStructure As DocCom.OutPutStruc
Set doctxt = New DocCom.DocCom
Call doctxt.GetText("test.doc", pStructure)
MsgBox pStructure.pText, vbOKOnly
End Sub
Так, понятно. Пишем:
Код:
$doctxt =ObjCreate("DocCom.DocCom")
$pStructure =ObjCreate("DocCom.OutPutStruc")
doctxt.GetText("test.doc", pStructure)
А вот и нет. Ничего не получается. Даже объект не создается.
И дальше я бы зашел в тупик.
Хорошо, берем код от ASP Demo (лежит там же,какой язык - вообще не знаю)
dim obj
Set obj = CreateObject("CDocComTxt")
Response.Write obj.GetASPText("c:\Inetpub\wwwroot\test1.doc")
Set obj = CreateObject("CDocComTxt")
Response.Write obj.GetASPText("c:\Inetpub\wwwroot\test1.doc")
Класс.
Пишем
Код:
$doctxt =ObjCreate("CDocComTxt")
Откуда они взяли CDocComTxt? В хелпе ни слова. Ну ладно, объект создается. (или это ссылка на объект?)
Дальше облом.
Я пытался
Код:
$doctxt = ObjCreate("CDocComTxt")
$text=$doctxt.GetASPText("c:\Inetpub\wwwroot\test1.doc")
Не получается. Голову сломал.