-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdf opens in word web app
536 lines (300 loc) · 18.4 KB
/
pdf opens in word web app
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
in libraries the pdf open on word web app because it is stablished on office web apps server..
###########################################################################################################
http://bliblablog.net/opening-pdf-documents-sharepoint-2013-word-web-app-vs-default-pdf-reader/
this solution only removes an action so search and pdf preview on search still works, important to read it...
Opening PDF documents in SharePoint 2013 (Word Web App vs. default PDF reader)
BY MARKUS · DECEMBER 3, 2014
When using OWA (Office Web Apps) in SharePoint 2013 along with PDF Previews in the Search Result, PDF documents will always open in Word Web App.
Implementation
When implementing OWA (Office Web Apps) for SharePoint 2013, you will get the very useful feature of pre-viewing, opening and even editing Office documents in the Web Browser.
There are several good articles around the web covering installation and configuration, e.g.
Office Web Apps 2013 Server Install and Configuration
Configure Office Web Apps for SharePoint 2013
After the OWA implementation, you could even offer pre-views of PDF documents within SharePoint Search (which provides this feature only for Office documents by default).
Here is one article covering that topic:
SharePoint 2013: Enabling PDF Previews with Office Web Apps 2013 March 2013 update
Problem
This configuration leads to the issue, that PDF documents anywhere in SharePoint will always open in “Word Web App”.
The following article describes how to change that behaviour:
Control whether PDFs open in Word Web App or the default PDF reader
If you would follow the steps and remove the binding by executing the following PowerShell command:
Get-SPWOPIBinding –Application "WordPDF" | Remove-SPWOPIBinding -Confirm:$false
1
Get-SPWOPIBinding –Application "WordPDF" | Remove-SPWOPIBinding -Confirm:$false
you end up in the situation, where PDF documents will always open in the default PDF reader (which is OK) but also the preview for PDF documents not working anymore (which is kind of sad).
The following bindings will get removed by that command:
Application : WordPdf
Extension : PDF
ProgId :
Action : view
IsDefaultAction : True
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
Application : WordPdf
Extension : PDF
ProgId :
Action : imagepreview
IsDefaultAction : False
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
Application : WordPdf
Extension : PDF
ProgId :
Action : interactivepreview
IsDefaultAction : False
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
Application : WordPdf
Extension : PDF
ProgId :
Action : embedview
IsDefaultAction : False
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
Approach
One approach could be the following:
Only remove the following binding:
Application : WordPdf
Extension : PDF
ProgId :
Action : view
IsDefaultAction : True
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Application : WordPdf
Extension : PDF
ProgId :
Action : view
IsDefaultAction : True
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
Application : WordPdf
Extension : PDF
ProgId :
Action : imagepreview
IsDefaultAction : False
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
Application : WordPdf
Extension : PDF
ProgId :
Action : interactivepreview
IsDefaultAction : False
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
Application : WordPdf
Extension : PDF
ProgId :
Action : embedview
IsDefaultAction : False
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
Approach
One approach could be the following:
Only remove the following binding:
Application : WordPdf
Extension : PDF
ProgId :
Action : view
IsDefaultAction : True
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
Approach
One approach could be the following.
Only remove the following binding:
Application : WordPdf
Extension : PDF
ProgId :
Action : view
IsDefaultAction : True
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
1
2
3
4
5
6
7
Application : WordPdf
Extension : PDF
ProgId :
Action : view
IsDefaultAction : True
ServerName : OWAServer.Domain.COM
WopiZone : internal-http
by running
Get-SPWOPIBinding -Application "WordPDF" -Action "View" | Remove-SPWOPIBinding
1
Get-SPWOPIBinding -Application "WordPDF" -Action "View" | Remove-SPWOPIBinding
After that, PDF document will be opened on the default PDF reader, the preview of PDF docments will work, but: as soon as you click on the linf for the document, you will end-up in an error message:
Sorry, something went wrong
ULS log output:
SharePoint Foundation WOPI ah6ud Unexpected Exiting GetWOPITargetInternal Early – GenerateWacUrl failed to produce a URL/actionEntry for file file.pdf with extension ‘PDF’ StackTrace: at Microsoft.SharePoint.Utilities.SPWOPIHost.GetWOPITargetInternal(HttpContext httpContext, SPWeb web, Object& spPrimeObject, SPWOPIAction& requestedAction, SPRegionalSettings spSettings, String& wopiAppUrl, String& wopiFavIconUrl, String& wopiAccessToken, Int64& wopiAccessTokenTtl, String& errorMessageToDisplay, String& redirectUrl) at Microsoft.SharePoint.ApplicationPages.WOPIFrameHelper.OnLoadHelper(WOPIFrame frame) at Microsoft.SharePoint.ApplicationPages.WOPIFrameHelper.OnLoad(WOPIFrame frame) at System.Web.UI.Control.Lo… 6624d29c-fce6-c0b2-e30c-5ddf138f8241
SharePoint Foundation WOPI ah6ud Unexpected …adRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.HttpContext.InvokeCancellableCallback(WaitCallback callback, Object state) at System.Web.UI.Page.LegacyAsyncPageBeginProcessRequest(HttpContext context, AsyncCallback callback, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.B…
SharePoint Foundation WOPI ah6ud Unexpected …eginProcessRequestNotification(HttpContext context, AsyncCallback cb) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus) at System.Web.Hosting.PipelineRuntime…
SharePoint Foundation WOPI ah6ud Unexpected ….ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) 6624d29c-fce6-c0b2-e30c-5ddf138f8241
This is because the binding for WordPdf has not default action defined anymore (you deleted the default action “view” in the previous step).
Therefore, define another default action by running the following PowerShell command:
Get-SPWOPIBinding -Action "embedview" -Application "WordPdf"| Set-SPWOPIBinding -DefaultAction
1
Get-SPWOPIBinding -Action "embedview" -Application "WordPdf"| Set-SPWOPIBinding -DefaultAction
I chose “embedview” as “view” is not an option anymore.
After that, your PDF documents will be opened in the default PDF reader, the preview works and Word Web App will present the PDF documents in the “embedview”.
##################################
https://codtron.wordpress.com/2016/01/20/sharepoint-2013-open-pdf-in-default-pdf-reader-instead-of-office-web-apps/
When users open a PDF file from a SharePoint document library that uses Office Web Apps Server, the default behavior is to open the PDF in Word Web App. If this isn’t the behavior you want, or if your users are having trouble opening PDFs on smartphones, you can use Windows PowerShell commands to make PDFs open in your default PDF reader instead. Here’s how:
Choose (right-click) SharePoint 2013 Management Shell to display the shortcut menu.
From the shortcut menu, choose Run as administrator.
To remove the binding altogether so that PDFs open in the default PDF viewer on all devices, use the following:
Get-SPWOPIBinding –Application “WordPDF” | Remove-SPWOPIBinding -Confirm:$false
Reverse behavior:
you change your mind and later want to have PDFs open in Word Web App again, follow the same procedure as above, but in Step 2, run these two commands:
Get-SPWOPIBinding –Application “WordPDF” | Remove-SPWOPIBinding -Confirm:$false
New-SPWOPIBinding –ServerName “owa1.servername.gov” –Application “WordPDF” -AllowHTTP
#################################################################################################
http://stevemannspath.blogspot.com.es/2013/04/sharepoint-2013-pdf-support-and.html
SharePoint 2013: PDF Support and Behaviors - The Whole Story
Check out the whole SharePoint 2013 Solution Series
New Titles Added Weekly!
EXECUTIVE SUMMARY
SharePoint 2013 supports PDF documents out-of-the-box. Initially, web applications do not allow opening PDFs in the browser, however, by adding PDF as an allowed MIME type, browser rendering via Adobe is achieved.
Office Web Apps server provides Office document previews and rendering in Search results without the need for client applications installed (e.g. Word, Excel, etc.). However, once SharePoint is bound to Office Web Apps, PDF documents no longer open in the browser.
There are two workarounds –
1) Configure PDF items to render as Word Items which allows PDFs to open and preview in Search within Office Web Apps
2) Modify the PDF Item display template which allows PDFs to render in the browser via Adobe. Modify the PDF hover template to display previews.
These workarounds take care of Search, but PDFs will still open in the client application (e.g. Adobe) from Document Libraries. The solution here is an update to Office Web Apps. The February/March 2013 Update to Office Web Apps server supports opening PDFs from document libraries within Office Web Apps.
The following table summarizes the various PDF rendering and preview behaviors:
Search PDF Preview
Search Open (clicking on result)
Document Library Open (clicking on Document)
Out of the Box (Strict Web App)
Available by modifying the Display Template
Opens in Adobe or associated client application
Opens in Adobe or associated client application
Out of the Box
(Permissive Web App or Allowed Mime Type of PDF)
Available by modifying the Display Template
Opens in web browser and search term is passed into Adobe
Web Browser
Office Web Apps Server
(October 2012 Release)
Two options:
1. Display template (shows in Adobe web)
2. Modify Result Type to use Word Item (shows in Word App Web)
Opens in Adobe or associated client application.
Opens in Browser with modification of display template
Opens in Adobe or associated client application.
Office Web Apps Server (Feb/Mar 2013 Update)
Two options:
1. Display template (shows in Adobe web)
2. Modify Result Type to use Word Item (shows in Word App Web)
Opens in browser using Word Web App
Can use templates to display in Adobe Web.
Opens in browser using Word Web App
If not bound to WordPDF – Opens in Adobe or associated client application.
It is also worth mentioning that if Office Web Apps is not used for Search results of PDFs, the opening of PDFs in the browser passes the search terms into Adobe and thus finds the occurrences within the document. An example of this “search term pass-through” is displayed below:
Based on my investigations and modifications, when using Office Web Apps server with SharePoint, there are two overall options when handling PDFs. One provides a more consistent user experience and the other provides the most functionality. These options are outline below:
Most Consistent User Experience
The most consistent user experience would be to use Office Web Apps server (with the update) to enable opening of PDFs from libraries in the browser and to modify the search result type to render PDFs as Word Items which enables both preview and opening of the documents from Search results within Office Web Apps.
Most Functionality
The option that provides the most functionality is to use Office Web Apps for document libraries such that PDFs are opened within the browser but then use customized search templates to preview and open PDFs from Search results thus providing the search term pass-through functionality as described above. For the most consistent preview, use a customized copy of the Word item hover panel template (explained in the last section of this post).
The rest of this post steps through the details and explains how to accomplish the various options and behaviors.
OUT-OF-THE-BOX BEHAVIOR (without Office Web Apps)
Web Applications are created with the Browser File Handling option set to Strict. This means that only the default allowed MIME types (correlates to document types such Word, PDF, etc.) can open and display within the browser without prompting the user to Open or Save the document. PDF is not one of those default MIME types and thus, the user is prompted when attempting to open a PDF document:
The recommended way to enable PDFs to be opened in the browser is to add the MIME type to the allowed list of types by using PowerShell commands:
$webApplication = Get-SPWebApplication "http:/yourwebapplicationurl"
$webAppApplication.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
$webApplication.Update()
Source: http://social.technet.microsoft.com/wiki/contents/articles/8073.sharepoint-2010-and-2013-browser-file-handling-deep-dive.aspx#DownloadFunctions
The other easy option, which is not recommended, is to modify your web application (via Central Admin) and change the Browser File Handling property to Permissive:
Either method will allow PDF files to be opened in the browser. A neat experience in search results is that the search term is passed into Adobe and the terms are highlighted in the document:
To get a PDF preview in the search results, you may follow my original idea and post.
OFFICE WEB APPS (October 2012 Release Version)
Once Office Web Apps is installed and configured, by surprise, PDF documents are no longer opening in the browser. Neither from document libraries nor from the search results. So there two options at this point (at least for the search results).
1. Follow Wictor Wilen's post to use the Word Item template for PDFs. This method both shows a preview and opens up PDF search results in the Office Web App's Word App Viewer.
2. Use my original method for creating a PDF Preview to generate the preview.
Follow these steps to allow opening of the PDF document in the browser via Adobe (maintaining the search term pass-through functionality:
Modify the Item_PDF.html in the display templates folder.
Replace this line:
ctx.CurrentItem.csr_OpenControl = "PdfFile.OpenDocuments";
With this one:
ctx.CurrentItem.csr_OpenApp = "word";
Problems solved, right? At this point the search is fixed but PDFs don't open from document libraries in the browser. That's where the Office Web Apps Update comes in to play!
OFFICE WEB APPS PUBLIC UPDATE (Feb/Mar 2013)
There was a cumulative and public update released in early March 2013 that adds additional support for PDFs in SharePoint 2013 using Office Web Apps server. What does this do for us??
The update adds a new application type named WordPDF. It allows PDFs to be opened from document libraries in the browser using the Word App Viewer. What about search?
For search, there is no change. You either need to copy the PDF Result Type and configure it to use the Word Item or modify the search display templates. (Same options as above).
However, I have come up with a hybrid approach that provides a consistent preview using the Word App Viewer but also provides the rendering of PDFs in the browser through Adobe with the search term pass-through!
Open SharePoint Designer and navigate to the search display templates (similar to the steps here).
Find Item_PDF.html. Right-click and select Copy:
Right-click again and select Paste:
This process creates a copy of the file which appears at the bottom of the list. Find the copy and rename to something different (such as Item_PDFCustom.html):
Right-click the new file and select Edit File in Advanced Mode:
Rename the title:
Change the hoverURL:
Replace this line:
ctx.CurrentItem.csr_OpenControl = "PdfFile.OpenDocuments";
With this one:
ctx.CurrentItem.csr_OpenApp = "word";
Save the file. This handles the opening of the PDF document in the browser. Now for the preview.
Locate Item_Word_HoverPanel.html. Right-click and select copy:
Right-click and select Paste:
Rename the copied file (should be the same name you used for the hoverUrl value):
Right-click the new file and select Edit File in Advanced Mode:
Change the title:
Save the changes! Onto the Search Center!
In your Search Center, select Site Settings from the Settings menu (gear).
Under Site Collection Administration, click on Search Result Types:
Scroll down and find the PDF entry. Select Copy from the drop-down menu:
Give the type a unique name and select the PDF Customized Item as the display template:
Click Save.
Now, the search results display previews using Office Web Apps:
And the documents open in Adobe with the search term pass-through:
CONCLUSION
There are various options and behaviors when handling PDFs in SharePoint 2013. Using Office Web Apps server somewhat forces you down a customized search experience path. The easiest and most consistent option is to have Office Web Apps handle all PDF interactions via the Word App Viewer. Providing the search term pass-through is another option but requires display template modification as explained in this post. I hope this post provided insight into this topic.