Hi iNug rebells, ;-)

It’s time for some content/questions/tipps/voodoo/ etc.

Background:
I have to deal with lots of invoices from multiple vendors coming in every day.
Most of those invoices have only one invoice line on that A4 paper.

Fortunately the invoices arrive also as PDF-attachments to emails from the 
vendors.

The task is to eliminate the need for the administration staff to physically 
touch the paper invoices delivered with the goods.

So far so good.

There are two options to convert pdf to text, the PlugIn from Pluggers and the 
open source alternative “xpdf tools / xpdfReader” from 
https://www.xpdfreader.com/download.html 
<https://www.xpdfreader.com/download.html>.

xpdf-tools/XpdfReader was suggested by Wolfgang Kunkel (if you come across that 
4D-Partner, please thank him) that there could be problems running it in 
4d-Server on macOS.

After some testing I decided to go with the OpenSource-alternative to be called 
by LEP.

I placed the xpdf-tools in the Resouces-folder of the 
4D-database-Packadge-Hirachy as followed:

Resources
        xpdftools
                Linux // you never know what positive feature could come... :o)
                        bin32
                        bin64
                Mac
                        bin64
                                pdfdetach
                                pdffonts
                                pdfimages
                                pdfinfo
                                pdftohtml
                                pdftopng
                                pdftoppm
                                pdftops
                                pdftotext
                Windows
                        bin32
                        bin64
                man_pages // documentation Unix-style 

What can I say - it works like a charm as long as one compensates for non 
disclosed 4D-conditions…

1. On macOS all path to documents/folders have to be converted to POSIX-Format!

2. All paths in the LEP calls on macOS AND Windows should be encapsulated by 
CHAR(Double Quote)/Char(34) to give the underlaying OS a chance to interpret it 
the right way.

3. During my tests I was reminded to declare variables under ALL circumstances, 
especially when running 4D on Windows.


Code Sample:

Case of         
                : (Is macOS)

                        $pathToCommand:=Convert path system to 
POSIX($pathToCommand)
                        $PathToSourceFile:=Document+Char(34)
                        $PathToSourceFile:=Convert path system to 
POSIX($PathToSourceFile)
                        
$PathToSourceFile:=Char(34)+$PathToSourceFile+Char(34)+"-"  // compensate for 
spaces in the file/path name.

                : (Is Windows)

                        $PathToSourceFile:=Char(Double 
quote)+Document+Char(Double quote)+" -"

                          //: (Is Linux)

                Else 
                          // Fuck up
        End case 

        $CallLEP:=$pathToCommand+$PathToSourceFile

        LAUNCH EXTERNAL 
PROCESS($CallLEP;$InputStream;$stdout;$ErrorStream;$ExPID)


Oha, the most important thing is to get the converted pdf-file into “$stdout”… 
well read the man-page and forget the “ ‘ “ at the right point.

The XpdfRead.dbase will be dropped in a DropBox upon request - to be used at 
your own risk! :o)))))


And tomorrow I try to convince you to share some wisdom in regards to “How to 
mess around in/with/etc. text”



Cheers
Jörg, Good night and good luck! - Thursday already…




**********************************************************************
4D Internet Users Group (4D iNUG)
New Forum: https://discuss.4D.com
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to