Skip to content
Open
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
13 changes: 13 additions & 0 deletions app/src/main/java/android/print/PostPDFGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ package android.print

import android.content.Context
import android.os.ParcelFileDescriptor
import android.util.Log
import android.webkit.WebView
import android.webkit.WebViewClient
import java.io.File

private const val TAG = "PostPDFGenerator"

/**
* This class needs to be in android.print package to access the package private
* methods of [PrintDocumentAdapter]
Expand All @@ -21,6 +24,16 @@ object PostPDFGenerator {
val adapter = webView.createPrintDocumentAdapter(file.nameWithoutExtension)
print(file, adapter, onResult)
}

@Deprecated("Deprecated in Java")
override fun onReceivedError(
view: WebView?,
errorCode: Int,
description: String?,
failingUrl: String?
) {
Log.w(TAG, "WebView load error during PDF export: code=$errorCode, description=$description, url=$failingUrl")
}
}
}

Expand Down