def generate_thumbnail_from_pdf(self, document):
        thumbnail_temporary, thumbnail_directory = self.get_thumbnail_path(document)
        # Creating directory for thumbnail if not exists
        if not os.path.exists(thumbnail_directory):
            os.makedirs(thumbnail_directory)
        # Storing temporary PDF file for converting
        tmp_pdf = open(thumbnail_temporary, 'w')
        tmp_pdf.write(document.get_file_obj().read())
        tmp_pdf.close()
        args = [
            'gs',
            '-q',  # Quiet
            '-dSAFER',
            '-sDEVICE=png16m',  # Type. PNG used
            '-r10',  # resolution of the thumbnail
            '-dBATCH',  # Quit GS after converting
            '-dNOPAUSE',  # Do not stop on pages
            '-dFirstPage=1',
            '-dLastPage=1',
            '-sOutputFile=%s.png' % thumbnail_temporary,  # Destination
            '%s' % thumbnail_temporary,  # Source
        ]
        ghostscript.Ghostscript(*args)
        # Deleting the temp PDF
        os.unlink(thumbnail_temporary)
Create a new server.
dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/apps/dms_plugins/workers/transfer/thumbnails.py/ThumbnailsFilesystemHandler.generate_thumbnail_from_pdf--crossover with--dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/cloudsigma.py/CloudSigma_2_0_NodeDriver.create_node