Live data from Hacker News

Zpdf: PDF text extraction in Zig

github.com

31–40 of 88 posts

Re: Zpdf: PDF text extraction in Zig

#31

- First commit 3hours ago. - commit message: LLM-generated. - README: LLM-generated. I'm not convinced that projects vibe coded over the evening deserve the HN front page… Edit: and of course the author's blog is also full of AI slop… 2026 hasn't even started I already hate it.

...and it does not work. I tried it on ~10 random pdfs, including very simple ones (e.g. a hello world from typst), it segfaults on every single one.

Tried few and works. Maybe you've older or newer Zig version than whatever project targets. (Mine is 0.15.2.)

Re: Zpdf: PDF text extraction in Zig

#32

74910,74912c187768,187779 > myconv; > [Example 1: If you want to use the code conversion facet codecvt_utf8 to output to cout a UTF-8 multibyte sequence > corresponding to a wide string, but you don’t want to alter the locale for cout, you can write something like: > > § D.27.2 > 1954 > > © ISO/IEC > N4950 > > wstring_convert > myconv; > std::string mbstring = myconv.to_bytes(L"Hello\n"); Is indeed faster but output…

In my experience with parsing PDFs, speed has never been an issue, it has always been a matter of quality.

Re: Zpdf: PDF text extraction in Zig

#33
post #30

74910,74912c187768,187779 > myconv; > [Example 1: If you want to use the code conversion facet codecvt_utf8 to output to cout a UTF-8 multibyte sequence > corresponding to a wide string, but you don’t want to alter the locale for cout, you can write something like: > > § D.27.2 > 1954 > > © ISO/IEC > N4950 > > wstring_convert > myconv; > std::string mbstring = myconv.to_bytes(L"Hello\n"); Is indeed faster but output…

fixed.

Lol, but there's 100 competitors in the PDF text extraction space, some are multi million dollar industries: AWS textract, ABBY PDFreader, PDFBox, I think you may be underestimating the challenge here.

Re: Zpdf: PDF text extraction in Zig

#34
post #19
post #10

Earlier quoted context omitted.

added a comparison, will improve further. https://github.com/Lulzx/zpdf?tab=readme-ov-file#comparison-... also, added python bindings.

thanks, claude, I guess haha as others have commented, I think while this is a nice portfolio piece, I would worry about its longevity as a vibe coded project

If he made something legitimately useful, who cares how?

Re: Zpdf: PDF text extraction in Zig

#35
post #30

74910,74912c187768,187779 > myconv; > [Example 1: If you want to use the code conversion facet codecvt_utf8 to output to cout a UTF-8 multibyte sequence > corresponding to a wide string, but you don’t want to alter the locale for cout, you can write something like: > > § D.27.2 > 1954 > > © ISO/IEC > N4950 > > wstring_convert > myconv; > std::string mbstring = myconv.to_bytes(L"Hello\n"); Is indeed faster but output…

fixed.

Yeah, sorry for confusion. When said Unicode, meant foreign text rather (just) the unescaped symbols, e.g. Greek. At one random Greek textbook[0], zpdf output is (extract | head -15):

  01F9020101FC020401F9020301FB02070205020800030209020701FF01F90203020901F9012D020A0201020101FF01FB01FE0208 
  0200012E0219021802160218013202120222 0209021D0212021D012E013202200222000301FA021A0220021C022002160213012E0222000F000301F90206012C

  020301FF02000205020101FC020901F90003020001F9020701F9020E020802000205020A 
  01FC028C0213021B022002230221021800030200012E021902180216021201320221021A012E00030209021D0212021D012E013202200222000301FA021A0220021C022002160213012E0222000F000301F90206012C 
 
  0200020D02030208020901F90203020901FF0203020502080003012B020001F9012B020001F901FA0205020A01FD01FE0208 
  020201300132012E012F021A012F0210021B013202200221012E0222 0209021D0212021D012E013202200222000301FA021A0220021C022002160213012E0222000F000301F90206012C 
This for entire book. Mutool extracts the text just fine.

[0]: https://repository.kallipos.gr/handle/11419/15087

Re: Zpdf: PDF text extraction in Zig

#36

Earlier quoted context omitted.

...and it does not work. I tried it on ~10 random pdfs, including very simple ones (e.g. a hello world from typst), it segfaults on every single one.

Tried few and works. Maybe you've older or newer Zig version than whatever project targets. (Mine is 0.15.2.)

   ~/c/t/s/zpdf (main)> zig version
   0.15.2
Sky is blue, water is wet, slop does not work.

Re: Zpdf: PDF text extraction in Zig

#37
post #32

74910,74912c187768,187779 > myconv; > [Example 1: If you want to use the code conversion facet codecvt_utf8 to output to cout a UTF-8 multibyte sequence > corresponding to a wide string, but you don’t want to alter the locale for cout, you can write something like: > > § D.27.2 > 1954 > > © ISO/IEC > N4950 > > wstring_convert > myconv; > std::string mbstring = myconv.to_bytes(L"Hello\n"); Is indeed faster but output…

In my experience with parsing PDFs, speed has never been an issue, it has always been a matter of quality.

I tried a small PDF and got a memory error. It's definitely much faster than MuPDF on that file.

Re: Zpdf: PDF text extraction in Zig

#38

- First commit 3hours ago. - commit message: LLM-generated. - README: LLM-generated. I'm not convinced that projects vibe coded over the evening deserve the HN front page… Edit: and of course the author's blog is also full of AI slop… 2026 hasn't even started I already hate it.

Using Ai isn't lazier than your regurgitated dismissal, to be fair.

Re: Zpdf: PDF text extraction in Zig

#39
post #12
post #2

I built a PDF text extraction library in Zig that's significantly faster than MuPDF for text extraction workloads. ~41K pages/sec peak throughput. Key choices: memory-mapped I/O, SIMD string search, parallel page extraction, streaming output. Handles CID fonts, incremental updates, all common compression filters. ~5,000 lines, no dependencies, compiles in Why it's fast: - Memory-mapped file I/O (no read syscalls) - Z…

What's fast about mmap?

it allows the program to reference memory without having to manage it in the heap space. it would make the program faster in a memory managed language, otherwise it would reduce the memory footprint consumed by the program.

Re: Zpdf: PDF text extraction in Zig

#40
post #12

Earlier quoted context omitted.

What's fast about mmap?

it allows the program to reference memory without having to manage it in the heap space. it would make the program faster in a memory managed language, otherwise it would reduce the memory footprint consumed by the program.

You mean it converts an expression like `buf[i]` into a baroque sequence of CPU exception paths, potentially involving a trap back into the kernel.
Post reply on HN