fun generatePDFStart(context: Context) { // creating a PDF Document instance val pdfDocument: PdfDocument = PdfDocument() // PDFUtil instance val pdfUtil = PDFUtil(context) // Page1 Start val page1: PdfDocument.Page = pdfDocument.startPage(pdfUtil.A4) // creating a variable for canvas from our page of PDF. val canvas: Canvas = page1.canvas pdfUtil.titleText("이건 고령 딸기체 글자입니다.", canvas) // End of Page pdfDocument.finishPage(page1) // Save PDF file pdfUtil.savePdfFileExternalStorage("StartPDF.pdf", pdfDocument, context) // Closing PDF Document pdfDocument.close() }