def dump_mail(files=None, plus_dest_types=[], dest_typ=None): merge = request.args.get('merge', '0') == '1' return_errors = request.args.get('errors', '0') == '1' parts = _dump_mail(files, [best_dest_type()], return_errors=return_errors) return (pack_files(((x[2], x[0]) for x in parts), fmt='zip') if not merge else pdf.merge_pdf(x[0] for x in parts if x[1] == 'application/pdf'))
def pdf_split(): stor = request_files().next() LOG.debug('pdf_split(%s)' % stor) return send_file( pack_files( (('%03d.pdf' % i, page) for i, page in enumerate(pdf.split_pdf(stor.stream))), fmt='zip'), mimetype='application/zip', as_attachment=True, attachment_filename=stor.name)