Convert Word documents to PDF Leveraging Google Drive Platform

28 February 2022
KingswaySoft Team

It is a very common business requirement that in our job we may receive documents in some particular formats, which the business team would like to have them converted into PDF files. Such requirements arise from many of the advantages when using PDF formats for file exchanges, such as portability, universal compatibility, reliability, security, size reduction, versatility, professionalism, etc. Given such common business requirement, it would be highly useful to have a tool that can pick up documents from a specific location and have them all converted to PDF files in an automated manner. Now with our KingswaySoft SSIS Productivity Pack, you could easily achieve this in an automated ETL process. The following would be the components that you can find our SSIS Productivity Pack product offering, which we will be showcasing how to achieve so.

The business scenario is, we assume that you have a process that would drop Microsoft Word document files in a local storage folder, from where our components would pick up the file and convert them into PDF files. In doing so, we will be uploading the document files to a Google Drive folder, and then use a Premium File Transfer task to download the document. At the time of the downloading, we will be requesting the files to be downloaded in PDF format. When processing the download, Google Drive platform performs an automatic document conversation (thanks to the versatile and robust documentation conversion features provided by Google Drive platform), and we leverage the Google Drive platform to achieve this conversion purpose that we just described above. Let's get started with the ETL process development

Configuration & Design

In our Google Drive Connection Manager, we have options to set the export MIME Type, as shown below, which would be pivotal for this task.

GoogleDrive Connection Manager Export types.png

As you can see above, we have chosen “Documents” to be exported as “PDF” MIME Type. While in the connection manager, we have configured it to access the service using an OAuth token file. Once we have the connection manager ready, we could create your Data Flow Task as shown below.

Data Flow task.png

The Premium File System Source component would be to read the files from the folder where the source Microsoft Word document files reside. And this in turn would give the actual binary File content column that would be used to map to the Google Drive Destination component in order to have the documents saved in Google Drive. We would add a Premium Derived Column component in between the Source and the Destination to add some additional details about the incoming documents before saving in Google Drive, such as the file name (if required - Or you could use the column "NameWithoutExtension" from the Premium File System Source component), the target or destination path, and the Mime Type. Please note that the name would need to be provided without the file extension. As you can also see, we are providing the Mime Type so that the incoming documents will be saved as the "Google Docs" type in Google Drive. 

Premium Derived Column.png

And now, the Google Drive Destination could be configured as below. In the General page, you could choose how the source documents should be written in Google Drive, and in the Columns page, we map each required field to achieve the writing.

Google Drive Destination.png

Google Drive Destination - Columns.png

Once this data flow is done, we have achieved the goal of importing the source documents into Google Drive. Now we would move out to the "Control flow" and add a Premium File Transfer Task which performs the download of just imported Google Doc files. Note that in the Premium File Transfer Task, we need to specify the source path with a ".pdf" extension. In doing so, we are requesting Google Drive to return a PDF file which matches the export MIME Type that we previously set in the Google Drive connection manager for the Documents type. Using such configuration, our software will be able to download the document as a .PDF file which is the design goal of this entire task.

Premium File Transfer Task.png

Running the flow

The Data flow task that contains the Premium File System Source, Derived column component and the Google Drive Destination component can be chained in sequence with the Premium File Transfer Task as shown below, and in order for it pick all the files from a folder, you could easily parameterize the component and implement it within an SSIS foreach loop container. More information about parameterization can be found in one of our previous blog post.

Control Flow Design.png

When the Data flow path executes, you would see that the file has been populated in the Google Drive folder path you had specified.

Google Drive Location.png

And once the Premium File Transfer Task executes successfully, you would see the file converted and landed in the target path as a PDF file.

Result PDF File.png

Conclusion

By using the above design, and by parameterizing and working with loop containers, you could easily have a package that would convert your documents to PDF format on a scheduled or automated way. This could be useful as a part of any processes or file archiving tasks that you have in your business. The design is not restricted to what we have shared below, and it can branch out as your requirement demands, and our components can be easily configured to handle them.

Archive

November 2024 3 October 2024 1 September 2024 1 August 2024 2 July 2024 1 June 2024 1 May 2024 1 April 2024 2 March 2024 2 February 2024 2 January 2024 2 December 2023 1 November 2023 1 October 2023 2 August 2023 1 July 2023 2 June 2023 1 May 2023 2 April 2023 1 March 2023 1 February 2023 1 January 2023 2 December 2022 1 November 2022 2 October 2022 2 September 2022 2 August 2022 2 July 2022 3 June 2022 2 May 2022 2 April 2022 3 March 2022 2 February 2022 1 January 2022 2 December 2021 1 October 2021 1 September 2021 2 August 2021 2 July 2021 2 June 2021 1 May 2021 1 April 2021 2 March 2021 2 February 2021 2 January 2021 2 December 2020 2 November 2020 4 October 2020 1 September 2020 3 August 2020 2 July 2020 1 June 2020 2 May 2020 1 April 2020 1 March 2020 1 February 2020 1 January 2020 1 December 2019 1 November 2019 1 October 2019 1 May 2019 1 February 2019 1 December 2018 2 November 2018 1 October 2018 4 September 2018 1 August 2018 1 July 2018 1 June 2018 3 April 2018 3 March 2018 3 February 2018 3 January 2018 2 December 2017 1 April 2017 1 March 2017 7 December 2016 1 November 2016 2 October 2016 1 September 2016 4 August 2016 1 June 2016 1 May 2016 3 April 2016 1 August 2015 1 April 2015 10 August 2014 1 July 2014 1 June 2014 2 May 2014 2 February 2014 1 January 2014 2 October 2013 1 September 2013 2 August 2013 2 June 2013 5 May 2013 2 March 2013 1 February 2013 1 January 2013 1 December 2012 2 November 2012 2 September 2012 2 July 2012 1 May 2012 3 April 2012 2 March 2012 2 January 2012 1

Tags