Convert PDF into TXT format

carlos.valentin

New Member
Good morning everyone forum.
I need a help.
I have to develop a routine in progress, for converting a PDF file to a file in TXT format.
For later import into the system.
How do I Convert this? There is a FREE application that I can run on my progress application?
How do I do that? What parameters do I use?

thanks
 
You would need the Adobe Acrobat to do that. You can then use com-handles and Acrobat API to work with PDF documents. The API library and reference can be found in the link:
http://help.adobe.com/livedocs/pdfl...e/PD_Layer/PDDoc.html#PDDocCreateTextSelect()

This is how I do it.
Code:
DEFINE VARIABLE hAcrobat      AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hAVDoc        AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hPDDoc        AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hText         AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hTextNm       AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hAVDoc1       AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hJSObj        AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE Objs          AS COM-HANDLE  NO-UNDO.
DEFINE VARIABLE Obj           AS COM-HANDLE     NO-UNDO.

DEFINE VARIABLE v_Count    AS INTEGER     NO-UNDO.
DEFINE VARIABLE v_TxtCount AS INTEGER     NO-UNDO.
DEFINE VARIABLE v_Compare  AS CHARACTER   NO-UNDO.
DEFINE VARIABLE v_Temp  AS CHARACTER EXTENT 10  NO-UNDO.
CREATE "AcroExch.PDDoc"      hPDDoc.
CREATE "AcroExch.PDDoc"      hText.
CREATE "AcroExch.AVDOC"      hAVDoc.
CREATE "AcroExch.App"        hAcrobat.
CREATE "AcroExch.HiliteList" hText.


hAVDoc:OPEN("YOUR-PDF-FILE.pdf", "").

hPDDoc = hAVDoc:GetPDDoc.
hJSObj = hPDDoc:GetJSObject.
OUTPUT TO h:\PDF-Read-2.txt.


REPEAT v_Count = 0 TO hPDDoc:GetNumPages - 1:
    ASSIGN hTextNm  = hPDDoc:AcquirePage(v_Count).

    hText:Add(0, 9000).
    hAVDoc1 =  hTextNm:CreatePageHilite(hText).

    MESSAGE "--------------" v_Count "------------------" hAVDoc1:GetNumText .
  
    ASSIGN v_Compare = "".
  
    REPEAT v_TxtCount = 0 TO hAVDoc1:GetNumText - 1 :
       
        ASSIGN v_Compare = v_Compare + "|" + hAVDoc1:GetText(v_TxtCount).
    END.

    MESSAGE v_Compare.
END.
OUTPUT CLOSE.
/* release all objects here */
 
Last edited by a moderator:

arronlee

New Member
Good morning everyone forum.
I need a help.
I have to develop a routine in progress, for
converting a PDF file to a file in TXT format.
For later import into the system.
How do I Convert this? There is a FREE application that I can run on my progress application?
How do I do that? What parameters do I use?

thanks

Hi, carlos.valentin.
I wonder compared with 3rd party toolkits, whether code processing is much more convenient?
 
Top