signintech / gopdf

A simple library for generating PDF written in Go lang
MIT License
2.45k stars 269 forks source link

(Question): How to image bytes to pdf? #213

Open rushkii opened 2 years ago

rushkii commented 2 years ago

Hello, I want to add image into PDF per page but using bytes method like img2pdf python did. I want to download from an image URL and get the raw bytes and that bytes convert into PDF, I don't want to download and create a file then convert it into PDF. How to use it?

jenpet commented 2 years ago

Hey, you can try one of the attempts the same way I did in https://github.com/signintech/gopdf/issues/214. In your scenario, I'd assume creating an actual Image instance might seem the appropriate way to go in case you don't use transparent files.

ixuer commented 2 years ago

Have you tried ImageHolderByBytes(b []byte) (ImageHolder, error)

vantaboard commented 3 weeks ago

@oneplus1000 can you close this issue if it has been resolved? It seems to have been abandoned by the original poster.