Remix.run Logo
fithisux 5 hours ago

You can't change a PDF, it is by design to be not easy to OCRed

kube-system 5 hours ago | parent | next [-]

PDFs are merely an collection of objects, that can be plainly read by reading the file -- some of those are straight up plain text that doesn't even need to be OCR'd, it can be simply extracted. It is also possible to embed image objects in PDFs, (this is common for scanned files) which might be what you are thinking of. But this is not a design feature of PDF, but rather the output format of a scanner: an image. Editing PDFs is a simple matter of simply editing a file, which you can do plainly as you would any other.

jimjimjim an hour ago | parent | prev [-]

It is not by design! PDFs that are made from scanned documents or collections of images would require OCRing but that is true of any format that the scans/images are put into. These days the vast majority of PDFs do not need to be OCRed as the pages are just made up of text, line drawings and images. And although it can get tricky you can edit those text, line and image commands as much as you want.

For example: add this is in the contents stream for a pdf page and it'll put hello world on the page

  BT
    /myfont 50 Tf
    100 200 Td
    (Hello World) Tj
  ET

(Note: a bit more is required to select the font etc)