expo-print
provides an API for iOS (AirPrint) and Android printing functionality.Android Device | Android Emulator | iOS Device | iOS Simulator | Web |
---|---|---|---|---|
expo install expo-print
If you're installing this in a bare React Native app, you should also follow these additional installation instructions.
import * as Print from 'expo-print';
DocumentPicker
) or base64 data URI starting with data:application/pdf;base64,
. This only supports PDF, not other types of document (e.g. images).612
which is a width of US Letter paper format with 72 PPI. Available only with html
option.792
which is a height of US Letter paper format with 72 PPI. Available only with html
option.html
option that uses UIMarkupTextPrintFormatter instead of WebView. Might be removed in the future releases.selectPrinterAsync
.Print.Orientation.portrait
or Print.Orientation.landscape
.612
which is a width of US Letter paper format with 72 PPI.792
which is a height of US Letter paper format with 72 PPI.base64
option is truthy. It doesn't include data URI prefix data:application/pdf;base64,
.printAsync
.name
and url
of the selected printer.html
option in printAsync
or printToFileAsync
, the resulting print might contain page margins (it depends on WebView engine).
They are set by @page
style block and you can override them in your HTML code:<style> @page { margin: 20px; } </style>