How To Make a Pdf Editor In golang

What are the topics one should read and should understand if one wants to make word processor in go?
that can edit pdfs or other kind of docs

The same as for every language as well:

You should know the PDF spec, and understand that even though you as a human might see text, the PDF doesn’t necessarily contain the text in any encoding. It might just be lines or pixels.

PDF is not a text format, it is not meant to be edited, it is meant to carry a print preview from one computer to the other. All those other niceties we have today have been added on top, and this is something you realize when reading the spec or just an explanation of the format.

On top of that it helps if you have an understanding of the language that you want to use to implement your text processor/editor.

3 Likes

HI @Anhilator_Senator,

In my opinion, PDF is a particularly unsuited document format for starting a word processor project. PDF is not designed for interactive editing. First and foremost, it is a page layout description language, meant for displaying and printing a finalized document.

If I want to start an editor project, I would start with a plain-text editor and work towards more structured content formats from there.

If processing PDF is a must, I’d start by looking at the available PDF packages for Go and see what functionality they provide. This should give a rough insight about what’s possible with PDF.

3 Likes

This is a really broad question. But off the top of my head, here’s some stuff to get you started down maybe an easier path than what you’re envisioning. Go has some UI projects but HTML is actually pretty well-suited for the visual/editor portion. So you could implement a web app with an HTML-based WISYWIG editor for the word processor portion. For example:

And there are many other options if that doesn’t work for you:

So, your go app serves up your WYSIWYG editor. Once you have user able to edit HTML, when you “save”, use wkhtmltopdf to generate a PDF from the resulting HTML. Specifically check out the go bindings:

If you don’t leverage existing tech, this sounds like an insurmountably large project for a single person. Just implementing a good editor would take a massive amount of time, then figuring out PDF spec and implementing it etc.

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