Home > front end >  Pdfobject. Js online preview image, how didn't like the preview PDF to zoom in and rotate butto
Pdfobject. Js online preview image, how didn't like the preview PDF to zoom in and rotate butto

Time:09-27



CodePudding user response:

Js code to stick out and see,

CodePudding user response:

/* global ActiveXObject, window, console, define, module, jQuery */
//jshint unused: false, strict: false

/*
PDFObject v2.1.1
https://github.com/pipwerks/PDFObject
Copyright (c) 2008-2018, Philip Hutchison
MIT - style license: http://pipwerks.mit-license.org/
UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js
*/

(function (root, factory) {
If (typeof define==='function' & amp; & Define. Amd) {
//AMD. Register as an anonymous module.
Define ([], the factory);
} else if (typeof module==='object' & amp; & The module. Exports) {
//the Node Does not work with strict CommonJS, but
//only CommonJS - like environments that support module. Exports,
//like Node.
The module exports=factory ();
} else {
//Browser globals (root is Windows)
Root. PDFObject=factory ();
}
} (this, the function () {

"use strict";
//jshint unused: true

//PDFObject is designed for the client - side (browsers), not the server - side (node)
//Will choke on undefined the navigator and window vars the when the run on server
//Return a Boolean false and exit function when running server - side

If (typeof window==="undefined" | | typeof the navigator==="undefined") {return false. }

Var pdfobjectversion="2.1.1",
Ua=window. The navigator userAgent,

//declare booleans
SupportsPDFs,
IsIE,
SupportsPdfMimeType=(typeof navigator. MimeTypes [' application/PDF]!=="undefined"),
SupportsPdfActiveX,
IsModernBrowser=(function () {return (typeof window. Promise!=="undefined"); }) (),
IsFirefox=(function () {return (ua) indexOf (" irefox ")!==1); }) (),
IsFirefoxWithPDFJS=(function () {
//Firefox started shipping PDF. Js in Firefox 19.
//If this is the Firefox 19 or greater, assume the PDF. Js is
if(! IsFirefox) {return false. }
//the parse userAgent string to get the release version (" rv ")
//the ex: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; The rv: 57.0) Gecko/20100101 Firefox/57.0
Return (parseInt (ua. The split (" rv ") [1]. The split (". ") [0], 10) & gt; 18);
}) (),
IsIOS=(function () {return (/iphone | the | ipod/i.t est (ua) toLowerCase ())); }) (),

//declare functions provides
CreateAXO,
BuildFragmentString,
The log,
EmbedError,
Embed,
GetTargetElement,
GeneratePDFJSiframe,
GenerateEmbedElement;


/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Supporting functions provides
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */

CreateAXO=function (a type) {
Var ax;
Try {
Ax=new ActiveXObject (type);
} the catch (e) {
Ax=null;//ensure ax remains null
}
Return ax;
};

//IE11 still USES ActiveX for Adobe Reader, but IE 11 doesn 't expose
//the window. The ActiveXObject the same way previous versions of IE did
//the window. The ActiveXObject will evaluate to false in IE 11, but "ActiveXObject in window" evaluates to true
//so check the first one for older Internet explorer, and the second for IE11
//FWIW, MS Edge (replacing IE11) does not support ActiveX at all, both will evaluate false
//Constructed as a method (not a prop) to get unneccesarry overhead - will only be evaluated if men
IsIE=function () {return!!!!! (window. ActiveXObject | | "ActiveXObject in Windows). };

//If either ActiveX support for "AcroPDF. PDF" or "PDF. PdfCtrl" are found, return true
//Constructed as a method (not a prop) to get unneccesarry overhead - will only be evaluated if men
SupportsPdfActiveX=function () {return!!!!! (createAXO (" AcroPDF. PDF ") | | createAXO (" PDF. PdfCtrl ")); };

//Determines been PDF support is
SupportsPDFs=(
//as of iOS 12, the inline PDF rendering is still not supported in Safari or native webview
//3 rd party browsers (eg Chrome, Firefox) use Apple 's webview for rendering, and thus the same result as Safari
//Therefore if iOS, we shall assume that PDF support is not available
! IsIOS & amp; & (
//Modern versions of Firefox last come bundled with PDFJS
IsFirefoxWithPDFJS | |
//Browsers that still support the the original MIME type check
SupportsPdfMimeType | | (
//Pity the poor with souls still using IE
IsIE () & amp; & SupportsPdfActiveX ()
)
)
);

//Create a fragment identifier for using PDF Open the parameters when embedding PDF
BuildFragmentString=function (pdfParams) {

Var string=", "
Prop.

If (pdfParams) {

For (prop in pdfParams) {
If (pdfParams hasOwnProperty (prop)) {
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related