Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
LucasFscPublic archive

About

Convert Html to Pdf in Android

Topics

Resources

Stars

31 stars

Watchers

0 watching

Forks

Repository files navigation

Html2Pdf

Android library to convert Html from strings into Pdf files.

This library is not mainteined anymore

Feel free to fork and use it.

Download

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

implementation 'com.github.LucasFsc:Html2Pdf:0.2-beta'

How do I use it?

In your MainActivity instantiate the converter class and pass the parameters:

class MainActivity : AppCompatActivity(), Html2Pdf.OnCompleteConversion /* Callback */ {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        //Impl example
        val converter = Html2Pdf.Companion.Builder()
            .context(this)
            .html("<p> Your awesome HTML string here! </p>")
            .file(File(URI("Your Pdf file URI")))
            .build()

        //can be called with a callback to warn the user, share file...
        converter.convertToPdf(this)

        //or without a callback
        converter.convertToPdf()
        
    }

    override fun onSuccess() {
        //do your thing
    }

    override fun onFailed() {
        //do your thing
    }
    
}

License

MIT

About

Convert Html to Pdf in Android

Topics

Resources

Stars

31 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages