unidoc / unipdf

Golang PDF library for creating and processing PDF files (pure go)
https://unidoc.io
Other
2.46k stars 250 forks source link

[FEATURE] Need a way to specify position of a word #518

Open sagar-kalburgi-ripcord opened 1 year ago

sagar-kalburgi-ripcord commented 1 year ago

Is your feature request related to a problem? Please describe. I am trying to utilize the JSON response from Google Vision OCR API to create a searchable PDF. The JSON response consists of the details of the text layout. I used the unipdf Go library to add the image of a scanned text document to a PDF file, and then tried to overlay the text contained in the JSON response on top of it. Unipdf Go library does provide a way to specify the position of a paragraph, but it does not provide a way to specify the position of each word as specified in the text layout. There is this function but it does not allow to specify the coordinates of the word (text chunk).

Describe the solution you'd like Library function to specify the position of a word

Describe alternatives you've considered I did try to consider each word as a paragraph to position it via coordinates using the function https://apidocs.unidoc.io/unipdf/v3.39.0/github.com/unidoc/unipdf/v3/creator/#StyledParagraph.SetPos but its not getting rendered properly, moreover it is semantically wrong.

github-actions[bot] commented 1 year ago

Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/

sampila commented 1 year ago

Hi @sagar-kalburgi-ripcord,

Could you share runnable code snippet for us to reproduce the issue on our end?

Best regards, Alip