I write a print class in Android app, and I want to save the printAttribute before rotation and reconnect to the printer using the former printAttribute, but when I pass the oldPrintAttribute it does not work, the print dialog still shows the default option, this is my code.
PrintManager printManager = (PrintManager) context.getSystemService(Context.PRINT_SERVICE);
String jobName = PdfFragment.sProjectPrefix + " " + getFileNameFromPath(mPdfDocumentName);
printManager.print(jobName, new PdfFragmentPrintDocumentAdapter(), printAttributes);
Or can I set the print option in my program one by one?
Set your PrintAttributes before passing to print function. This worked worked for me.
PdfFragmentPrintDocumentAdapter.java
}
Have you tested your code on Android N? The printAttributes values were ignored before N due to this Android issue.