× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello Dan,

I''l suggest you to use the Apache PDFbox command line utility - Yes it it
java but it is just one command line so you don't have to compile or code
anaything...

I use this all the time ( also from SQL stored procedures btw):

https://pdfbox.apache.org/download.html

this is how I do it form a SQL procedure:

set okay = bash ('java -jar /prj/tools/pdfbox/pdfbox-app-3.0.0-alpha3.jar
export:text -i=' || path_name || ' -o=' || tmpfile );





On Mon, Jun 16, 2025 at 9:12 AM Don Brown via MIDRANGE-L <
midrange-l@xxxxxxxxxxxxxxxxxx> wrote:

I have a requirement to convert a PDF to txt format.

I tried to install a php solution using composer to install pdfparser.

While everything seems to be installed numerous attempts to run a test
have so far failed.

So, two questions.


1. Does anyone have a recommended solution to achieve converting a pdf
to text. I am after a php or native rpg ish solution. Not python please.

2. I have included the details of my faile attempt below just incase
someone has done this and can spot my error.
I am using Siedens Community Edition PHP.

This was the install

-bash-5.2$ composer require smalot/pdfparser
./composer.json has been updated
Running composer update smalot/pdfparser
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Locking smalot/pdfparser (v2.12.0)
- Locking symfony/polyfill-mbstring (v1.32.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
0 [>---------------------------] 0 [->--------------------------]
- Installing symfony/polyfill-mbstring (v1.32.0): Extracting archive
- Installing smalot/pdfparser (v2.12.0): Extracting archive
0/2 [>---------------------------] 0%
1/2 [==============>-------------] 50%
2/2 [============================] 100%
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Found 5 security vulnerability advisories affecting 1 package.
Run "composer audit" for a full list of advisories.
Using version ^2.12 for smalot/pdfparser
-bash-5.2$ ls
Hello-01.pdf composer.phar helloWorld.php installComposer.php
composer-setup.php don-01.pdf html2pdf-01.php testcmd.pdf
composer.json don02.pdf imagetest01.pdf vendor
composer.lock don03.pdf imagetest02.pdf
-bash-5.2$ more autoload.php

Which seems to not have any errors.

This Is my script for testing

<?php
require
"/www/itmas01/includes/composer/vendor/smalot/pdfparser/alt_autoload.php";

// use \QOpenSys\pkgs\bin\vendor\Smalot\PdfParser\Parser;

$parser = new
/www.itmas01/includes/composer/vendor/smalot/pdfparser/src/Smalot/PdfParser/Parser();
// $parser = new \QOpenSys\pkgs\bin\vendor\Smalot\PdfParser\Parser();
$pdf = $parser->parseFile('\home\MSDDCB\MSD_INV_000018814.PDF');
$text = $pdf->getText();

// echo $text;
print $text;

?>

And this is what happens when I try and run it

/QOpenSys/pkgs/bin/php -d display_errors=1
/www/itmas01/htdocs/common/pdf2text.php

Parse error: syntax error, unexpected '/' in
/www/itmas01/htdocs/common/pdf2text.php on line 6
$

Thanks
Don




Brisbane - Sydney - Melbourne


Don Brown

Senior Consultant




P: 1300 088 400




DISCLAIMER. Before opening any attachments, check them for viruses and
defects. This email and its attachments may contain confidential
information. If you are not the intended recipient, please do not read,
distribute or copy this email or its attachments but notify sender and
delete it. Any views expressed in this email are those of the individual
sender
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.