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

Dynamic content not splitting into 2nd page #57

Open
shaunzi opened this issue Mar 3, 2023 · 8 comments
Open

Dynamic content not splitting into 2nd page #57

shaunzi opened this issue Mar 3, 2023 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@shaunzi
Copy link

shaunzi commented Mar 3, 2023

I am using your library but facing issue when the dynamic content is long so ideally it should split it into 2nd page but it is putting all the content the on single page. When printing that single page PDF its not readable.

Please assist.

@jonathansantos-toast
Copy link

I am having exactly the same issue... @shaunzi did you find any workaround for this?

@shaunzi
Copy link
Author

shaunzi commented Mar 9, 2023

@jonathansantos-toast no luck so far!

@jonathansds
Copy link

Hey @shaunzi (same Jonathan here, just noticed I had first commented from my work account so replying now from my personal one hahaha)

I was having this issue even though the content was small enough to fit in a single page. I managed to fix it by setting a fixed width/height in pixel IN THE INCLUDE TAGS.

I had a layout file that already had the witdh and height set in fixed pixel values but inside it there were a few includes of different layout files and the actual tag didn't have fixed width/height values so after I set them as fixed pixel values the issue was fixed.

It might not be your case, as I understood you are aware your content is not small enough to fit in one page, so I don't know if that will fix the issue for you but in any case I am also about to work on a layout (list) that will have just one view with long content as well and I expect it to split the content into multiple pages so if I manage to do it I will give you an update here :)

Happy coding!

@jonathansds
Copy link

Yup, I've just finished the implementation and I am able to reproduce the issue. Trying to print a single view which is a list and this list is not being split into multiple pages, instead it's a long single page with all items which is not readable when trying to actually print it.

I will update the thread if I find a solution/work around for it

@jonathansds
Copy link

@shaunzi , I have tried many things, performed a lot of tests but couldn't find a proper fix for it. Instead, what I am doing for now is to split the list of items into chunks ( list.chunked(size) ) of items that will fit into a single page and then passing each chunk separately as different views so when the PDF is generated, each of those sub lists will fit in a single page and the remaining items will be in a last page itself.

For me, for now, this workaround works fine as I have a max size for each item of my list and the min size is not too different so was easy to calculate that each PDF page will fit 5 items.

If you need help with the implementation just let me know.

@shaunzi
Copy link
Author

shaunzi commented Mar 10, 2023

@jonathansds thanks for your support. My content is bit different, it is text/paragraphs and also there is a signature box at the end of the document (must be in the footer of the page).
I have tried the same approach i.e: split approach but it didn't went well in my scenario.
I am thinking to use iText library instead.

@CUET-sajib10
Copy link

Facing same issue, any solution? @Gkemon

@Gkemon
Copy link
Owner

Gkemon commented May 16, 2023

@jonathansds @CUET-sajib10 @shaunzi @jonathansantos-toast Sorry for the late reply guys. Actually was busy with my bread-and-butter projects. Unfortunately, it is not easy to implement it easily with the current code base. But you all are mostly well come if anyone wants to contribute to resolving these issues. But for now, I can suggest you guys -

please slit the text between two views and then print it from my side I think it will be the best solution considering trade off .

@shaunzi can you please inform me that does iText can solve your issue? If yes then I will try to look over it and how they actually work and try to implement it on my library . Thanks you all guy .

@Gkemon Gkemon added help wanted Extra attention is needed enhancement New feature or request labels May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants