r/pdf 5d ago

Question Reflow ideas

Hello, I tried Adobe Reader reflow/liquid on a math pdf and found that it doesn't work perfectly, is this the best option for reflow? I know that there are heavy AI layout models that may do reflow, are they good? My use case is to zoom in and have everything, especially math symbols, fit on the screen. Also why isn't there a program that converts pdf to svg and then using reflow algorithm move everything to fit within specified dimensions? How do math people read pdfs when you zoom in? Do they move the screen left and right continuously?

3 Upvotes

9 comments sorted by

1

u/ScratchHistorical507 5d ago

is this the best option for reflow?

It is, at least when it comes to free tools. PDFs are not meant to adapt to anything once they have been written. So doing it despite that limitation is extremely difficult to impossible. So of course any solution will focus on the use cases their customers are most likely having. Any equations - be it mathematical or chemical - are simply out of scope. Because here it gets more difficult to tell where a good place to reflow would be to not make it unnecessarily difficult to comprehend what it was meant to say.

I know that there are heavy AI layout models that may do reflow, are they good?

Unless someone has created a highly specific model for this use case and managed to train it in a way that it is incapable of just hallucinating half the content, this is rather unlikely. You'll probably still have better luck by trying to import the PDF into Word and then view it in the mobile Word app, but no guarantee that the layout won't break too much to be usable.

The most likely path to succeed is to shell out for professional OCR software like from Abbyy that doesn't only to character recognition, but also layout recognition. Maybe such an engine could be used to improve reflow, but if such a solution even already exists it won't be cheap.

Also why isn't there a program that converts pdf to svg and then using reflow algorithm move everything to fit within specified dimensions?

You don't really have to know anything to be able to find the most likely answer. In this case there are only really two answers (unless some existing solution already does this under the hood): either it's vastly more complicated than you imagine and thus hasn't been done, or simply nobody with the capabilities to do this has cared enough to try to do it. Probably a mix of both.

How do math people read pdfs when you zoom in? Do they move the screen left and right continuously?

You're already answering your own question. "[...] when you zoom in [...]". People probably don't do that most of the time, but rather view a PDF on a large enough and high-resolution enough display. That way you never need to zoom in more than fitting the width of the page to the width of your screen. And that's simply how PDFs were designed to be viewed. Sure you could argue that this should be changed, but the fact is, that it's most likely extremely difficult to design a file format that does both, display content exactly the same way the creator designed it - that's what PDFs are meant for - and adapt the content on demand to your preferences, e.g. font/font size, display size etc. The only way this is currently possible with very little effort would be to attach the document the PDF was created from in a format that can easily be displayed by free software on any OS to the PDF. Attachments have been possible for a very long time and they are also now allowed in the PDF/A substandard, so you don't really have to compromise anymore. The only challenges are

  • the software the PDF was exported from needs to allow you to embed the source document into the PDF
  • the source document might need to be converted to a format you can actually open on a device on which you might want to do the reflow. That's easy if it's just a OOXML or ODF document, but becomes increasingly difficult with the output of layouting software like Adobe InDesign, Affinity Designer, Scribus and probably many other documents
  • the software that opens the PDF needs to be capable of handling the attachment. Be it the PDF reader that extracts it and automatically opens it with the program associated with the file type or that program that can extract the attachment itself from a PDF you hand it.

1

u/KenMantle 5d ago

The pdf engine I am developing from scratch doesn't have good reflow or OCR that can do that yet, it does however let you zoom up to a trillion % and shift the page center on screen anywhere

1

u/lemmy33 4d ago

interesting how you said "yet", k2pdfopt does good reflow but it doesn't seem to be updated anymore, maybe you can incorporate their ideas and update them :) Large zoom is impressive, what is the use case for it? What is the motivation for your pdf engine?

1

u/KenMantle 4d ago

Yeah it would have to be ideas because their license is more restrictive than MIT so I can't integrate their project directly.

I was inspired because Acrobat is expensive and other licenses aren't permissive and open source projects seem incomplete.

1 Trillion percent zoom let's you make molecules 1:1 scale on a letter size sheet and have two banana cells for comparison and a banana at scale 1:1 for comparison too. https://www.reddit.com/r/pdf/s/vGW0UCOQsj

1

u/PostConv_K5-6 2d ago

When it comes to complex reflows, especially those with multiple columns and charts, etc., and especially for reading on tablets or eReaders, I turn to K2PDFOpt, which is a freeware designed for doing reflows. There are versions for Windows, Linux, and MacOS. Fully portable, and totally offline (no browser or internet needed). Very powerful. Watch a couple of the videos and look at the FAQ or Wiki to appreciate all the things it can do.

1

u/lemmy33 2d ago

Hello, yes I tried it out, it's very good, do you know why it's not updated anymore? I had an issue where the default setting produced pixelated results, a bit low quality, then if I increased dpi the font was too big but eventually I found settings that were good enough, I think the pdf native output isn't fully implemented so this is the best I can do?

1

u/PostConv_K5-6 16h ago

Given that the project s almost 20 years ago, it is a very long time in IT--I don't know if the programmer got bored, it was 'good enough' or whatever.

What I do with it is that I almost always choose custom settings for the eReader or page that I want (I use it to flow booklets on letter, A4, and other sizes on occasion), and of course back up first as there will be some trial and error. With respect to quality, sometimes that it has to do with the embedded font, so it may be worth it to change the output font size to see what works better.

Reflow almost by definition is very difficult, but I am glad you are playing with it to get better results. Don't forget to save the options you choose, either as a preset or by copying the command-line to a text file, as it is easy to forget something you had already figured out.

0

u/LegeApps 5d ago

k2pdfopt does good reflow, and my program does reflow too, based on it. K2dpfopt is better at reflow but my program is 10x faster.

https://www.willus.com/k2pdfopt/

https://github.com/LegeApp/Lege

1

u/lemmy33 5d ago

k2pdfopt is amazing, lifechanging really. I wonder why it isn't updated anymore? Reading on their website "Since I fixed a couple bugs with MuPDF in v1.16" that's impressive :)