webodf / viewerjs Goto Github PK
View Code? Open in Web Editor NEWViewerJS: Document Reader in JavaScript
Home Page: http://viewerjs.org
ViewerJS: Document Reader in JavaScript
Home Page: http://viewerjs.org
@media print{
*:not(.page){display:none !important;}
}
Should hide everything except the .page content. I still get all the buttons at the top of the page on print. I'd like to reduce client dependency on external viewers, but I'd like to control the printed state of some of my documents.
I don't succeed in finding anything about which browsers are supported by Viewer.JS. I'd love some information about this? Where can I find it?
Using a Rackspace URL, ViewerJS will not load the resource. Rackspace resource URLs are structured as https://[key].ssl.cf2.rackcdn.com/[filename]_[ext]-[id].
Could the lack of the .[ext] in the URL be throwing off ViewerJS?
I have recently implemented Viewer.js and have noticed that when I click the download button it goes to the default browser document viewer and I have to click download again. (Google Chrome)
When I try to use Firefox, the button doesn't appear to do anything.
Note: I haven't edited anything. I just have the folder ViewerJS in my web/ folder on my server and am using the following link to access my document.
.../web/ViewerJS/#../documents/Testing.pdf
For people who have a file with slides (like ODP/PDF) but no device around with a proper slide presentation feature supporting those formats, it could be handy to have a special page on viewerjs.org (or maybe even an own domain like show-your-slides.org) where one can simply upload a file and then do the presentation by viewerjs and the browser.
Nice-to-have: drag'n'drop support from file browser to webpage, for loading the file.
Any plans for responsive support?
Hi,
First of all, congrats for your great job, viewer.js is a very usefull tool.
Just one question: is it possible, when you try to open an unsupported document type (xlsx, docx, etc) that viewer.js shows a message like "The document you are trying to visualize is not supported, you can download it here"?
Actually, when I try to view an unsupported filetype, the viewer just stay blank, and the download link on the upper right corner doesn't works...
Thanks !!!
Is there any work around? it works on safari mobile(ipod/ipad/iphone) it returns Unexpected server response (206) while retrieving PDF in mac and TypeError: 'undefined' is not an object (evaluating 'PDFJS.WorkerMessageHandler.setup') in windows
Is normal that this repo does not contain the Viewer.js source file?
It can be downloaded from http://viewerjs.org/instructions/ but im wondering why is missing here (along with ODF plugin)
Also, i cant find anywhere on the web the Viewer.js uncompressed source..
Hi there,
although I can use viewer.js from the download zip available on the project page, I don't seem to find it on this repo. Am I missing something?
I'm having some problems on Safari, and I'd like to take a look on viewer.js file code, but it's minified. Is it somehow compiled together with pdf.js? If so, how?
Thanks in advance.
Hi i am using viewer.js for providing preview option of odp file in my web app. Locally when i tested it was working fine and still works fine (LAMP) ubuntu. But in one of our live server(apache2) the document does not load.
Javascript console shows :
WARNING: refreshOdf called but ODF was not DONE. webodf.js (line 44)
will be back later... webodf.js (line 44)
will be back later.. will be logged every second
Is it possible to use external URLs to load PDFs?
Most of the time i get this error in Firefox while loading pdf in my viewer. Chrome and Safari is working perfect without errors. Thought it was because i updated the pdf and pdf.worker, but same thing with the old ones.
E.g. for me both examples on http://viewerjs.org/ get hard to use with larger zoom because viewerjs decides by the size if it is on a mobile plattform, which here means scrollbars only hidden behind the toolbars.
And the horizontal toolbar is completely unusable.
Idea was to rather have the website owner pass a flag to viewerjs for mobile mode or not, because the website should know best who it is delivering to.
(Moved over from http://www.webodf.org/redmine/issues/87)
i am trying to add in index.html the zoom in and zoom out button.
The code is:
<button id = "zoomIn" class = "toolbarButton zoomIn" title = "zoomIn"></button>
<button id = "zoomOut" class = "toolbarButton zoomOut" title = "zoomOut"></button>
It doesn't work.
Thanks
Is there a way to set the default zoom for the pdf? I've tried adding pdf open params to the url, but that has no effect. I need to set the default zoom to be page-width.
Hi guys,
I have tested the application using viewer.js with Visual studio internal web server (IIS Express) and it is working fine.If for instance I try to browse http://localhost:9069/Viewer.JS/index.html/# it works fine
But when i published the application on IIS i am getting 404 error at the address
http://publishedsite/Viewer.JS/index.html/#
it works fine if it is like http://publishedsite/Viewer.JS/index.html but it is of no use as i have to concatenate the url of my pdf file like
http://publishedsite/Viewer.JS/index.html/#http://publishedsite/mytest.pdf
Any particular settings required on IIS?
I have a service generating PDF's on the fly and returning it with the correct Content-Type and Content-disposition, but the viewer won't show it. If I save the PDF as a file, the viewer works as expected.
This doesn't work:
http://mypage.com/viewer.js/#http://mypage.com/service/createpdf
This works:
http://mypage.com/viewer.js/#http://mypage.com/file.pdf
The text layer in PDFs does not keep up with the zoom level.
This can be seen by changing to a non-initial zoom level (not necessarily 100%) and then trying to select text.
Naming of the viewerXXX product is not consistent ATM.
One can see at least "Viewer.JS", "viewer.js", "Viewer.js", "ViewerJS".
This needs to be standardized.
I would like to disable the presentation button, as it is currently not functional in IE 10. Is there a querystring option, without editing the source, to have this button not display, e.g. viewer.js/index.html?nopresentationbutton=1&.... ?
Also, when users click on the download button, the product does not download but instead opens the pdf in the same window with adobe reader, as most users have adobe reader installed. As such, is there a way to specify the target of the download button to be _blank rather than _self, so the adobe reader will open in a new window? Thanks much.
For some still unknown reason the canvascontainer has a fixed size with ODP files, which results in scrollbars on small window sizes.
Effect not seen with PDFs or ODTs.
There should be an optional UI element which offers a link which will result in the currently selected page in the document if a browser opens that url in a new page.
Viewer.js for that needs to also offer a method in the API which allows to set/create the link, as the exact link depends on the embedding webpage/website.
Hi,
I have issue that library doesn't work on safari. the Safari give a warning:
Warning: Setting up fake worker.
TypeError: 'undefined' is not an object (evaluating 'PDFJS.WorkerMessageHandler.setup')
Great though, Viewer.js seems to be unable to convert hyperlinks and mailto: links into functional links which limits the range of use down to a bottom line (which is a nice tool anyway).
Anyone remembering a pdf without a link somewhere, ie. to get in contact with the author? ;) Would love to see Viewer.js being capable of showing functional hyperlinks.
Expected:
Last slide is shown
Actual:
Last slide is shown for a short moment, then view returns to second-last slide
Similar effect with Page-down button, just that there the actual result is advance by two slides instead of just one.
Reason is that clicking a button currently leaves the focus on the button (see #38). Just, pressing the "space" key, will now both result in advancing to the next page, but also activate the button.
Is such scenario possible? It's a great deal for me, but I can't understand how to make it happen, and the documentation doesn't say a word about such scenario. Also, is there an API documentation, or at least a more thoroughly description of what each file/function does?
viewer.js when used without specifying a default document should show a standard document. e.g. something similar to webodf/programs/viewer/README-viewer.odt
I would be more than happy to find solution for that problem if you can get access to uncompressed version of viewer.js.
Hi,
Is it possible to use base64 encoded PDF data instead of the exact path to the file to display the PDF?
There should be an optional UI element which offers an url which, if a browser opens that url in a new view/window, will result in the currently selected text in the document to be selected and the visible area adapted so the start of the selection and as much as possible of the rest is visible.
Viewer.js for that needs to also offer a method in the API which allows to set/create the link, as the exact link depends on the embedding webpage/website. Another method might be needed to set the selection.
Currently there is no visible difference between fullscreen and presentation with PDFs. In presentation mode I expect the pages shown page-by-page and not as scrollable list with all pages
Expected:
no left/right overlay navigator buttons seen
Actual:
left/right overlay navigator buttons blend in and out again
I've observed this behavior in an embedded iFrame. These invisible text <div>
s allow the native browser highlighting, so highlighting locations after zoom do not match the rendered text.
I don't know if that is a problem with PdfJs, but I don't observe that behavior when opening the PDF in Firefox.
EDIT:
I took a dig through the code. In PDFViewerPlugin the function updatePageDimensions updates the outer textLayer <div>
. Each text-line <div>
has the following attributes that need to be updated: data-canvas-width
, left
, top
, and scale
.
Description of the Problem I would like to Solve:
Currently, I display a PDF file in my web browser on one monitor and a custom web application on a second monitor so that I can manually select text in the PDF file, copy the text (e.g. Ctrl C), click on a data field within the custom web application, and paste the text (e.g. Ctrl V) into the correct data field within the custom web application. I was just wondering if it is possible to streamline this process with a semi-automated solution as proposed below.
Proposed Possible Solution:
If Viewer.js and a custom web application are both residing on the same server, then is it possible to copy manually selected content from a PDF file displayed in Viewer.js to the custom web application using a custom developed user interface and workflow similar to what is described below:
If implementing the solution proposed above is possible, then I would greatly appreciate it if you can please explain how? Alternatively, if not, then I would greatly appreciate it if you can please explain why not.
Thank you.
Hi all,
im developing a phone app using Cordova and i need to show a embedded pdf . I've tried with Viewer JS but it doesnt work.
Any idea? , isnt it compatible?
Thanks, Sergio.
pd:(sorry for my English).
Hi Guys,
The last release available was in september.
http://viewerjs.org/getit/
Pdf.js has a lot of changes since then, which work with the latest commit you have in github, but not the last released zip. Could you do a new release and update the site.
Also, maybe you could document building the libs? I tried running cmake, but had to give up midway.
If seeing a bug in a viewer.js instance it is hard to tell which version it is, and which version of the viewer plugin (pdf.js, webodf.js) is used.
Also there is no indication what tool this is, so people do not know where to get this viewer plugin for their own website.
Please add info somewhere about:
If on the first page, the "previous" button should not be shown.
If on the last page, the "next" button should not be shown.
Instead of hiding the respective button could also be shown as disabled, if there is some typical pattern for that.
Can I create my own buttons for previous and next on the page to control PDF in iframe ?
I dont want to use the overlay ?
If I have a dynamically generated / custom served PDF (because I have to use URLs that expire and that verify security settings in the session before serving content) I have issues with the type detection:
This works as expected:
http://localhost:8080/Viewer.js/index.html#/test/pdf/demodoc.pdf
This does not work:
http://localhost:8080/Viewer.js/index.html#/test/pdf/demodoc.pdf?foo=bar
This hack with a parameter I don't look at forced on the end does:
http://localhost:8080/Viewer.js/index.html#/test/pdf/demodoc.pdf?foo=bar&type=.pdf
I think the problem is here:
function loadDocument(documentUrl) {
"use strict";
if (documentUrl) {
var extension = documentUrl.split('.').pop(),
this function assumes that there are no parameters
The following might fix this:
function loadDocument(documentUrl) {
"use strict";
if (documentUrl) {
var extension = documentUrl.split('?')[0].split('.').pop(),
It seems as though Viewer.js creates a memory leak (in Eclipse). When I add it to a web project, Eclipse first sees an error in the javascript, at the same time my Windows task manager shows Eclipse expaniding its working memory use. The errors are found in pdf.js and pdf.worker.js
Description Resource Path Location Type
Internal validation error
java.lang.ArrayIndexOutOfBoundsException: 1
at org.eclipse.wst.jsdt.internal.compiler.flow.UnconditionalFlowInfo.markAsDefinitelyNonNull(UnconditionalFlowInfo.java:1193)
at org.eclipse.wst.jsdt.internal.compiler.ast.FieldReference.analyseAssignment(FieldReference.java:80)
at org.eclipse.wst.jsdt.internal.compiler.ast.Assignment.analyseCode(Assignment.java:63)
at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:91)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.analyseCode(AbstractMethodDeclaration.java:110)
at org.eclipse.wst.jsdt.internal.compiler.ast.FunctionExpression.analyseCode(FunctionExpression.java:74)
at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.analyseCode(Expression.java:184)
at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:65)
at org.eclipse.wst.jsdt.internal.compiler.ast.LocalDeclaration.analyseCode(LocalDeclaration.java:73)
at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.analyseCode(MethodDeclaration.java:91)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.analyseCode(AbstractMethodDeclaration.java:110)
at org.eclipse.wst.jsdt.internal.compiler.ast.FunctionExpression.analyseCode(FunctionExpression.java:74)
at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.analyseCode(Expression.java:184)
at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.analyseCode(MessageSend.java:65)
at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.analyseCode(CompilationUnitDeclaration.java:155)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.process(Compiler.java:609)
at org.eclipse.wst.jsdt.internal.compiler.Compiler.compile(Compiler.java:355)
at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:288)
at org.eclipse.wst.jsdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:306)
at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:227)
at org.eclipse.wst.jsdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:134)
at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:302)
at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:214)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
pdf.js /TextComparison/WebContent/js/Viewer.js line 0 JavaScript Problem
Is it supposed to work in IE? For me, it works in chrome. When I test it embedded in an iframe, the pdf is missing almost everything in IE 10 and 11. Although, when accessing it without an iframe, it works in IE11, but is still bugged in IE10.
When zooming in, the document container (inside #canvasContainer) get scrollbars, but becose of the bottom toolbar, only the scrollbar on the right is usable.
Possible solution could be:
The last solution would be the more efficient, imho, but the effect will be less 'cool'.
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.