-
Notifications
You must be signed in to change notification settings - Fork 593
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
Streamlining Chunk Addition in ColumnText Without Storing All in JVM #1167
Comments
I'm wondering about the starting issue, that you encountered OutOfMemoryException when using phrase/paragraph directly and decided to use ColumnText to handle the text chunk by chunk. Unless you put all the content into a single element (like a single paragraph or table containing all the content), adding phrases/paragraphs directly should not require more memory than using |
Hi @mkl-public, Yes, it is possible to add phrases individually. However, besides memory issues, I need the content to be at a specific position (positionX and positionY) within a specified width. Can you please guide me on whether it is possible to achieve this with a direct paragraph or phrase? Thank you. |
Ah, ok, then Unfortunately I'm not into such layout processing details. Maybe someone else can help. |
I'm still wondering what are you really trying to achieve. We have here a parser. We read a template and parse it, producing the PDF on the way. So content is added as a stream to the PDF. On the way titles, paragraphs, list and so on are created. Do you have some kind of draft, how your document should look like? |
Hello @asturio, Assume my goal is to generate a multi-colored e-book with complex formatting, including:
The content is extensive, potentially exceeding 1000 pages, and comes from multiple data sources. Due to the large volume, holding all the content in the JVM is not possible. Therefore, I am looking for a way to write the content chunk by chunk. Additionally, I need the ability to place content at specific positions (positionX and positionY) within a specified width, and I may require multiple columns of text in the PDF. |
Hello Team,
I am working on generating a PDF book with very lengthy text (>1000 pages). Due to the large content, I encountered OutOfMemoryException when using phrase/paragraph directly and decided to use ColumnText to handle the text chunk by chunk. While this approach helps avoid memory issues, I have run into a problem where each new chunk starts on a new line within the same column. This behavior is observed when adding chunks one at a time. In contrast, adding multiple chunks before calling ct.go() works fine, with the text flowing continuously. I identified that BidiLine processes all chunks and outputs the content line by line.
Code I have tried :
Is there any way to append chunks to the previous chunk on the same line? Alternatively, if there is a different class or method to achieve streaming of text, please suggest.
Thank you !
The text was updated successfully, but these errors were encountered: