Mass PDF document export

Hello everyone!

I am wondering if it would be possible to download all PDF files within a database?

We currently run a database that has hundreds of PDF files with in the database, rather than downloading each PDF file, line by line, is there a way to mass download all PDF files within a database?

Thanks in advance Knackers!

I made smth simillar but not downloading the files. Upload them in google drive. I use make to do it. Or you can write a js function to download them instantly from your browser.
If you need further explanation let me know.

I agree with @Andreas

I would use Make to download the PDF files from Knack and upload them into a web folder on another platform such as Google Drive, Dropbox, Box etc.

To the best of my knowledge, there isn’t a way of bulk downloading the PDF files to your local device.

If you’ve not used Make before the process for accomplishing this is beyond a forum post explanation., in my opinion :laughing:

If you’re comfortable with Make then you’ll need to use a Knack search module to find the PDF records then download the files with an HTTP module using the PDF URL. You will then be able to upload the files to a folder in Google Drive / Dropbox

If you have the Google Drive/ Dropbox folders synced to your local device then they will theoretically be available on your PC as well as in the cloud.

If this is something you just need to do as a one-off, you can easily download all of the files associated with an object using this python code in a Google Colab file. You’ll need to update the variables in the “set variables” section and you’ll need a folder in your Google Drive called “Downloads” for the downloaded file to land in at the end. (You can change that by changing the last line.)

#set variables
outdir =  'SomeFolderForStoringTheFiles' #this is where you want to download to
myObject = 'your knack object e.g. object_10' #this is the object that stores the files
myField = 'your field in the above object that stores the files e.g. field_79' #this is the field that stores the files
myAppID = 'your application id from your knack app'
myAppKey = 'your application key from your knack app'

#install knackpy
!pip install knackpy
import knackpy

#import google drive connector
from google.colab import drive

#mount the google drive
drive.mount('/content/drive')


#generate your application
app = knackpy.App(app_id=myAppID , api_key=myAppKey)

#download the files locally to colab
app.download(
    container=myObject,
     field=myField, 
     out_dir=outdir,
     label_keys=["id"]
 )

#also generate a spreadsheet for connecting photos to descriptions
app.to_csv(myObject, out_dir=outdir)

#move all of the content from Colab to Google Drive
mvdir = '/content/' + outdir
!mv $mvdir "/content/drive/MyDrive/Downloads"
3 Likes