Coder Social home page Coder Social logo

sitewaerts / cordova-plugin-document-viewer Goto Github PK

View Code? Open in Web Editor NEW
176.0 26.0 101.0 20.04 MB

A Document Viewer cordova/phonegap plugin for iOS, Android and Windows

License: MIT License

Objective-C 2.79% JavaScript 92.72% Java 0.23% CSS 4.16% HTML 0.08% Batchfile 0.01% Shell 0.01%
pdf cordova plugin pdf-viewer ios android windows

cordova-plugin-document-viewer's People

Contributors

dominikschnieper avatar enrico204 avatar flyhuang avatar livven avatar oddcb avatar phibo23 avatar regnete avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-document-viewer's Issues

Disable Navigation view

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

Spaces not supported in the filename

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.

Base64 pdf data

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.

Bottom page list with blank frames

Hello everyone.

Some PDF's that I open with the plugin on iOS 9.0, come with blank frames on bottom page list.

image1

But when I select one blank page, the hightlight comes with the page frame

image2

It happened with anyone?

Thank you for your support.

ErrorNo viewer for application/pdf

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);
}

Load the viewer inside a div

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,

Close PDF when application goes in background

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.

Bug compiling in cordova iOS 4.0.1

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

onImpossible

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.

Do not show status bar

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.

Plugin should use a background thread

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];
    }];
}

Preview panel not refresh the data

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.

v2 -> npm -> wrong owner?

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?

Windows - allow document viewer to open on pages other than ones in www/

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.

bug: After closing the viewer I get a white screen

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

No viewer for application/pdf error

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');

Questions about plugin ?

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

dot('.') in file name - not opening PDF

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. :)

IOS compiling issue

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.

'SitewaertsDocumentViewer' is undefined - Windows 10

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

Preview panel not refreshing the data

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:

  1. open File A using: SitewaertsDocumentViewer.viewDocument('fileA.pdf', 'application/pdf');
  2. close the viewer using the Done-Button in the upper left corner
  3. open File B using: 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.

Question: hyperlink

Love this plugin and works awesome. Am I missing something to enable hyperlinks or is that not implemented? Thank you!

Previous document pages displayed after opening new document

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!

iOS - PDF Reader loads the first pdf read

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.

ios previews size

Hi Felix!
Does your plugin support options for changing size of previews on ios?

<NSInvalidArgumentException> Application tried to present a nil modal view controller on target

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;
}

canViewDocument(): "JSON error""

[INFO:CONSOLE(196)] "Error in SitewaertsDocumentViewer.canViewDocument(): "JSON error"", source: file:///android_asset/www/plugins/de.sitewaerts.cordova.documentviewer/www/sitewaertsdocumentviewer.js (196)

Layout breaks after plugin close on iOS (Ionic 1.3.2)

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.

Add option to disable any of the navigation view modes

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.

Windows.Data.Pdf Undefined

I am trying to deploy to windows phone 8.1 and i get this error:
Unable to get property 'PdfDocument' of undefined or null reference

the origin is this line:
return Windows.Data.Pdf.PdfDocument.loadFromStreamAsync(stream);

I tested the app on windows 10 and it worked.
any ideas?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.