1. Home
  2. Foxit PDF SDK for Android
  3. How to print a PDF document using Foxit PDF SDK for Android?

How to print a PDF document using Foxit PDF SDK for Android?

Foxit PDF SDK for Android supports the print feature since version 5.1. You can press the Wireless Print button on the More Menu view in the Complete PDF viewer demo to print the PDF document. Furthermore, you can call the following API to print the PDF documents:

// for iPhone and iTouch
public void startPrintJob(Context context, PDFDoc doc, String printJobName, String outputFileName, IPrintResultCallback callback)

Following is a sample for how to use it:

// Assume you have already Initialized a UIExtensionsManager object
PDFDoc doc = null;
IPrintResultCallback print_callback = new IPrintResultCallback() {

@Override
public void printFinished() {
}

@Override
public void printFailed() {
}

@Override
public void printCancelled() {
}
};

try {
doc = new PDFDoc("/mnt/sdcard/input_files/Sample.pdf");
doc.load(null);
} catch (PDFException e) {
Assert.fail("unexpect a PDF Exception!!errCode = " + e.getLastError());
}
uiExtensionsManager.startPrintJob(getActivity(), doc, "print with name", "print_withAPI", print_callback);
}
Updated on November 14, 2019

Was this article helpful?

Related Articles

Ready to try Foxit PDF SDK?
Click the link below to download your trial
Free Trial