Convert SharePoint List to PDF

In this guide you’ll learn how to convert a SharePoint List to PDF in SharePoint. You can use an existing Tasks list for this or you can create one (Sales Task List) by navigating to your SharePoint site and adding a ‘Tasks’ app.

Please keep in mind that if you use the list’s default view, the PDF file generated will also have all the SharePoint User Interface’s Quick Launch menu as well. If you would like to have the list without the Quick Launch menu, we recommend creating a page that displays all items in the list with as little of the SharePoint User Interface around it as possible.

Create a New Page Without the Quick Launch Menu:

To create a new page without the quick launch menu, perform the following steps:

  1. Navigate to the site where you want to add the page. Click Site Contents and navigate to the Pages folder. Click New \Web Part Page.

  2. Enter a name for the page (SalesTaskList) and select ‘Full Page, Vertical layout’. Select the Document Library to which this page has to be saved, and click Create button.

  3. Click Add a Web Part, and select the list (Sales Task List) you want to display in this page. Select Add part to ‘Full Page’ and click Add button.

  4. Click the newly inserted Web Part’s Edit button and select Modify Shared Web Part option.

  5. Click Edit the current View and select the columns you want to be included in the PDF file. For example % Complete, Due Date, Start Date and Task Status.

  6. Under the Item Limit section set the limit to an appropriately large number. This will ensure all items are included in the PDF file without paging.

  7. Click OK to save the changes, and click Stop Editing button.

  8. Save the page’s URL as we need it later. E.g. SalesTaskList http://gbsavdws106/sites/Demo2019/SitePages/SalesTaskList.aspx

This new page will be used as the underlying layout of the PDF document. Feel free to modify it further in SharePoint designer / JQuery and remove more parts of the SharePoint user interface. You could also consider creating a minimalistic master page and applying that to the new PDFTasks page.

save page url

Setup Automatic PDF Conversion Using SharePoint Designer Workflow

In this example, you will generate a PDF file whenever the Tasks list is modified. The generated PDF file is stored in the Shared Documents library. You can create the workflow as follows:

  1. Make sure you have the appropriate privileges to create workflows on a site collection.

  2. Create a new workflow using SharePoint Designer.

  3. On the Workflow definition screen, associate the workflow with the Tasks list, tick the boxes next to both ‘Automatically start’ options, and proceed to the next screen.

  4. Add ‘Convert HTML to PDF’ action and click ‘this url’ and enter the URL to the page that was created in the previous step.
    e.g. http://gbsavdws106/sites/Demo2019/SitePages/SalesTaskList.aspx

  5. Click ‘this file’ and enter the path and file name where the PDF file will be generated, e.g. Shared Documents/Tasks.pdf.

  6. Optionally, change the generated page’s orientation from Portrait to Landscape.

  7. The username and password are optional. By default, the credentials that the Muhimbi Conversion Service runs under will be used to open the web page. You can leave it empty.

  8. Click the Publish button to deploy and activate the workflow.

publish workflow button

You can enter one or more tasks to test. You will observe that every time a task is added or updated a PDF file is written to the Shared Documents/Tasks.pdf location. You can open the PDF file to check the results.

convert sharepoint url to pdf

In summary, this HTML conversion capability (available in newer versions) opens up many possibilities. As always, upgrades are completely free, so please upgrade and use all the available features.

Convert List Item Including All Attachments to PDF

The PDF Converter for SharePoint On-Premises provides first-class support for converting (and/or merging) files stored in Document or Form Libraries. However, if you want to convert a list item, including all attachments, into a single PDF, then you have to do a little work.

The key to combining the list item and attachments in PDF Converter is the Merge Workflow Activity, which accepts a mix of URLs (to convert the HTML of the List Item View to PDF) and paths to attachments. For example, the following two lines convert the list item and an attachment.

http://SomeWebApp/sites/SomeSiteCollection/Lists/SomeList/DispForm.aspx?ID=3

/sites/SomeSiteCollection/Lists/SomeList/Attachments/3/somefile.xxx

It is pretty simple to generate the fully qualified URL to the List Item, which is just a matter of requesting the current item’s ID and concatenating it to the URL of the list's DispForm.aspx. However, retrieving the URLs to the attachments is a different matter as they all go into a generic 'attachments bin' for which file names cannot be queried from a SharePoint Designer workflow.

You have several options to overcome this challenge of querying the list attachments. Some of these are given below for your reference:

  1. Use JavaScript

  2. Use Nintex Workflow to extract the attachment paths. Our software ships with Nintex Workflow compatible workflow activities. For more information, refer to How can I use the PDF Converter in combination with Nintex workflow?. For more information on how to retrieve list of attachments, refer to Practical Nintex Forms to PDF Conversion using the PDF Converter for SharePoint (muhimbi.com)
    Note: You need version 7.2.1 of the PDF Converter, or newer, to merge List Item attachments.

If none of the above options suit your particular scenario, you can always use our API from your own custom code. For details about merging files from your own code refer to How can I merge files from my own source code? – Muhimbi

Additional Resources

Knowledge Base Articles

Blog Articles

Have a Question?
We’re Always Happy to Help.

© Muhimbi Ltd. 2008 - 2024
This website uses cookies to ensure you get the best experience. Learn more