Skip to content

NoVaTin202/Html2Pdf

 
 

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%