Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am working on print functionality. I am printing the PDF files (uploaded in SharePoint Library) using Adobe Reader command line from javascript. I am using ActiveX object to call the cmd. refer below code I am using.

var wsh = new ActiveXObject('wscript.shell');
        if (wsh) {
            command = 'cmd /k ' + wsh.expandenvironmentstrings("start AcroRd32.exe /t " + char34 + "\\\\<server>@<port>\\DavWWWRoot\\<LibraryName>\\<FileName>.pdf" + char34");
            wsh.run(command, 0)
        }
  • As soon as javascript is calling the "wsh.run(command, 0)" command, adobe Reader is trying to open the document. but as the document is in SharePoint document library so it is asking for "checkout/open","Open" or "cancel". If user will not select the "checkout/open","Open" then print process will not be started.
  • Now I want a solution to open the document without that CheckOut popup. Because the requirement is "User can select multiple document at a time to print in bulk." so every time we can not force the user to open or checkout the document.
  • And why user should select open or checkout because print is given not for opening.
  • BTW, How can I skip the popup for silent printing?
  • This problem is happening only with PDF files the other type of files are working fine (not asking for Checkout).
    Please help. Thanks.
share|improve this question

1 Answer 1

Ensure that you have completed the following steps. Once completed, the default functionality should be open as opposed to the check-out / open dialog.

  • Go to http://www.adobe.com/misc/linking.html
  • Download PDF small icon (17 x 17)
  • Save it to your 14 root template images folder (typically located here: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES)
  • Edit DocIcon.xml under your 14 root template XML folder (typically located here: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML folder) Add <Mapping Key="pdf" Value="pdficon_small.gif" OpenControl="" /> under the <ByExtension> section. Ensure that Value='pdficon_small.gif matches the name of the icon that you saved to the images folder in the previous step.

Then you need to add PDFs to your 'Allowed Inline Mimetypes' list via the following PowerShell command (change the WebAppUrl and run it on your WFEs)

$webApp = Get-SPWebApplication http://yourWebAppUrl
If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains "application/pdf")
{
  Write-Host -ForegroundColor White "Adding Pdf MIME Type..."
  $webApp.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
  $webApp.Update()
  Write-Host -ForegroundColor White "Added and saved."
} Else {
  Write-Host -ForegroundColor White "Pdf MIME type is already added."
}
share|improve this answer
    
OpenControl="" in the Mapping node of the DocIcon.xml file is crucial. –  James Grizzle May 8 '13 at 14:25
    
Thanks for quick reply. I found that the PDF MIME (application/pdf) for the web application is already added. Please note: Only in print functionality I don't want "CheckOut/Open". –  MAK May 8 '13 at 14:33
    
If the window that comes up is focused, can you do something like wsh.SendKeys to just hit the enter (or tab then enter)? I'm not sure how to help you using shell commands. –  James Grizzle May 8 '13 at 20:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.