I would like to build a button which would send a batch of files to the printer when clicked (It can prompt the user. Doesn't need to go to the printer without approval). The files would exist in a SharePoint library.

An Example of the situation:

Document A (.docx), Document B (.docx), and Document C (.xlsx) need to be printed weekly. There need to be 5 copies of Documents A and C, and 10 copies of B. When printed they need to be ordered (Bottom of pile to top of pile) as

  1. 5 Copies of Document A
  2. 10 Copies of Document B
  3. 5 Copies of Document C

Is there a way to print these as is, or possibly a way to convert the files to .pdf and use Print.js?

  • What exactly do you want? If you know how to use print.js in JavaScript, so is your question how to do it in SPFx? You can easily import and use all JS-Libraries in SPFx. In the config file you specifiy the externals "externals": "printjs": { "path": "/externalLibraries/print.min.js", "globalName": "printjs"} and in the tsx file you import this libraries as following import * as printjs from 'printjs'; – Oskar Apr 16 '18 at 14:10
  • From what I'm seeing, Print.js needs the format to be html or .pdf for the file. Under this assumption, I would need an alternative option or to know how to convert the files to .pdf. – vanblart Apr 16 '18 at 14:22
  • 1
    Here you go: github.com/MrRio/jsPDF – Oskar Apr 16 '18 at 14:28
  • 1
    Its possible to convert most MS-files (word etc) to PDF from a users OneDrive with the graph api. Guess you could look into if its possible with files in SP libraries too. Or some solution where you temp copying the files into the onedrive and convert them etc. – Anders Aune Apr 17 '18 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.