Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Get content from PDF file.

XFRX version: 19.0

Code Block
pdfReader::GetContent(m.liPage, m.luDest, m.liFlag, m.lcFileName)

...

liPage
Number of page. If value is -1, then reader read content from all pages .

m.luDest
  Specifies output type. Can be  VFP memory variable, flat file or reference to XFRX#DRAW,  XFRX#XML and PDFL#INIT object.

TypeTextRectangleHorizontal and
vertical line
ImagesOther lines and curvesAppend mode for destination
VariableYesNoNoNoNoYes
Flat fileYesNoNoNoNoYes
XFRX#DRAWYesYesYesYesNoYes
XFRX#XMLYesYesYesYesNoNo
PDFL#INITYesYesYesYesYesYes

m.liFlag

BitValueDescription
01append mode for content
9512output is file
101024output is XFRX#DRAW,  XFRX#XML and PDFL#INIT object

m.lcFileName
 Output file name for XFRX#DRAW,  XFRX#XML, PDFL#INIT

Return value

Boolean.
.T. if content readed or .F. if not.

...

Code Block
m.loPDFR = EVALUATE([xfrx("PDF#READER")])
*m.loPDFR.SetPasswords("owner","user") && set password for pdf file
m.lcFile="BASE-UNI.pdf"
IF m.loPDFR.openDocument(m.lcFile) < 0 
   RETURN
ENDIF
m.lnError=m.loPDFR.ReadDocument()

LOCAL m.loXML, m.loSessionloPDFL
m.loPDFL=EVALUATE([xfrx("PDFL#INIT")])
m.loSession=EVALUATE([xfrx("XFRX#INIT")])

* create new PDF file
m.loPDFR.GetContent(1, m.loPDFL, 1024+0, lcfile+".pdf")
m.loPDFR.GetContent(2, m.loPDFL, 1024+1, lcfile+".pdf")
m.loXMLloPDFL.FinishDocument()

* Append to existing PDF file
m.loPDFL.CreateDocument(lcfile+".pdf", .T.)
m.loPDFL.SetOtherParams("DONOTZIPTEXTSTREAM",.T.)
m.loPDFR.GetContent(1, m.loPDFL, 1024+1)
m.loPDFR.GetContent(2, m.loPDFL, 1024+1)
m.loPDFL.FinishDocument()
 
m.loPDFR.closeDocument()

...