Printing a PDF in Android
Apryse SDK supports printing. The library handles all the hard work, you simply have to tell it to show the system print dialog with a document. This can be done with [Print.startPrintJob](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/Print.html#startPrintJob(android.content.Context, java.lang.String, com.pdftron.pdf.PDFDoc, java.lang.String, java.lang.Integer, java.lang.Boolean)).
Here is how:
void handlePrintJob(Activity activity, boolean isRtl,
boolean printDocument,
boolean printDocumentWithAnnotations,
boolean printDocumentWithAnnotationSummary) {
int printContent = 0;
if (printDocument) {
printContent |= Print.PRINT_CONTENT_DOCUMENT_BIT;
}
if (printDocumentWithAnnotations) {
printContent |= Print.PRINT_CONTENT_ANNOTATION_BIT;
}
if (printDocumentWithAnnotationSummary) {
printContent |= Print.PRINT_CONTENT_SUMMARY_BIT;
}
Print.startPrintJob(activity, activity.getString(R.string.app_name), mPdfDoc, printContent, isRtl);
}fun handlePrintJob(activity: Activity, isRtl: Boolean,
printDocument: Boolean,
printDocumentWithAnnotations: Boolean,
printDocumentWithAnnotationSummary: Boolean) {
var printContent = 0
if (printDocument) {
printContent = printContent or Print.PRINT_CONTENT_DOCUMENT_BIT
}
if (printDocumentWithAnnotations) {
printContent = printContent or Print.PRINT_CONTENT_ANNOTATION_BIT
}
if (printDocumentWithAnnotationSummary) {
printContent = printContent or Print.PRINT_CONTENT_SUMMARY_BIT
}
Print.startPrintJob(activity, activity.getString(R.string.app_name), mPdfDoc, printContent, isRtl)
}Last updated
Was this helpful?