arachnys / athenapdf

Drop-in replacement for wkhtmltopdf built on Go, Electron and Docker
MIT License
2.26k stars 186 forks source link

is it possible to use it as a library? #141

Open winteraz opened 6 years ago

winteraz commented 6 years ago

I'm trying to figure out how to use athenapdf as a library. I just want to handle the conversion directly without docker, queues, electron and other stuff.

E.g. func ConvertHTMLToPDF(htmlContent []byte)(pdfCOntent []byte, err error). Where can I find the core code that handles the pdf conversion?

MrSaints commented 6 years ago

Apologies for the very slow response @winteraz.

Yes, you can use it as a library. It is probably easier in v3 than it is in its current incarnation.

See: https://github.com/arachnys/athenapdf/tree/v3/pkg/converter

You can see how it is being used as a library here.

If you want to go even lower, you can interact with the 'runner': https://github.com/arachnys/athenapdf/blob/v3/pkg/runner/runner.go

Bear in mind, if you use the Chrome-based converter, you will have to have Chrome installed in the environment running the converter.

byrnedo commented 6 years ago

Hi, how stable is the converter package? Do you treat it as public or does the interface change often?