PDF Creation
The Docutain SDK for Android comes with the ability to create searchable and non-searchable PDF documents either from a scanned document with Docutain's Scanner SDK or imported file.
Initialization
Initialize Docutain's Android SDK as described here.
Create a PDF
In order to create a PDF document, first a document needs to be scanned with Docutain's Scanner SDK or imported.
After that you can generate the PDF document.
- Kotlin
- Java
import de.docutain.sdk.Document
...
//scan or import file
...
val pdfFile = Document.writePDF(File(filesDir, "testPDF"))
if(pdfFile != null){
//do something with the created PDF file
} else{
//error occured
val error = DocutainSDK.getLastError()
}
import de.docutain.sdk.Document
...
//scan or import file
...
File pdfFile = Document.writePDF(new File(getFilesDir(), "testPDF"));
if(pdfFile != null){
//do something with the created PDF file
} else{
//error occured
String error = DocutainSDK.getLastError();
}
tip
You can specify the PDF page format by providing the appropriate value:
- Kotlin
- Java
val pdfFile = Document.writePDF(File(filesDir, "testPDF"), true, Document.PDFPageFormat.A4)
File pdfFile = Document.writePDF(new File(getFilesDir(), "testPDF"), true, Document.PDFPageFormat.A4);