# Visual parsing debugger for PDF in elm

**URL:** <https://discourse.elm-lang.org/t/visual-parsing-debugger-for-pdf-in-elm/9702>\
**Category:** Show and Tell\
**Created:** [March 9, 2024, 4:29pm UTC](https://discourse.elm-lang.org/t/visual-parsing-debugger-for-pdf-in-elm/9702 "2024-03-09T16:29:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Atlewee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/atlewee/32/4603_2.png) [@Atlewee](https://discourse.elm-lang.org/u/Atlewee)\
**Post date:** [March 9, 2024, 4:29pm UTC](https://discourse.elm-lang.org/t/visual-parsing-debugger-for-pdf-in-elm/9702/1 "2024-03-09T16:29:22Z")

</div>

I need to extract partial data from PDF’s and pdf.js library is to high level and bloated for my case.  
While creating my PDF parser i stumbled upon a lot wird stuff and debugging took forever.  
So I built myself a visual debugger that shows the state, incoming bytes and resulting drawing  
It is more or less the same as elm debugger… where msg and model is replaced with bytes and state.  
The actual handleByte function is used in parser and debugger, so changes is hot reloaded and the result is “instantly” visible when changing parser logic thanks to the amazing elm-watch.  
Making debugging wierd stuff straight forward 🙂

So this is a tip for other people having a state-machine-style parser. I can now see the problem instantly instead of starting to add logging and stuff and start figuring out where stuff went wrong.

I just made a video explaining how PDF works under the hood using the debugger:

[![](https://img.youtube.com/vi/u4fAlvE6y3U/maxresdefault.jpg "How PDF files work / Graphical parser debugger") ](https://www.youtube.com/watch?v=u4fAlvE6y3U)

---

<div class="post-metadata">

**Author:** ![axelbdt](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/axelbdt/32/4404_2.png) [@axelbdt](https://discourse.elm-lang.org/u/axelbdt)\
**Post date:** [March 11, 2024, 12:48am UTC](https://discourse.elm-lang.org/t/visual-parsing-debugger-for-pdf-in-elm/9702/2 "2024-03-11T00:48:29Z")

</div>

Pretty awesome, I must say.

---

<div class="post-metadata">

**Author:** ![setop](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/setop/32/4331_2.png) [@setop](https://discourse.elm-lang.org/u/setop)\
**Post date:** [March 13, 2024, 8:55am UTC](https://discourse.elm-lang.org/t/visual-parsing-debugger-for-pdf-in-elm/9702/3 "2024-03-13T08:55:09Z")

</div>

That’s awsome.

Writing a pdf parser is on my todo.

I’ve never thought writing is in Elm. I was thinking about Elixir since it has binary pattern matching and there is already [some litterature](https://bag.zoocoop.com/share/65f1615f366947.41404294).

But I would love to do it Elm, especially to enable building a webapp on top of it.

Do you have any code to share ?

Cheers

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [March 23, 2024, 8:55am UTC](https://discourse.elm-lang.org/t/visual-parsing-debugger-for-pdf-in-elm/9702/4 "2024-03-23T08:55:58Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
