working with open source xPDF library

Published on by Yousfi Benameur


Googling, i discover this day a usefull tool named xPDF.
Xpdf is the original open source PDF viewer, first released in 1995.
The Xpdf software and documentation are copyright 1996-2014 Glyph & Cog, LLC.

 Xpdf is an open source viewer for Portable Document Format (PDF) files. (These are also sometimes  also called 'Acrobat' files, from the name of Adobe's PDF software.) The Xpdf project also
includes a PDF text extractor, PDF-to-PostScript converter, and various other utilities.

Xpdf runs under the X Window System on UNIX, VMS, and OS/2. The non-X components (pdftops,pdftotext, etc.) also run on Win32 systems and should run on pretty much any system.

Xpdf is licensed under the GNU General Public License (GPL), version 2.this include restrictions and conditions to redistribute xpdf (read licence).
Download the zip package (10.2 Moctets) and unzip in the source folder (same as yxpdf.prg).can cut the subfolder bin64.keep the folders
bin32 and doc.(+licences..) as in image below.the last version released in may 2014.
xPDF home:  http://www.foolabs.com/xpdf/home.html
xPDF download :http://www.foolabs.com/xpdf/download.html
      or ftp://ftp.foolabs.com/pub/xpdf/
this code runs some interesting librarires
  -pdftoImages : extracts  images from a PDF file
  -pdftoText: convert a pdf as txt file
  -pdftoHtml: convert each pdf page as html with a global index
  -pdftoPNG reads the PDF file and writes one PNG file for each page
  -pdftoPPM converts a PDF file to a series of PPM/PGM/PBM-format bitmaps
  -pdftoPS reads the PDF file and writes a PostScript file, PS file.this can be sent to printer.
  
can apply same method to another converters in the zip
outputs are directed to folder output.clean it before running the code...
can complete the command lines as provided in the help txt files in code in function or user conditions.this is a demo only.
warning:if the pdfs are locked with password must enter the valid password in the command line to make the code working.  

this library makes a part of adobe acrobat professional works.
Run the code: there is a main menu to work with library and see help in second menu as original xPDF txt files.

*added in code *2* image2PDF converter.


Note: xPDf have many Language Support Packages can be downloaded from the links above.


Click on code to select [then copy] -click outside to deselect


*save this code as ymenu.mpr in the folder source of yxpdf.prg

DEFINE POPUP raccourci SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR 1 OF raccourci PROMPT "PdfImages"
DEFINE BAR 2 OF raccourci PROMPT "PdftoText"
DEFINE BAR 3 OF raccourci PROMPT "PdftoHTML"
DEFINE BAR 4 OF raccourci PROMPT "PdfToPNG"
DEFINE BAR 5 OF raccourci PROMPT "PdfToPPM"
DEFINE BAR 6 OF raccourci PROMPT "PdftoPS"
ON SELECTION BAR 1 OF raccourci ;
    DO _4kd1crkbt ;
	IN LOCFILE("YXPDF\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 2 OF raccourci ;
	DO _4kd1crkbw ;
	IN LOCFILE("YXPDF\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 3 OF raccourci ;
	DO _4kd1crkby ;
	IN LOCFILE("YXPDF\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 4 OF raccourci ;
	DO _4kd1crkc3 ;
	IN LOCFILE("YXPDF\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 5 OF raccourci ;
	DO _4kd1crkc7 ;
	IN LOCFILE("YXPDF\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")
ON SELECTION BAR 6 OF raccourci ;
	DO _4kd1crkca ;
	IN LOCFILE("YXPDF\YMENU" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU?")

ACTIVATE POPUP raccourci

*
PROCEDURE _4kd1crkbt
 * pdftoImages [options] pdfimages [options] PDF-file image-root
 set safe off
local ytemp
 m.ylib=addbs(m.yrep+"xpdfbin-win-3.04\bin32")
 m.ytemp=addbs(sys(2023))+"ybat.bat"

 local lcfile
 m.lcfile=getfile('pdf')
 if empty(m.lcfile) or ! lower(justext(m.lcfile))=="pdf"
 return .f.
 endi
 local m.yimg
 m.yimg=m.yrep+"output"
 if !directory(m.yrep+"output")
 md  (m.yimg)
 endi
 m.yimg=addbs(m.yimg)

 local m.myvar
 text to m.myvar textmerge noshow
 rem this is the command line to execute in bat file
 rem help:read the pdfimages.txt in doc folder : <<m.yrep>>xpdfbin-win-3.04\doc

<<m.ylib>>pdfImages.exe -j   "<<m.lcfile>>" "<<m.yimg+"img">>"
 endtext
 strtofile(m.myvar,m.ytemp)

result = ShellExecute(0, "open",m.ytemp,"","",0)   &&hidden
if m.result<=32
messagebox("An error was occured",16+4096,'',1200)
endi

sleep(2000)
copy file (m.ytemp)  to (m.yimg+"ycode.txt")

run/n explorer &yimg

set defa to (yrep)
 retu


PROCEDURE _4kd1crkbw
 * pdftoText
local m.ytemp,m.ylib
 m.ylib=addbs(m.yrep+"xpdfbin-win-3.04\bin32")  && to actualise
 m.ytemp=addbs(sys(2023))+"ybat.bat"

 local lcfile
 m.lcfile=getfile('pdf')
 if empty(m.lcfile) or ! lower(justext(m.lcfile))=="pdf"
 return .f.
 endi
 local m.yimg
 m.yimg=m.yrep+"output"
 if !directory(m.yrep+"output")
 md  (m.yimg)
 endi
 m.yimg=addbs(m.yimg)

 local m.myvar
 text to m.myvar textmerge noshow
<<m.ylib>>pdftoText.exe  -layout   "<<m.lcfile>>" "<<m.yimg+juststem(m.lcfile)+'.txt'>>"
 endtext
 strtofile(m.myvar,m.ytemp)

result = ShellExecute(0, "open",m.ytemp,"","",0)   &&hidden
if m.result<=32
messagebox("An error was occured",16+4096,'',1200)
endi

sleep(2000)
copy file (m.ytemp)  to (m.yimg+"ycode.txt")
run/n explorer &yimg
set defa to (yrep)
 retu


PROCEDURE _4kd1crkby
 * pdftoHtml
local ytemp,m.ylib
 m.ylib=m.yrep+"xpdfbin-win-3.04\bin32\"
 m.ytemp=addbs(sys(2023))+"ybat.bat"

 local lcfile
 m.lcfile=getfile('pdf')
 if empty(m.lcfile) or ! lower(justext(m.lcfile))=="pdf"
 return .f.
 endi
 local m.yimg
 m.yimg=m.yrep+"output"+sys(2015)   &&witout \
 messagebox(m.yimg,0+32+4096,'',1200')

 local m.myvar
 text to m.myvar textmerge noshow
<<m.ylib>>pdftohtml.exe -r 150   "<<m.lcfile>>"  "<<m.yimg>>"
 endtext
 strtofile(m.myvar,m.ytemp)

result = ShellExecute(0, "open",m.ytemp,"","",0)   &&hidden
sleep(3000)

if m.result<=32
messagebox("An error was occured",16+4096,'',1200)
else
copy file (m.ytemp)  to (addbs(m.yimg)+"ycode.txt")
run/n explorer &yimg
endi
set defa to (yrep)
 retu

PROCEDURE _4kd1crkc3
 * pdftopng [options] PDF-file PNG-root
local ytemp,m.ylib
 m.ylib=addbs(m.yrep+"xpdfbin-win-3.04\bin32\")
 m.ytemp=addbs(sys(2023))+"ybat.bat"

 local lcfile
 m.lcfile=getfile('pdf')
 if empty(m.lcfile) or ! lower(justext(m.lcfile))=="pdf"
 return .f.
 endi
 local m.yimg
 m.yimg=m.yrep+"output"
 if !directory(m.yrep+"output")
 md  (m.yimg)
 endi
 m.yimg=addbs(m.yimg)

 local m.myvar
 text to m.myvar textmerge noshow
<<m.ylib>>pdftopng.exe  -r 150   "<<m.lcfile>>" "<<m.yimg+juststem(m.lcfile)+'.png'>>"
 endtext
 strtofile(m.myvar,m.ytemp)

result = ShellExecute(0, "open",m.ytemp,"","",0)   &&hidden
if m.result<=32
messagebox("An error was occured",16+4096,'',1200)
else
copy file (m.ytemp)  to (m.yimg+"ycode.txt")
run/n explorer &yimg
endi
set defa to (yrep)
 retu

 
PROCEDURE _4kd1crkc7
 * pdftoPPM  [options] PDF-file PPM-root
local ytemp,m.ylib
 m.ylib=addbs(m.yrep+"xpdfbin-win-3.04\bin32\")
 m.ytemp=addbs(sys(2023))+"ybat.bat"

 local lcfile
 m.lcfile=getfile('pdf')
 if empty(m.lcfile) or ! lower(justext(m.lcfile))=="pdf"
 return .f.
 endi
 local m.yimg
 m.yimg=m.yrep+"output"
 if !directory(m.yrep+"output")
 md  (m.yimg)
 endi
 m.yimg=addbs(m.yimg)

 local m.myvar
 text to m.myvar textmerge noshow
<<m.ylib>>pdftoppm.exe  -r 150   "<<m.lcfile>>" "<<m.yimg+juststem(m.lcfile)>>"
 endtext
 strtofile(m.myvar,m.ytemp)

result = ShellExecute(0, "open",m.ytemp,"","",0)   &&hidden
if m.result<=32
messagebox("An error was occured",16+4096,'',1200)
else
copy file (m.ytemp)  to (m.yimg+"ycode.txt")
run/n explorer &yimg
endi

set defa to (yrep)
 retu


PROCEDURE _4kd1crkca
 * pdftoPS
local m.ytemp,m.ylib
 m.ylib=m.yrep+"xpdfbin-win-3.04\bin32\"  && to actualise
 m.ytemp=addbs(sys(2023))+"ybat.bat"

 local lcfile
 m.lcfile=getfile('pdf')
 if empty(m.lcfile) or ! lower(justext(m.lcfile))=="pdf"
 return .f.
 endi
 local m.yimg
 m.yimg=m.yrep+"output"
 if !directory(m.yrep+"output")
 md  (m.yimg)
 endi
 m.yimg=addbs(m.yimg)
 local m.myvar
 text to m.myvar textmerge noshow
<<m.ylib>>pdftoPS.exe     "<<m.lcfile>>"  "<<m.yimg+juststem(m.lcfile)+".ps">>"

 endtext
 strtofile(m.myvar,m.ytemp)

result = ShellExecute(0, "open",m.ytemp,"","",0)   &&hidden
if m.result<=32
messagebox("An error was occured",16+4096,'',1200)
else
copy file (m.ytemp)  to (m.yimg+"ycode.txt")
run/n explorer &yimg
endi

set defa to (yrep)
 retu



Click on code to select [then copy] -click outside to deselect


*1*
*save this code as yxPDF.prg (main file)
set safe off
publi m.yrep
m.yrep=addbs(justpath(sys(16,1)))
set defa to (yrep)
*test the xpdf downloaded folder if set
if !directory ("xpdfbin-win-3.04")
messagebox([Folder "xpdfbin-win-3.04" must be in source mandatory ....cancelling!],16+4096,"error")
endi


text to m.myvar noshow
DEFINE POPUP raccourci SHORTCUT RELATIVE FROM MROW(),MCOL()
DEFINE BAR 1 OF raccourci PROMPT "pdfImages"
DEFINE BAR 2 OF raccourci PROMPT "pdftoText"
DEFINE BAR 3 OF raccourci PROMPT "pdfToPNG"
DEFINE BAR 4 OF raccourci PROMPT "pdftoHTML"
DEFINE BAR 5 OF raccourci PROMPT "pdftoPPM"
DEFINE BAR 6 OF raccourci PROMPT "pdftoPS"
ON SELECTION BAR 1 OF raccourci ;
DO _4kd1cou4d ;
IN LOCFILE("YXPDF\YMENU1" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU1?")
ON SELECTION BAR 2 OF raccourci ;
DO _4kd1cou4g ;
IN LOCFILE("YXPDF\YMENU1" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU1?")
ON SELECTION BAR 3 OF raccourci ;
DO _4kd1cou4l ;
IN LOCFILE("YXPDF\YMENU1" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU1?")
ON SELECTION BAR 4 OF raccourci ;
DO _4kd1cou4s ;
IN LOCFILE("YXPDF\YMENU1" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU1?")
ON SELECTION BAR 5 OF raccourci ;
DO _4kd1cou4v ;
IN LOCFILE("YXPDF\YMENU1" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU1?")
ON SELECTION BAR 6 OF raccourci ;
DO _4kd1cou4x ;
IN LOCFILE("YXPDF\YMENU1" ,"MPX;MPR|FXP;PRG" ,"WHERE is YMENU1?")

ACTIVATE POPUP raccourci
*
PROCEDURE _4kd1cou4d
local m.x,m.ytemp
m.ytemp=addbs(sys(2023))+"ytemp.txt"
strtofile(filetostr(m.yrep+"xpdfbin-win-3.04\doc\pdfimages.txt"),m.ytemp)
run/n notepad  &ytemp

*
PROCEDURE _4kd1cou4g
local m.x,m.ytemp
m.ytemp=addbs(sys(2023))+"ytemp.txt"
strtofile(filetostr(m.yrep+"xpdfbin-win-3.04\doc\pdftoText.txt"),m.ytemp)
run/n notepad  &ytemp

*
PROCEDURE _4kd1cou4l
local m.x,m.ytemp
m.ytemp=addbs(sys(2023))+"ytemp.txt"
strtofile(filetostr(m.yrep+"xpdfbin-win-3.04\doc\pdftoPNG.txt"),m.ytemp)
run/n notepad  &ytemp

*
PROCEDURE _4kd1cou4s
local m.x,m.ytemp
m.ytemp=addbs(sys(2023))+"ytemp.txt"
strtofile(filetostr(m.yrep+"xpdfbin-win-3.04\doc\pdftohtml.txt"),m.ytemp)
run/n notepad  &ytemp

*
PROCEDURE _4kd1cou4v
local m.x,m.ytemp
m.ytemp=addbs(sys(2023))+"ytemp.txt"
strtofile(filetostr(m.yrep+"xpdfbin-win-3.04\doc\pdftoPPM.txt"),m.ytemp)
run/n notepad  &ytemp
*
PROCEDURE _4kd1cou4x
local m.x,m.ytemp
m.ytemp=addbs(sys(2023))+"ytemp.txt"
strtofile(filetostr(m.yrep+"xpdfbin-win-3.04\doc\pdftoPS.txt"),m.ytemp)
run/n notepad  &ytemp

endtext
strtofile(m.myvar,m.yrep+"ymenu1.mpr")

publi yform
yform=newObject("yxpdf")
yform.show
read events
retu
*
DEFINE CLASS yxPDF AS form
BorderStyle = 0
Top = 4
Left = 48
Height = 85
Width = 266
ShowWindow = 2
Caption = "XPDF"
MaxButton = .F.
AlwaysOnTop = .T.
BackColor = RGB(212,208,200)
Name = "Form1"

ADD OBJECT command1 AS commandbutton WITH ;
Top = 14, ;
Left = 7, ;
Height = 61, ;
Width = 216, ;
FontBold = .T., ;
FontSize = 14, ;
Caption = "XPDF menu", ;
MousePointer = 15, ;
SpecialEffect = 2, ;
ForeColor = RGB(255,128,0), ;
BackColor = RGB(128,255,0), ;
Name = "Command1"

ADD OBJECT label1 AS label WITH ;
AutoSize = .T., ;
FontSize = 28, ;
BackStyle = 0, ;
Caption = "?", ;
Height = 45, ;
Left = 228, ;
Top = 20, ;
Width = 23, ;
ForeColor = RGB(255,128,64), ;
BackColor = RGB(128,255,0), ;
Name = "Label1"

add object yop as optiongroup with ;
AutoSize = .T.,;
ButtonCount = 1,;
BackStyle = 0,;
Value = 1,;
Height = 27,;
Left = 229,;
MousePointer = 15,;
Top = -5,;
Width = 28,;
Name = "yop",;
Option1.BackStyle = 0,;
Option1.Caption = "",;
Option1.Value = 1,;
Option1.Height = 17,;
Option1.Left = 5,;
Option1.MousePointer = 15,;
Option1.Top = 5,;
Option1.Width = 18,;
Option1.AutoSize = .T.,;
Option1.Name = "Option1"    

PROCEDURE  yop.Click
	DECLARE INTEGER MessageBox IN user32 As MessageBoxA;
		INTEGER hwnd,;
		STRING  lpText,;
		STRING  lpCaption,;
		INTEGER wType
	#define MB_ICONINFORMATION 0x00000040
	#define MB_OK 0x00000000
	#define MB_APPLMODAL 0x00000000
	#define  MB_DEFBUTTON1 0x00000000

	local m.myvar
	text to m.myvar noshow
Googling, i discover this day a usefull tool named xPDF.
Xpdf is the original open source PDF viewer, first released in 1995.
The Xpdf software and documentation are copyright 1996-2014 Glyph & Cog, LLC.

Xpdf is an open source viewer for Portable Document Format (PDF) files. (These are also sometimes  also called 'Acrobat' files, from the name of Adobe's PDF software.) The Xpdf project also
includes a PDF text extractor, PDF-to-PostScript converter, and various other utilities.

Xpdf runs under the X Window System on UNIX, VMS, and OS/2. The non-X components (pdftops,pdftotext, etc.) also run on Win32 systems and should run on pretty much any system.
Xpdf is licensed under the GNU General Public License (GPL), version 2.this include restrictions and conditions to redistribute xpdf (read licence).
Download the zip package (10.2 Moctets) and unzip in the source folder (same as yxpdf.prg).can cut the subfolder bin64.keep the folders
bin32 and doc.(+licences..) as in image below.the last version released in may 2014.
xPDF home:  http://www.foolabs.com/xpdf/home.html
xPDF download :http://www.foolabs.com/xpdf/download.html   or ftp://ftp.foolabs.com/pub/xpdf/
this code runs some interesting librarires
  -pdftoImages : extracts  images from a PDF file
  -pdftoText: convert a pdf as txt file
  -pdftoHtml: convert each pdf page as html with a global index
  -pdftoPNG reads the PDF file and writes one PNG file for each page
  -pdftoPPM converts a PDF file to a series of PPM/PGM/PBM-format bitmaps
  -pdftoPS reads the PDF file and writes a PostScript file, PS file.this can be sent to printer.
	
can apply same method to another converters in the zip
can complete the command lines as provided in the help txt files in code in function or user conditions.this is a demo only.
warning:if the pdfs are locked with password must enter the valid password in the command line to make the code working.

this library makes a part of adobe acrobat professional works.
Run the code: there is a main menu to work with library and see help in second menu as original xPDF txt files.

Note: xPDf have many Language Support Packages can be downloaded from the links above.

Important :this code is tested under windows10 & VFP9SP2.
	endtext

	MessageBoxA(thisform.hwnd,m.myvar,"Summary Help",MB_APPLMODAL+MB_OK +MB_ICONINFORMATION +MB_DEFBUTTON1 )

ENDPROC
PROCEDURE Load
 &&shellexecute
DECLARE INTEGER ShellExecute IN SHELL32.DLL INTEGER nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
DECLARE INTEGER Sleep IN KERNEL32 INTEGER
ENDPROC

PROCEDURE Destroy
clea events
ENDPROC

PROCEDURE command1.Click
do ymenu.mpr
ENDPROC

PROCEDURE command1.RightClick
do ymenu.mpr
ENDPROC

PROCEDURE label1.Click
do ymenu1.mpr
ENDPROC

ENDDEFINE
*
*-- EndDefine: yxPDF




working with open source xPDF library
working with open source xPDF library
working with open source xPDF library

Click on code to select [then copy] -click outside to deselect

                  
*2*
*this code converts an entier  jpg folder to a single pdf with images2pdf.exe utility
*first download this free utility images2pdfc.exe  from  http://originaldll.com/download/18933.exe
*can also google there is many sites for that.scan for virus the exe.
*and copy it to source folder with this prg.
*can build a small project &  compile an executable, it works perfectly.
Note:*this can be also done with libHaru library

Clea All
Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow
Declare Integer Sleep In kernel32 Integer

Set Defa To (Addbs(Justpath(Sys(16))))

Local m.mess
TEXT to m.mess noshow
This uses images2pdf utility to convert jpg images to a standalone pdf.
Yousfi Benameur   30/04/2014
ENDTEXT
Messagebox(m.mess,0+32+4096,"",2000)

If  !File ("images2pdfc.exe")
Messagebox("images2pdfc.exe must exists in source folder....canceling",16+4096,"error",1500)
Return .F.
Endi

Local m.yrep
m.yrep=Getdir("c:\","JPG Images folder" ,"Convert images to pdf" ,16384)

If Empty(m.yrep)
Return .F.
Endi

Local m.lcdest
m.lcdest=Justpath(m.yrep)+"\yImages2pdf_"+Sys(2015)+".pdf"
Local m.myvar
TEXT to m.myvar textmerge noshow
"Images2pdfc" /i    "<<m.yrep>>*.jpg" /e     "<<m.lcdest>>"
ENDTEXT
Set Safe Off
Local m.ybat
m.ybat=Addbs(Sys(2023))+"ybat.bat"
Strtofile(m.myvar,m.ybat)

Local m.result
m.result = ShellExecute(0, "open",m.ybat,"","",0)
If m.result<=32
Messagebox("An error was occured",16+4096,'',1200)
Endi

Sleep(3000)
try
Run/N explorer &lcdest
catch
endtry

Retu


Click on code to select [then copy] -click outside to deselect

                 

*3* Working with PDFTK to join many pdf files
*download pdftk from the web (for free)-see the link below.
*copy 2 files to the folder pdftk:pdftk.exe and libiconv2.dll
*for help : pdftk --help>c:\pdftk_help.txt

*merge many pdfs in one pdf with pdftk
*pdftk dont support spaces in filenames! this code copy the desired pdf to merge in a temp folder and rename them with no space
*and then merge (i tried pdf filenames with comas but does not work also !)
*can build a project and produce a standalone exe (works with pdtftk.exe+libiconv2.dll in same source folder)
*added on 14 april 2016


If !_vfp.StartMode=0
    On Shutdown Quit
Endi

Local m.yrep
m.yrep=Addbs(Justpath(Sys(16,1)))
Set Defa To (yrep)
If !File("pdftk.exe") or !File ("libiconv2.dll")
	Messagebox("pdftk.exe and libiconv2.dll must be mandatory in "+m.yrep+" !",16+4096,"error")
	Return .F.
Endi
Set Safe Off
If !Directory(m.yrep+"temp")
	Md (m.yrep+"temp")
Else
	Dele File (m.yrep+"temp\*.*")
Endi
If File(m.yrep+"ypdftk_joined.pdf")
	Erase (m.yrep+"ypdftk_joined.pdf")
Endi

Local aa,afile
afile="ypdftk_joined.pdf"

aa=m.yrep+"pdftk "
Do While .T.
	x=Getfile('pdf')
	If Empty(x)
		Exit
	Else
		m.y=m.yrep+"temp\"+Strtran(Justfname(m.x)," ","_")
		Copy File (m.x) To (m.y)
		m.aa=m.aa+" "+m.y
	Endi
Enddo
m.aa=m.aa+"  cat output "+m.afile
*messagebox(m.aa)  &&test
*_cliptext=m.aa    &&test
Local oshell
oshell=Newobject("wscript.Shell")
ReturnCode=oshell.Run(m.aa,0,.T.)

If File (m.afile)
	Declare Integer ShellExecute In SHELL32.Dll Integer nWinHandle,;
		STRING cOperation,;
		STRING cFileName,;
		STRING cParameters,;
		STRING cDirectory,;
		INTEGER nShowWindow

	result = ShellExecute(0, "open", m.afile,"","",1)  &&result must be >32 otherwise error (no file association,...)

Else
	Messagebox("pdftk failed",16)
Endi
If !_vfp.StartMode=0
	Quit
Else
	Return
Endi


working with open source xPDF library

Important:All Codes above are tested on VFP9SP2 & windows 10 pro

To be informed of the latest articles, subscribe:
Comment on this post