Pelles C forum

C language => Beginner questions => Topic started by: jos on January 01, 2026, 04:22:38 PM

Title: Read PDF text with PDFio
Post by: jos on January 01, 2026, 04:22:38 PM
New year new opportunities!

Found PDF-lib in https://www.msweet.org/pdfio/ (https://www.msweet.org/pdfio/)

Want to be able to read text from a PDF. Have tried lots of settings and options without success. It says it should work with C99? But what is POSIX-compliant?

Can someone give me a push in the right direction to move forward on how and try to get it working.

Thanks in advance
Title: Re: Read PDF text with PDFio
Post by: TimoVJL on January 01, 2026, 06:44:26 PM
compile project as __cdecl

in pdfio.h and ? add guard && !__POCC__ to headers
#  if _WIN32 && !__POCC__
typedef __int64 ssize_t;        // POSIX type not present on Windows @private@
#  endif // _WIN32

to ttf.c add guard
#ifndef __POCC__
typedef __int64 ssize_t;        // POSIX type not present on Windows... @private@
#endif

pdfio-content.c at line 405 add cast (const double (*)[3])
  // Now that we have the white point and matrix, use those to make the color array...
  return (pdfioArrayCreateColorFromMatrix(pdf, num_colors, gamma, (const double (*)[3])matrix, white_point));
in project define
_mkgmtime=timegm
a test project for dll isn't verified
Title: Re: Read PDF text with PDFio
Post by: jos on January 03, 2026, 03:50:45 PM
Many thanks for your help,
Unfortunately I haven't gotten it to work despite your suggestions and your file? However, I feel that I have come a little further. Think I've localized a problem in my zlib.h?
Don't know if it's my version or how I placed it but I'll continue.

I keep going and it's a lot of trial and error.

In summary, it feels like pragmas for different settings are something you need to learn.
What is POSIX and when is it used?
Title: Re: Read PDF text with PDFio
Post by: MrBcx on January 03, 2026, 05:58:39 PM
Quote from: jos on January 03, 2026, 03:50:45 PMWhat is POSIX and when is it used?



https://en.wikipedia.org/wiki/POSIX


AI Overview

Pelles C is primarily a Windows-focused C compiler and development kit that offers some limited or partial support for POSIX-style functions, but it is not fully POSIX-compliant.

Key points regarding POSIX and Pelles C:

    Windows Focus: Pelles C is designed for native Windows API programming. Windows APIs are not part of the POSIX standard, which defines a standard operating system interface for Unix-like systems.

    Partial POSIX Support: Pelles C has added support for some "Posix-style functions" over the years, such as the three-argument version of a function like open(). However, this support is incomplete.

    Missing Features: Users on Pelles C forums often note that key POSIX headers or functions are missing or commented out, such as unistd.h's sleep() function or important members of the
    struct dirent used for directory operations.

    make Utility: The Pelles C pomake.exe utility is noted as being "even less POSIX-complete" than the Microsoft nmake.exe, which itself is not fully POSIX-compliant.


Title: Re: Read PDF text with PDFio
Post by: TimoVJL on January 03, 2026, 08:12:46 PM
As you have a compilable project, you can try to compile it and check compiler options.
Just inform us of problems with it.
It have strange include file problems, like zlib.h, not sure, if it can be a bug.
Title: Re: Read PDF text with PDFio
Post by: jos on January 04, 2026, 01:36:28 PM
Thank you gentlemen for all your help.

I have downloaded the latest zlib 1.3.1 and am getting a bit further.
Now I only get this error:
Building pdfiodll.dll. but POLINK cannot find 'zlib.lib'?

I have to wait a bit as I don't really know what I'm doing. "Just trial and error"
Title: Re: Read PDF text with PDFio
Post by: TimoVJL on January 04, 2026, 02:14:17 PM
You might find it from zlib project:
https://forum.pellesc.de/index.php?msg=41804 (https://forum.pellesc.de/index.php?msg=41804)

I haven't tested it yet.
Title: Re: Read PDF text with PDFio
Post by: John Z on January 04, 2026, 04:45:21 PM
Quote from: jos on January 04, 2026, 01:36:28 PMNow I only get this error:
Building pdfiodll.dll. but POLINK cannot find 'zlib.lib'?


If you have not copied the lib into the Pelles C Lib directory then it might not find it unless you add the path to the folders under Project - Options - General - Folders (select Libraries) then add the path to the zlib.lib.

John Z
Title: Re: Read PDF text with PDFio
Post by: TimoVJL on January 05, 2026, 09:46:05 AM
Project with only source and zlib-libs in cdecl format.

zlib project is at:
https://forum.pellesc.de/index.php?msg=41804 (https://forum.pellesc.de/index.php?msg=41804)


https://www.msweet.org/pdfio/pdfio.html (https://www.msweet.org/pdfio/pdfio.html)
Title: Re: Read PDF text with PDFio
Post by: jos on January 05, 2026, 01:04:59 PM
Thank you very much.

Master, now it works! I'll try to go through it and compare what I missed or what I did wrong.