python - Print several documents when click button django -
my question how select several documents , print documents. example, choose 3 documents , when click print button, open in new link , documents must on 1 page. , top of page have print button. each document can unique doc_id, , sent document data in json format, wrote function print single document, don't know how open several documents on 1 page, must same?
code print single document:
def view_signed_document(request, code): params = dict() try: obj = downloadcode.objects.get(code=code) except: return render(request, 'documents/doc_not_found.html', {'code': code}) params['docs'] = docs params['pb'] = pb params['is_pdf'] = request.get.get('is_pdf', 'false') params['code'] = code params['host'] = request.scheme + "://" + request.meta["http_host"] params['url'] = settings.site_url + request.get_full_path() if obj.doc_type == invoice_type: # invoice proxy has different parameter names, therefore handle # in separate case. response = proxy.get_invoice_by_id(invoice_id=obj.doc_id, tin=obj.tin) if response.status.code != pb.responsestatus.ok: response = proxy.get_invoice_draft_by_id( invoice_draft_id=obj.doc_id, tin=obj.tin) params['invoice'] = response.invoice template = 'pdf/invoice.html' else: ref = perm.document_type_proxy[obj.doc_type] response = ref['get'](doc_id=obj.doc_id, tin=obj.tin) if response.status.code != pb.responsestatus.ok: return render(request, 'documents/doc_not_found.html', {'code': code}) params['document'] = response.document params['sign_actions'] = sum( x.permission == docs.sign x in response.document.document_actions) template = ref['print_template'] if obj.doc_type == commons_type: if response.document.internal_type == docs.commondocument.with_files: template = ref['print_files_template'] return render(request, template, params)
Comments
Post a Comment