Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ internal fun ExportShareDialog(
originalExt: String?,
backdrop: LayerBackdrop,
onDismiss: () -> Unit,
onShare: (format: ShareFormat, encrypt: Boolean, password: String) -> Unit
onShare: (format: ShareFormat, encrypt: Boolean, password: String) -> Unit,
/** Prints the document exactly as it is, through Android's print screen (after Gander). */
onPrint: (() -> Unit)? = null
) {
val pdfOnly = originalExt == null
// Keyed on `visible` so every open starts fresh.
Expand All @@ -406,6 +408,7 @@ internal fun ExportShareDialog(
title = stringResource(R.string.viewer_share_title),
actions = {
GlassDialogAction(stringResource(R.string.cancel), onDismiss)
if (onPrint != null) GlassDialogAction(stringResource(R.string.docx_print), onPrint)
GlassDialogAction(
stringResource(R.string.viewer_share_button),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,13 @@ fun PdfViewerScreen(
originalExt = if (shareExt.isNotBlank() && shareExt != "PDF") shareExt else null,
backdrop = contentBackdrop,
onDismiss = { showShareDialog = false },
onPrint = state.document?.uri?.let { docUri ->
{
showShareDialog = false
if (!com.chethan616.clearpdf.utils.PdfPrint.print(context, docUri, state.fileName.substringBeforeLast('.')))
android.widget.Toast.makeText(context, R.string.docx_print_failed, android.widget.Toast.LENGTH_SHORT).show()
}
},
onShare = { format, encrypt, password ->
showShareDialog = false
viewerScope.launch {
Expand Down
Loading