|
@@ -354,7 +354,7 @@ export class CPDFDocument {
|
|
|
* Invokes the system's print service to print the current document.
|
|
|
* @example
|
|
|
* await pdfReaderRef.current?._pdfDocument.printDocument();
|
|
|
- * @returns
|
|
|
+ * @returns
|
|
|
*/
|
|
|
printDocument = () : Promise<void> => {
|
|
|
const tag = findNodeHandle(this._viewerRef);
|
|
@@ -395,12 +395,12 @@ export class CPDFDocument {
|
|
|
* const fontSubset = true;
|
|
|
* const result = await pdfReaderRef.current?._pdfDocument.saveAs(savePath, removeSecurity, fontSubset);
|
|
|
* @param savePath Specifies the path where the document should be saved.<br>
|
|
|
- *
|
|
|
+ *
|
|
|
* On Android, both file paths and URIs are supported. For example:
|
|
|
* - File path: `/data/user/0/com.compdfkit.flutter.example/cache/temp/PDF_Document.pdf`
|
|
|
* - URI: `content://media/external/file/1000045118`
|
|
|
* @param removeSecurity Whether to remove the document's password.
|
|
|
- * @param fontSubset
|
|
|
+ * @param fontSubset
|
|
|
* @returns Whether to embed the font subset when saving the PDF.
|
|
|
*/
|
|
|
saveAs = (savePath : string, removeSecurity : boolean, fontSubset : boolean) : Promise<string> => {
|
|
@@ -415,6 +415,20 @@ export class CPDFDocument {
|
|
|
return Promise.reject('Unable to find the native view reference');
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 返回当前文档的路径。
|
|
|
+ * 在安卓平台,如果通过uri打开的文档,会返回uri
|
|
|
+ * @example
|
|
|
+ * const documentPath = await pdfReaderRef.current?._pdfDocument.getDocumentPath();
|
|
|
+ * @returns The path of the current document.
|
|
|
+ */
|
|
|
+ getDocumentPath = () : Promise<string> => {
|
|
|
+ const tag = findNodeHandle(this._viewerRef);
|
|
|
+ if (tag != null) {
|
|
|
+ return CPDFViewManager.getDocumentPath(tag);
|
|
|
+ }
|
|
|
+ return Promise.reject('Unable to find the native view reference');
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
// export default CPDFDocument;
|