Pdfs
hypha.apply.utils.pdfs
¶
STYLES
module-attribute
¶
STYLES = {'Question': ParagraphStyle(fontName='MontserratBold', fontSize=14, name='Question', spaceAfter=0, spaceBefore=18, leading=21), 'QuestionSmall': ParagraphStyle(fontName='MontserratBold', fontSize=12, name='QuestionSmall', spaceAfter=0, spaceBefore=16, leading=18), 'Normal': ParagraphStyle(fontName='NotoSans', name='Normal'), 'Heading1': ParagraphStyle(fontName='NotoSansBold', fontSize=12, name='Heading1', spaceAfter=4, spaceBefore=12, leading=18), 'Heading2': ParagraphStyle(fontName='NotoSansBold', fontSize=10, name='Heading2', spaceAfter=4, spaceBefore=10, leading=15), 'Heading3': ParagraphStyle(fontName='NotoSansBold', fontSize=10, name='Heading3', spaceAfter=4, spaceBefore=10, leading=15), 'Heading4': ParagraphStyle(fontName='NotoSansBold', fontSize=10, name='Heading4', spaceAfter=4, spaceBefore=10, leading=15), 'Heading5': ParagraphStyle(fontName='NotoSansBold', fontSize=10, name='Heading5', spaceAfter=4, spaceBefore=10, leading=15)}
ReportDocTemplate
¶
Bases: BaseDocTemplate
build
¶
build(flowables, onFirstPage=do_nothing, onLaterPages=do_nothing)
Source code in hypha/apply/utils/pdfs.py
font
¶
prepare_fonts
¶
Source code in hypha/apply/utils/pdfs.py
do_nothing
¶
make_pdf
¶
Source code in hypha/apply/utils/pdfs.py
split_text
¶
draw_header
¶
Source code in hypha/apply/utils/pdfs.py
draw_title_block
¶
Source code in hypha/apply/utils/pdfs.py
handle_block
¶
Source code in hypha/apply/utils/pdfs.py
draw_submission_content
¶
Source code in hypha/apply/utils/pdfs.py
draw_project_content
¶
Source code in hypha/apply/utils/pdfs.py
html_to_pdf
¶
Convert HTML to PDF.
Parameters:
-
html_body
(str
) –The body of the html as string
Returns:
-
BytesIO
(BytesIO
) –PDF file
Source code in hypha/apply/utils/pdfs.py
merge_pdf
¶
Given two PDFs, merge them together.
Parameters:
-
origin_pdf
(BytesIO
) –a file-like object containing a PDF
-
input_pdf
(BytesIO
) –a file-like object containing a PDF
Returns:
-
File
–Return a File object containing the merged PDF and with the same name as the
-
File
–original PDF.