|
48 | 48 |
|
49 | 49 | //Chromium has provided native PDF support since 2011.
|
50 | 50 | //Most modern browsers use Chromium under the hood: Google Chrome, Microsoft Edge, Opera, Brave, Vivaldi, Arc, and more.
|
| 51 | + //Chromium uses the PDFium rendering engine, which is based on Foxit's PDF rendering engine. |
| 52 | + //Note that MS Edge opts to use a different PDF rendering engine. As of 2024, Edge uses a version of Adobe's Reader |
51 | 53 | let isChromium = (win.chrome !== undefined);
|
52 | 54 |
|
53 | 55 | //Safari on macOS has provided native PDF support since 2009.
|
|
64 | 66 | /*
|
65 | 67 | Special handling for Internet Explorer 11.
|
66 | 68 | Check for ActiveX support, then whether "AcroPDF.PDF" or "PDF.PdfCtrl" are valid.
|
67 |
| - IE11 uses ActiveX for Adobe Reader and other PDF plugins, but window.ActiveXObject will evaluate to false. ("ActiveXObject" in window) evaluates to true. |
| 69 | + IE11 uses ActiveX for Adobe Reader and other PDF plugins, but window.ActiveXObject will evaluate to false. |
| 70 | + ("ActiveXObject" in window) evaluates to true. |
68 | 71 | MS Edge does not support ActiveX so this test will evaluate false for MS Edge.
|
69 | 72 | */
|
70 | 73 | let validateAX = function (type){
|
|
109 | 112 | let string = "";
|
110 | 113 | let prop;
|
111 | 114 | let paramArray = [];
|
112 |
| - |
| 115 | + let fdf = ""; |
| 116 | + |
113 | 117 | //The comment, viewrect, and highlight parameters require page to be set first.
|
114 | 118 |
|
115 | 119 | //Check to ensure page is used if comment, viewrect, or highlight are specified
|
|
133 | 137 | delete pdfParams.page;
|
134 | 138 | }
|
135 | 139 |
|
| 140 | + //FDF needs to be the last parameter in the string |
| 141 | + if(pdfParams.fdf){ |
| 142 | + fdf = pdfParams.fdf; |
| 143 | + delete pdfParams.fdf; |
| 144 | + } |
| 145 | + |
| 146 | + //Add all other parameters, as needed |
136 | 147 | if(pdfParams){
|
137 | 148 |
|
138 | 149 | for (prop in pdfParams) {
|
139 | 150 | if (pdfParams.hasOwnProperty(prop)) {
|
140 | 151 | paramArray.push(encodeURIComponent(prop) + "=" + encodeURIComponent(pdfParams[prop]));
|
141 | 152 | }
|
142 |
| - } |
| 153 | + } |
| 154 | + |
| 155 | + //Add fdf as the last parameter, if needed |
| 156 | + if(fdf){ |
| 157 | + paramArray.push("fdf=" + encodeURIComponent(fdf)); |
| 158 | + } |
143 | 159 |
|
| 160 | + //Join all parameters in the array into a string |
144 | 161 | string = paramArray.join("&");
|
145 | 162 |
|
146 |
| - //The string will be empty if no PDF Params found |
| 163 | + //The string will be empty if no PDF Parameters were provided |
| 164 | + //Only prepend the hash if the string is not empty |
147 | 165 | if(string){
|
148 | 166 | string = "#" + string;
|
149 | 167 | }
|
|
0 commit comments