sitewaerts / cordova-plugin-document-viewer Goto Github PK
View Code? Open in Web Editor NEWA Document Viewer cordova/phonegap plugin for iOS, Android and Windows
License: MIT License
A Document Viewer cordova/phonegap plugin for iOS, Android and Windows
License: MIT License
Is there a way to disable navigation view ? With the following options set, there really is no need for this secondary nav view. Should it not be disabled automatically ?
var options = {
title: "title",
documentView : {
closeLabel : "Close"
},
navigationView : {
closeLabel : "Back"
},
email : {
enabled : false
},
print : {
enabled : true
},
openWith : {
enabled : false
},
bookmarks : {
enabled : false
},
search : {
enabled : false
}
};
Thanks,
Warren Bell
On iPhone the icons in the title bar overlap each other. A special layout for small screen shall be implemented.
When opening a file that has spaces in it, the plugin does not handle the filename correctly:
Error in SitewaertsDocumentViewer.viewDocument(): invalid file url 'assets/documents/ProductDeployment/Anti Ram/kb2-01-00-00-00.pdf' or no viewer for mime type 'application/pdf'
Filepath example: assets/documents/ProductDeployment/Anti Ram/kb2-01-00-00-00.pdf
Path that works: assets/documents/ProductDeployment/Anti-Ram/kb2-01-00-00-00.pdf
Tested on iOS 10.1.
In my application, some data is confidential, so I need to encrypt those pdf file into raw data. But How can I show that decrypted raw data in our plugin. Please let me know ASAP.
I have a pdf document that I can open on my phone using its default app. When I tried to use this plugin to open it I got this error on the phone: "No viewer for application/pdf" and this "Error in SitewaertsDocumentViewer.viewDocument(): No viewer for application/pdf " in the console.
This is my code:
document.addEventListener('deviceready', function () {
// cordova.plugins.SitewaertsDocumentViewer is now available
//click to view document.
$('#readfile').on('click', function(){
SitewaertsDocumentViewer.viewDocument(
"img/Website.pdf", "application/pdf", {
title: "Website Dev",
documentView: {closeLabel: "Close"},
navigationView: {closeLabel: "Close"},
email: {enabled: true},
print: {enabled: true},
openWith: {enabled: true},
search: {enabled: true}
}, onShow, onClose, onMissingApp, onError);
});
}, false);
//callback functions
function onShow(){
alert('Document shown.');
}
function onClose(){
alert("Document closed.");
}
function onMissingApp(id, installer){
if(confirm("Do you want to install the free PDF Viewer App "
+ appId + " for Android?")){
installer();
}
}
function onError(error){
alert("Sorry! Cannot view document. Error: "+ error);
}
iOS-App crashes when large PDF file is scrolled a lot (e.g. scrolling more than 100 pages).
Reported on iOS 10+
Seems to be related to https://github.com/vfr/Reader/issues/166
The native iOS pdf viewer shows a black bar on top of the screen when the ios status bar is hidden via cordova-plugin-statusbar:
window.StatusBar.hide();
Hello,
Is it possible to open the cleverdox viewer inside a div and not outside my application?
I need to add additional buttons related to my application as top bar menu of the viewer.
Thx,
If the embedding cordova app uses the plugin https://github.com/apache/cordova-plugin-statusbar, the display state of the statusbar (shown/hidden) shall be passed to the viewer plugin.
Currently the staus bar is always shown in the iOS viewer.
Hello,
Please write clearly in your README that the user has to install another app on this phone in order to open the PDF files within the app... Because I lost a lot of time trying to integrate this plugin until I realize this.
Thanks.
Hi,
I want to close PDF when application goes in background and then come to foreground. Is there any possibility which helps us to close PDF programatically(from javascript file)?.
Thank you.
it looks like the height of the scrolling frame is to big. Threrefor the list of entries cannot be scrolled to the end.
Hi, Im trying to compile and here are the errors:
(...)/de.sitewaerts.cordova.documentviewer/SitewaertsDocumentViewer.m:74:84: Property 'request' not found on object of type 'UIView *'
(...)/de.sitewaerts.cordova.documentviewer/SitewaertsDocumentViewer.m:108:84: Property 'request' not found on object of type 'UIView *'
Thanks in advance
It would be awesome if this plugin had a wrapper on ionic native.
Would be a great uptake in usage as well :)
Even I enable the option 'search' : true as informed in the documentation, the feature is not there.
Hi, Nice plugin! Thanks for your work. Can you provide more details for onImpossible callback? Why it calls and what need to do to fix showing pdf doc? I have tired to use it on android.
I disabled the status bar for my app. Now, when the document viewer opens, I get this ugly black placeholder-status-bar without any information in it (since the status bar is disabled).
This should be possible to turn off so it really is a fullscreen view if there is no status bar.
During usage on iOS, a warning log is emitted when you view a document:
THREAD WARNING: ['SitewaertsDocumentViewer'] took '82.083008' ms. Plugin should use a background thread.
Seems like it might be a small lift:
https://cordova.apache.org/docs/en/3.0.0/guide_platforms_ios_plugin.md.html#iOS%20Plugins_threading
- (void)myPluginMethod:(CDVInvokedUrlCommand*)command
{
// Check command.arguments here.
[self.commandDelegate runInBackground:^{
NSString* payload = nil;
// Some blocking logic...
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:payload];
// The sendPluginResult method is thread-safe.
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
}
I am using document viewer to show pulled data from server side, against the selected record.
Initially pulled data correctly display in viewer when it shows page wise.
Issue is when i use preview of all pages in single view it shows old data.
Hallo @regnete,
I ask NPM about our problem, but they well to know a little bit more:
I'm following up on this package issue. If you could share more about what your desired solution would be in this case, that would help determine next steps.
So, can you write more info about merge/delete wrong npm-module?
I ran into an issue where I had a page in /www//index.html that needed to embed the document viewer. It looks like the inclusion of the iframe was coded to be relative to the current path. This caused the iframe to fail to load with the following message: APPHOST9613: The application couldn't navigate to"ms-appx-web:////www/forms/sitewaertsdocumentviewer/viewer.html because of this error: 80004005.". I've got a Pull request incoming to address this for windows, I'm not sure if this is also the case for ios or android as I'm currently only using this on a windows device.
On iOS, I can open the PDFs perfectly. They work very well. However as soon as you press the "Done" button and the viewer closes, a white screen is shown. The app then needs to be restarted as it is completely unresponsive.
There is nothing exciting logged from XCode:
2017-02-03 09:10:54.357774 Cochrane[358:86690] [pdfviewer] path: /var/containers/Bundle/Application/AE8CD45C-D181-45CC-8C08-306316A831AE/Cochrane.app/www/assets/documents/DefenceTesting/ASTMTESTREPORT.pdf
2017-02-03 09:10:54.369403 Cochrane[358:86690] THREAD WARNING: ['SitewaertsDocumentViewer'] took '12.610107' ms. Plugin should use a background thread.
2017-02-03 09:10:54.375280 Cochrane[358:86690] [pdfviewer] path: /var/containers/Bundle/Application/AE8CD45C-D181-45CC-8C08-306316A831AE/Cochrane.app/www/assets/documents/DefenceTesting/ASTMTESTREPORT.pdf
2017-02-03 09:10:54.378042 Cochrane[358:86690] [pdfviewer] options: {
android = {
viewerAppActivity = DocumentViewerActivity;
viewerAppPackage = "de.sitewaerts.cleverdox.viewer";
};
bookmarks = {
enabled = 0;
};
documentView = {
closeLabel = Done;
};
email = {
enabled = 0;
};
navigationView = {
closeLabel = Back;
};
openWith = {
enabled = 0;
};
print = {
enabled = 0;
};
search = {
enabled = 0;
};
title = "ASTMTESTREPORT.pdf";
}
2017-02-03 09:10:54.398381 Cochrane[358:86690] [pdfviewer] toolbar-options: {
android = {
viewerAppActivity = DocumentViewerActivity;
viewerAppPackage = "de.sitewaerts.cleverdox.viewer";
};
bookmarks = {
enabled = 0;
};
documentView = {
closeLabel = Done;
};
email = {
enabled = 0;
};
navigationView = {
closeLabel = Back;
};
openWith = {
enabled = 0;
};
print = {
enabled = 0;
};
search = {
enabled = 0;
};
title = "ASTMTESTREPORT.pdf";
}
2017-02-03 09:10:54.399673 Cochrane[358:86690] [pdfviewer] toolbar-options close label: Done
2017-02-03 09:10:54.438858 Cochrane[358:86690] [pdfviewer] toolbar-options bookmarks: 0
2017-02-03 09:10:54.439071 Cochrane[358:86690] [pdfviewer] toolbar-options email: 0
2017-02-03 09:10:54.439173 Cochrane[358:86690] [pdfviewer] toolbar-options print: 0
2017-02-03 09:10:54.439268 Cochrane[358:86690] [pdfviewer] toolbar-options open with: 0
2017-02-03 09:10:54.541323 Cochrane[358:86690] [pdfviewer] toolbar-options title label: ASTMTESTREPORT.pdf
2017-02-03 09:10:54.551400 Cochrane[358:86690] THREAD WARNING: ['SitewaertsDocumentViewer'] took '176.719238' ms. Plugin should use a background thread.
More information:
Can reproduce on iOS 10.2 Simulator
Can reproduce on iOS 10.2 iPad device
Can reproduce on iOS 9.3 iPad device
Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.10
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.2.1 Build version 8C1002
Getting error in iOS "Error in SitewaertsDocumentViewer.viewDocument(): No viewer for application/pdf" while opening a pdf file.
Here is my code:
SitewaertsDocumentViewer.viewDocument(cordova.file.applicationDirectory + "assets/images/sample.pdf",'application/pdf');
Couple of questions for you.
How new is this plugin ?
How do I keep the options in the title bar from overlapping each other on an iPhone ?
I am mainly interested in view and print. So all I would need is a close/exit button and a print button. I like the view which is one page at a time, swipe to the right to see the next page. Can I set it up to do just this ?
Thanks,
Warren Bell
Some of our pdf contains dot in there file names. If I try to open those files in our plugin, it shows an error that cannot view document. I know we can change the file name as well, but we are downloading it from server side and we have to store there names for future purpose. So, please if any possibility in our plugin to make this change in future then let me know. Because normally,it is possible to open those PDF files on adobe reader.
Thank you in advance. :)
Hello guy's! Thx for a good job, very use full plugin.
I just want to report like 28 Warning during compiling ios demo app, just pay some attention to it.
Thx.
The iOS viewer already remembers the last viewed page.
Supprt for last active view is mising on all platforms.
Hi,
I am trying to use this plugin to present PDF documents in my app. The code works fine in Android, but whenever I run the app in Windows, I get the above error.
Code below for reference:
SitewaertsDocumentViewer.viewDocument(ret, 'application/pdf', VIEWER_OPTIONS, onShow, onClose, onMissingApp, onError);
ret is a variable I use for the file name (which is checked before the call is made, so nothing wrong with that).
Full code for page
Gist for code: https://gist.github.com/ajberry/9b13e38bac94981b82d9be46811fa60c
The options could look like this:
{
documentView : {
closeLabel : STRING,
singlePage : {
enabled : BOOLEAN
},
doublePage : {
enabled : BOOLEAN
},
coverPage : {
enabled : BOOLEAN
}
},
}
sir,i would like to use in ionic app,how shall i install it
Issue #33 / #13 are closed but not solved.
We are currently facing this issue on an iPad (3. gen) using iOS 9.3.5.
Steps to reproduce:
SitewaertsDocumentViewer.viewDocument('fileA.pdf', 'application/pdf');
SitewaertsDocumentViewer.viewDocument('fileB.pdf', 'application/pdf');
After opening File B, the preview panel still shows the previews for File A.
The two files have different contents, different names and a different amout of pages.
Love this plugin and works awesome. Am I missing something to enable hyperlinks or is that not implemented? Thank you!
On iOS devices, after opening 1 document and closing it and then opening a different document the previous documents pages are displayed briefly before the plugin loads the new document.
In addition the preview pages at the bottom display the previous document loaded and not the current document. Have tried on both android and iOS and it only seems to be happening on iOS.
Great work BTW!
I have a collection of PDF's URL's.
After open the first PDF, when I open other PDF the plugin seems to hold the first one in cache, rendering the pages of first PDF and only after render the correct pages.
It happened with anyone?
Thank you all.
Great plugin!
Is there any reason why you haven't used the Android PdfRenderer library such as demonstrated at https://github.com/googlesamples/android-PdfRendererBasic instead of depending on a 3rd party app that must be installed by users on Android?
I understand this library is only available on Android 5+ but it removes an external app dependency and makes it similar to iOS.
As we are using the native windows PDF rendering api, which just converts a pdf page to a raster graphic. links are currently not supported.
I work on a project mainly for android. I fetch pdf url from json response. I need to open those pdf inside embeded pdf viewer. Can i do this with this plugin
Thank you
Hi Felix!
Does your plugin support options for changing size of previews on ios?
Does this plugin have the option to open a PDF file at a given page number?
how can i make pages scroll right to left . for supporting arabic language
Hello,
I get this exception on opening an PDF.
I double checked the existence of the PDF and I builded it pretty much after this example app.
Any suggestions, or might this be a bug?
Exception:
WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> Application tried to present a nil modal view controller on target
Further Logs:
path: /var/mobile/Containers/Data/Application/***/Library/NoCloud/Dossier.pdf
2016-07-15 15:18:05.119 RechnungsApp[1207:496133] [pdfviewer] options: {
android = {
viewerAppActivity = DocumentViewerActivity;
viewerAppPackage = "de.sitewaerts.cleverdox.viewer";
};
bookmarks = {
enabled = 0;
};
documentView = {
closeLabel = Finish;
};
email = {
enabled = 0;
};
navigationView = {
closeLabel = Back;
};
openWith = {
enabled = 0;
};
print = {
enabled = 1;
};
search = {
enabled = 0;
};
title = Dossier;
}
In the Android version, the hyperlinks don't work in the Cleverdox app. This is a complete showstopper for many applications.
[INFO:CONSOLE(196)] "Error in SitewaertsDocumentViewer.canViewDocument(): "JSON error"", source: file:///android_asset/www/plugins/de.sitewaerts.cordova.documentviewer/www/sitewaertsdocumentviewer.js (196)
I have hybrid application based on Ionic 1.3.2 and document-viewer plugin.
I open PDF file with plugin - plugin opens it normally. But when I close plugin and return to my application - layout becomes broken vertically (header moves up and hides beneath status bar and footer moves down). If I don't open PDF files with document-viewer - application behaves normally. I also don't see this strange behavior on Android - on iOS only.
The options could look like this:
{
navigationView : {
closeLabel : STRING,
outlineNavigation : {
enabled : BOOLEAN
},
thumbnailNavigation: {
enabled : BOOLEAN
},
coverPage : {
enabled : BOOLEAN
}
}
}
As currently implemented the outline navigation shall always be automatically disabled, if the pdf document doesn't contain outline navigation data.
Add the possibility to change links into PDF document using JavaScript.
Hi!
I use cordova-check-plugins
module for updating my cordova plugins... But found today:
https://www.npmjs.com/package/de.sitewaerts.cordova.documentviewer has wrong owner..
and I can't update plugin...
plugin: de.sitewaerts.cordova.documentviewer
source: npm://de.sitewaerts.cordova.documentviewer
installed version: 0.2.0
remote version: 0.2.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.