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

Fix for pdfmaker.js datasrc processing (DESY) #155

Merged
merged 4 commits into from
Jul 13, 2023
Merged

Conversation

drfho
Copy link
Contributor

@drfho drfho commented Jul 9, 2023

Hello @zmsdev,
Function _blobfields.createBlobField() may use the wrong py3 module to transform a string/base64 based file stream into a file? Please revise the change history after migrating the function from py2 to py3:

  1. 5f43688#diff-6500a5d0b2a201f9c6d07c46ed55d1b067e59062237c71d91caab8182bed3031
  2. adc3388#diff-6500a5d0b2a201f9c6d07c46ed55d1b067e59062237c71d91caab8182bed3031

Using pdfmake.js does not result in a file-object using a sequence of bytes(data,'utf-8') and io.BytesIO( data), but it works with io.StringIO ( data)

Screenshots;

DESY_ZMS5_PDF0
DESY_ZMS5_PDF1
DESY_ZMS3_PDF
filefromdata1
filefromdata2
createBlobField

@drfho drfho requested a review from zmsdev July 9, 2023 22:59
@drfho drfho changed the title Fix for pdfmaker.js datasrc processing Fix for pdfmaker.js datasrc processing (DESY) Jul 10, 2023
@drfho
Copy link
Contributor Author

drfho commented Jul 10, 2023

okay, removing this kind of "preemptive" str-handling was a good idea. So surprises in the transformation cascade are reduced. This works fine now.

Another Trap:
with latest Zope 5+ using pdfmake.js to create PDF. Big images or several images may result in a data-stream which is too big to get processed. After introdicing this PR
zopefoundation/Zope#1094
Zope now works with an arbitray form data size limitations:

https://github.com/zopefoundation/Zope/blob/345d656557bfc414f70b92637fef33dde747a97d/src/ZPublisher/HTTPRequest.py#L54-L58

Actually 1Mb (2**20 byte) is not much for a PDF file with images; so FORM_MEMORY_LIMIT should set at least to 2**22 = 4Mb

FORM_MEMORY_LIMIT = 2**20
DESY_V22_PDF_Formlimit0

FORM_MEMORY_LIMIT = 2**30
DESY_V22_PDF_Formlimit1

@drfho
Copy link
Contributor Author

drfho commented Jul 10, 2023

Opened the FORM_MEMORY_LIMIT issue at Zope:
zopefoundation/Zope#1141

@drfho drfho merged commit 19b5163 into main Jul 13, 2023
@zmsdev zmsdev deleted the fix_createBlobField branch July 26, 2023 21:12
@zmsdev zmsdev restored the fix_createBlobField branch July 26, 2023 21:12
@drfho drfho deleted the fix_createBlobField branch September 1, 2023 20:07
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

Successfully merging this pull request may close these issues.

2 participants