mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.32k stars 9.97k forks source link

JavaScript-embedded PDF object does not work #1590

Closed GPHemsley closed 12 years ago

GPHemsley commented 12 years ago

This page has a PDF object created via JavaScript embedded on the page, but it doesn't work: http://riviste.unimi.it/index.php/inkoj/article/view/838/1084

yurydelendik commented 12 years ago

Do any other PDF plug-ins except Adobe's work with this page?

GPHemsley commented 12 years ago

I don't know of any other PDF plugins, so I couldn't speak to that directly, but I don't see why that would be the case. It doesn't appear that the code calls out Adobe specifically, and the error message is one of the few that I've seen which don't specify Adobe as the only provider of such a plugin.

Here's the segment of code in question (they use jQuery):

    <script type="text/javascript"><!--
        $(document).ready(function(){
            if ($.browser.webkit) { // PDFObject does not correctly work with safari's built-in PDF viewer
                var embedCode = "<object id='pdfObject' type='application/pdf' data='http://riviste.unimi.it/index.php/inkoj/article/viewFile/838/1084' width='99%' height='99%'><div id='pluginMissing'><p>The PDF file you selected should load here if your Web browser has a PDF reader plug-in installed (for example, a recent version of <a href=\"http://www.adobe.com/products/acrobat/readstep2.html\">Adobe Acrobat Reader<\/a>).<\/p> <p>Alternatively, you can also download the PDF file directly to your computer, from where it can be opened using a PDF reader. To download the PDF, click the Download link below.<\/p> <p>If you would like more information about how to print, save, and work with PDFs, Highwire Press provides a helpful <a href=\"http://highwire.stanford.edu/help/pdf-faq.dtl\">Frequently Asked Questions about PDFs<\/a>.<\/p></div></object>";
                $("#articlePdf").html(embedCode);
                if($("#pluginMissing").is(":hidden")) {
                    $('#fullscreenShow').show();
                    $("#articlePdf").resizable({ containment: 'parent', handles: 'se' });
                } else { // Chrome Mac hides the embed object, obscuring the text.  Reinsert.
                    $("#articlePdf").html('<p>The PDF file you selected should load here if your Web browser has a PDF reader plug-in installed (for example, a recent version of <a href=\"http://www.adobe.com/products/acrobat/readstep2.html\">Adobe Acrobat Reader<\/a>).<\/p> <p>Alternatively, you can also download the PDF file directly to your computer, from where it can be opened using a PDF reader. To download the PDF, click the Download link below.<\/p> <p>If you would like more information about how to print, save, and work with PDFs, Highwire Press provides a helpful <a href=\"http://highwire.stanford.edu/help/pdf-faq.dtl\">Frequently Asked Questions about PDFs<\/a>.<\/p>');
                }
            } else {
                var success = new PDFObject({ url: "http://riviste.unimi.it/index.php/inkoj/article/viewFile/838/1084" }).embed("articlePdf");
                if (success) {
                    // PDF was embedded; enbale fullscreen mode and the resizable widget
                    $('#fullscreenShow').show();
                    $("#articlePdfResizer").resizable({ containment: 'parent', handles: 'se' });
                }
            }
        });

    // -->
    </script>
yurydelendik commented 12 years ago

so that's a poorly implemented web page?

pdfobject.js from this page tries acrobat plugin as as ActiveX, doesn't it?

GPHemsley commented 12 years ago

Oh, I have no idea. Is that what's happening?

yurydelendik commented 12 years ago

page doesn's not use pdf.js to embed pdf document. closing as invalid