Skip to content

setPageSize is not found #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thesua7 opened this issue Apr 28, 2024 · 0 comments
Open

setPageSize is not found #64

thesua7 opened this issue Apr 28, 2024 · 0 comments

Comments

@thesua7
Copy link

thesua7 commented Apr 28, 2024

fun generatePdf() {
if (!::targetView.isInitialized) {
Log.e("PdfGenerator", "Target view is not initialized.")
return
}

PdfGenerator.getBuilder()
    .setContext(componentActivity)
    .fromViewIDSource()
    .fromViewID(componentActivity, targetView.id)
    .setPageSize(PdfGenerator.PageSize.A4) // Set A4 size here
    .setFileName("Demo-Text")
    .actionAfterPDFGeneration(PdfGenerator.ActionAfterPDFGeneration.SHARE)
    .savePDFSharedStorage(observer)
    .build(object : PdfGeneratorListener() {
        override fun onFailure(failureResponse: FailureResponse) {
            super.onFailure(failureResponse)
            // Handle failure
        }

        override fun onStartPDFGeneration() {
            // Do something when PDF generation starts
        }

        override fun onFinishPDFGeneration() {
            // Do something when PDF generation finishes
        }

        override fun showLog(log: String) {
            super.showLog(log)
            Log.d("PDF-generation", log)
        }

        override fun onSuccess(response: SuccessResponse) {
            super.onSuccess(response)
            // Handle success
        }
    })

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant