Bump PyPDF to version 2 (#2755)

This commit is contained in:
Raphael Michel
2022-08-05 09:53:32 +02:00
committed by GitHub
parent 9ae25caf5c
commit 50ebda332a
9 changed files with 44 additions and 44 deletions

View File

@@ -39,8 +39,8 @@ from django.utils.crypto import get_random_string
from django.utils.timezone import now
from django.utils.translation import gettext as _
from django.views.generic import TemplateView
from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.utils import PdfReadError
from PyPDF2 import PdfReader, PdfWriter
from PyPDF2.errors import PdfReadError
from reportlab.lib.units import mm
from pretix.base.i18n import language
@@ -153,9 +153,9 @@ class BaseEditorView(EventPermissionRequiredMixin, TemplateView):
def post(self, request, *args, **kwargs):
if "emptybackground" in request.POST:
p = PdfFileWriter()
p = PdfWriter()
try:
p.addBlankPage(
p.add_blank_page(
width=float(request.POST.get('width')) * mm,
height=float(request.POST.get('height')) * mm,
)
@@ -203,7 +203,7 @@ class BaseEditorView(EventPermissionRequiredMixin, TemplateView):
try:
bg_bytes = c.file.read()
PdfFileReader(BytesIO(bg_bytes), strict=False)
PdfReader(BytesIO(bg_bytes), strict=False)
except PdfReadError as e:
return JsonResponse({
"status": "error",