-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error 500 when generating pdf report #47
Comments
Hi @ky0112, I was taking a look into this issue, and unfortunately the issue is generated by libpng and pandoc (the tools used to convert the images and create the reports). My only suggestion is to try some workarounds like use jpg instead of png to see if this error is not generated, or use the media file storage option (instead of storage in DB) to see if works. For that you need to set https://1modm.github.io/petereport/configuration/#markdown-configuration Thanks |
Hi 1modm, After setting 'martor_upload_method': 'MEDIA' and 'debug': True in app/config/petereport_config.py it get another error. Following is the traceback `Environment: Request Method: GET Django Version: 3.2.5 Traceback (most recent call last): Exception Type: RuntimeError at /report/download/pdf/2 Thanks |
@ky0112 try to install pandoc > 2.10, for example:
|
@1modm it works Thank you |
When generating large PDF report with a lot of base 64 image in it, it will hit error 500 during the generating pdf report process.
Here is the debug log
Traceback:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/report/download/pdf/7
Django Version: 3.2.5
Python Version: 3.8.10
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'martor',
'django_bleach',
'preport']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/home/admin123/.local/share/virtualenvs/petereport-_1hU1HQ3/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/admin123/.local/share/virtualenvs/petereport-_1hU1HQ3/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/admin123/.local/share/virtualenvs/petereport-_1hU1HQ3/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/opt/petereport/app/preport/views.py", line 941, in reportdownloadpdf
output_pypandoc = pypandoc.convert_text(final_markdown_output, to='pdf', outputfile=pdf_file_output, format='md', extra_args=['-H', PDF_HEADER_FILE, '--from', 'markdown+yaml_metadata_block+raw_html', '--template', PETEREPORT_LATEX_FILE, '--table-of-contents', '--toc-depth', '4', '--number-sections', '--highlight-style', 'breezedark', '--filter', 'pandoc-latex-environment', '--listings'])
File "/home/admin123/.local/share/virtualenvs/petereport-_1hU1HQ3/lib/python3.8/site-packages/pypandoc/init.py", line 100, in convert_text
return _convert_input(source, format, 'string', to, extra_args=extra_args,
File "/home/admin123/.local/share/virtualenvs/petereport-_1hU1HQ3/lib/python3.8/site-packages/pypandoc/init.py", line 321, in _convert_input
raise RuntimeError(
Exception Type: RuntimeError at /report/download/pdf/7
Exception Value: Pandoc died with exitcode "43" during conversion: b'libpng error: IDAT: invalid stored block lengths\nlibpng error: IDAT: invalid stored block lengths\nlibpng error: IDAT: invalid stored block lengths\nError producing PDF.\n!pdfTeX error: pdflatex: libpng: internal error\n ==> Fatal error occurred, no output PDF file produced!\n\n'
Thanks
The text was updated successfully, but these errors were encountered: