Web applications that manage user data, commonly allow their users to upload such data as PDF documents. A common UI practice employed by such services is to show a thumbnail of the PDF cover letter for quick identification, and thumbnails of the different PDF pages for fast access.

Using Cloudinary, you can accomplish such tasks with ease.

In this blog post we wanted to showcase some of Cloudinary’s powerful PDF (and multi-page TIFF) management capabilities.





Uploading PDF files

From a website’s perspective, PDF assets share many usability characteristics as regular image files, and so we treat them quite the same as images. You can simply use our standard upload API for uploading PDF files.





Ruby on Rails:

Copy to clipboard Cloudinary :: Uploader .upload( " SinglePageSample.pdf " , :public_id => " single_page_pdf " )

Python:

Copy to clipboard cloudinary.uploader.upload( " SinglePageSample.pdf " , public_id = ' single_page_pdf ' )

Node.js:

Copy to clipboard cloudinary.uploader.upload( " SinglePageSample.pdf " , function (result) { }, { public_id : ' single_page_pdf ' })

PHP:

Copy to clipboard \ Cloudinary \ Uploader ::upload( " SinglePageSample.pdf " , " public_id " => ' single_page_pdf ' )

The uploaded PDF is available for downloading as-is through a fast CDN:





This means that if you allow your users to upload images in multiple formats, they could also upload PDFs.





Generating PDF thumbnails

To generate images and thumbnails from your PDF file, you can simply use Cloudinary’s resize and crop transformations, as you would for regular images.





For example, the following URL converts a PDF into a PNG image, as a 200x250 pixels thumbnail:



