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

Repeat TableList heading on new page when list exceeds page bottom margin #130

Open
happsie opened this issue Jan 5, 2020 · 9 comments
Open
Labels
hard to solve Not food for newcomers help wanted Extra attention is needed new feature New feature or request

Comments

@happsie
Copy link
Contributor

happsie commented Jan 5, 2020

Is your feature request related to a problem? Please describe.
For long lists, the TableList header be visible again to make the list more readable and not having to jump to the top of the page to see what column titles that was defined.

Describe the solution you'd like

Check if the next row will break page margin and if that's true generate the TableList header again.

Describe alternatives you've considered

@happsie happsie changed the title Repeat TableList heading on new page when list exceeds page limit Repeat TableList heading on new page when list exceeds page bottom margin Jan 5, 2020
@johnfercher johnfercher added help wanted Extra attention is needed new feature New feature or request labels Jan 5, 2020
@johnfercher johnfercher added the hard to solve Not food for newcomers label Jan 19, 2022
@happsie
Copy link
Contributor Author

happsie commented Oct 7, 2022

Hello @johnfercher!
Im almost done with a fix for this one, but I can't seem to figure out the last bit of spacing needed to know if we should insert a new table header.

So I have this code to figure out if we should insert a new table header or not

currentOffset := s.pdf.GetCurrentOffset()
_, _, _, bottomMargin := s.pdf.GetPageMargins()
_, height := s.pdf.GetPageSize()
pagebreak := height - bottomMargin - s.pdf.GetFooterHeight() - 9
currentOffsetFuture := currentOffset + contentHeight 
if currentOffsetFuture >= pagebreak {
	s.drawTableHeader(header, tableProp)
}

So I try to calculate the expected pagebreak and if the future currentOffset would overlap or equal the page break. However, I have this magic number 9 im not sure what Im missing in my pagebreak calculations, but can the footer height be more than the fixed height set? Or is there another property I have to weigh in? See this for example

m.RegisterFooter(func() {
  m.Row(20, func() {
	  m.Col(12, func() {
		  m.Text("Tel: 55 024 12345-1234", props.Text{
			  Top:   13,
			  Style: consts.BoldItalic,
			  Size:  8,
			  Align: consts.Left,
			  Color: blueColor,
		  })
		  m.Text("www.mycompany.com", props.Text{
			  Top:   16,
			  Style: consts.BoldItalic,
			  Size:  8,
			  Align: consts.Left,
			  Color: blueColor,
		  })
	  })
  })
})

@Dragomir-Ivanov
Copy link

Hi Guys,
What is the status of this issue. It is a major one.

@happsie
Copy link
Contributor Author

happsie commented Oct 12, 2022

@Dragomir-Ivanov I will investigate this more in the coming weekend

@Dragomir-Ivanov
Copy link

@happsie
Thank you for doing this. I will try helping you out testing, and possibly helping with the code as time allows.

@johnfercher johnfercher moved this to Backlog in Maroto V2 Sep 19, 2023
@olajoe
Copy link

olajoe commented Feb 19, 2024

Is this available on v2 or have a solution?

@maddie
Copy link

maddie commented Jun 26, 2024

Is there any news about this issue?

@Fernando-hub527
Copy link
Collaborator

Hello
I'm working on this issue, I believe I can finish it by the end of this week

@vljukap98
Copy link

Hello, I was wondering what's the status of this issue currently?

@adhil-tinvio
Copy link

Hello,Is this feature up on v2?
or is it still work in progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hard to solve Not food for newcomers help wanted Extra attention is needed new feature New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

8 participants