× 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.



Don

Have you looked into Ghostscript? It has been available via the ACS Open Access tooling for 5 or 6 years now, I believe. Currently version 9.52 release 2.

I Googled for using Ghostscript to convert to text, there are several links. Some speak of problems with certain kinds of PDF content. Still, there seem to be possibilities.

*Regards*

*Vern Hamberg*

IBM Champion 2025 <cid:part1.0v0tBSQ5.lc00oJY1@centurylink.net> CAAC (COMMON Americas Advisory Council) IBM Influencer 2023

On 6/16/2025 2:12 AM, Don Brown via MIDRANGE-L 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

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.