Skip to content
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

Insert table in PDF report #66

Closed
def-q opened this issue Jan 24, 2023 · 1 comment
Closed

Insert table in PDF report #66

def-q opened this issue Jan 24, 2023 · 1 comment

Comments

@def-q
Copy link

def-q commented Jan 24, 2023

Hi, I'm trying to add a table in my report template so that i can put all the findings characteristics inside. But once i try to generate the report in PDF format, I receive an error saying Pandoc died. I've tried to debug it a bit but cannot understand why it does that only to the tables.
The markdown code used is the following:


Test Nr. | Position | Radius | Rot | Grün | Blau | beste Fitness | Abweichung |
|---|---|---|---|---|---|---|---|
1 |  20 % |  20 % |  20 % |  20 % |  20 % |  7,5219 |  0,9115 |

image

Environment:


Request Method: GET
Request URL: http://localhost/report/download/pdf/1

Django Version: 3.2.15
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 "/usr/local/lib/python3.8/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.8/dist-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 985, 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', '--no-check-certificate'])
  File "/usr/local/lib/python3.8/dist-packages/pypandoc/__init__.py", line 93, in convert_text
    return _convert_input(source, format, 'string', to, extra_args=extra_args,
  File "/usr/local/lib/python3.8/dist-packages/pypandoc/__init__.py", line 420, in _convert_input
    raise RuntimeError(

Exception Type: RuntimeError at /report/download/pdf/1
Exception Value: Pandoc died with exitcode "43" during conversion: Error producing PDF.
! Missing number, treated as zero.
<to be read again> 
                   (
l.668 \begin


@1modm
Copy link
Owner

1modm commented Jan 30, 2023

Hi @def-q, I have investigate and it seems that happens when the size the table is bigger than the width of the column. The next couple of lines appear in the latex output once the above condition is triggered. The application used to generate the PDF has still an opened issue about that: jgm/pandoc#1023

If you remove 1 column appears to work:

Test Nr. | Position | Radius | Rot | Grün | Blau | beste Fitness |
|---|---|---|---|---|---|---|
1 |  20 % |  20 % |  20 % |  20 % |  20 % |  7,5219 | 

@1modm 1modm closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants