Hola
No se si se pueda leer ciertos datos del texto de un PDF para guardarlos en una base de datos
Saluditos
**============================================================================**
** Author....: José Maria da Silva **
** Purpose : Read a PDF, extract text and display on browse, save as TXT. **
** Pre-Requirement: Must have OpenOffice/Broffice installed on the PC **
**=============================================================================**
#INCLUDE "FIVEWIN.CH"
#include "xbrowse.ch"
//------------------------//
FUNCTION MAIN()
LOCAL oService,oDesktop,oDoc,oShape,oCursor,oDrawPage,aProp:={},i
LOCAL cFile,cText,aVetStr:={}
cFile := cGetFile("Files (pdf,odg)|*.odg;*.pdf|",;
"Select file (pdf/odg)", 4 )
IF EMPTY(cFILE) ; RETURN .F. ; ENDIF
cFile := "file:///"+StrTran(cFile,"\","/")
oService := TOleAuto():New("com.sun.star.ServiceManager")
oDesktop := oService:createInstance("com.sun.star.frame.Desktop")
AAdd(aProp,MakePropertyValue(oService,"Hidden",.T.)) //oculta
oDoc := oDesktop:loadComponentFromURL(cFile, "_blank", 0, aProp)
oDrawPage := oDoc:getDrawPages():getByIndex(0)
MsgInfo(oDrawPage:getCount())
//You may add oMeter
FOR i:=0 TO oDrawPage:getCount()-1
oShape := oDrawPage:getByIndex(i)
oCursor := oShape:createTextCursor()
cText := oCursor:getText():getString()
AADD(aVetStr,cText)
NEXT
oDoc:Close(.T.)
xbrowse(aVetStr)
RETURN NIL
//--------------------------------------------------------//
STATIC FUNCTION MakePropertyValue(oService,cName,nValue)
LOCAL oStruct := oService:Bridge_GetStruct("com.sun.star.beans.PropertyValue")
oStruct:Name := cName
oStruct:Value := nValue
RETURN(oStruct)
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot], Horizon and 90 guests