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

fromHTML() cuts off line at new page #555

Closed
Adtiv opened this issue Jul 25, 2015 · 17 comments
Closed

fromHTML() cuts off line at new page #555

Adtiv opened this issue Jul 25, 2015 · 17 comments

Comments

@Adtiv
Copy link

Adtiv commented Jul 25, 2015

I have to build a pdf based on dynamic text. I am using an HTML page to load in stored content from the forms that the user will fill out. When the data exceeds the pagesize a new page is created but a line always gets cut out inbetween the two pages. I have no way of knowing exactly where in the html this will occur because it will always be different based on what you've filled out and can range from 1-20+ pages. So far I've tried css page breaks, 'pagesplit:true', and slightly modifying the fromHTML.js functions to try and change the starting y value(which didnt work). messing with the maxLineHeight variable in the renderTextFragment function showed me the missing line but in an arbitrary position on the page. for example, maxLineHeight = Math.max(maxLineHeight, style["line-height"], style["font-size"])-x; //for x=random number 1-50. seemed to work, but again i would not know where to put this before hand. Any idea how to fix this? Same problem when you exceed two pages(line got cut out between pages 2-3)

@Adtiv
Copy link
Author

Adtiv commented Jul 27, 2015

This is a screenshot of the pdf I am generating. Question 8 gets cut out because it is in the space between page 1-2. Everything that sais "test" can be more than a line long so i cant hard code the page breaks. Any help would be appreciated.

img_1773

@FlossyM
Copy link

FlossyM commented Apr 28, 2016

Too late to comment but still... I am facing the same issue .. were you able to fix it ?

@aidaghazaryan
Copy link

I have same issue too. Did you find any fix for this issue please?

@sankar4n
Copy link

sankar4n commented Apr 8, 2017

same issue here!

@memije
Copy link

memije commented Aug 17, 2017

Same issue, no workaround found yet 😢

@RubenMesaa
Copy link

Open the jspdf.js file and modify this: this.pdf.internal.getVerticalCoordinateString(this.y), style.color, "Td");

Erasing "style.color" and save as: this.pdf.internal.getVerticalCoordinateString(this.y), "Td");

And then it runs correctly on firefox and chrome

@vasanthaky8
Copy link

vasanthaky8 commented Oct 6, 2017

am also facing same problem i tried this.pdf.internal.getVerticalCoordinateString(this.y), "Td"); also but its not working pls help me it would be very grate help to me becoz i tried one week

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 17, 2018

Fixed in #1492

@Uzlopak Uzlopak closed this as completed Feb 17, 2018
@ogbdn
Copy link

ogbdn commented Mar 8, 2021

We are in 2021 and I think this is still an issue. Unfortunately, I can´t work inside jspdf.js since I have to use the CDN file and can´t use the file locally to upload it to the server. Any solution for that? Thanks

@ogbdn
Copy link

ogbdn commented Mar 8, 2021

@SebastianKut What line is that? I don´t find this line in jspdf.js

@ogbdn
Copy link

ogbdn commented Mar 8, 2021

I think this post shouldn´t have been closed @Uzlopak. In your example, you have used the same phare on each line. What happens if you do :
This is my paragraph 1
This is my paragraph 2
This is my paragraph 3
This is my paragraph 4
This is my paragraph 5
This is my paragraph 6
This is my paragraph 7
This is my paragraph 8
This is my paragraph 9
This is my paragraph 10
.
.
.

Thanks

@ogbdn
Copy link

ogbdn commented Mar 8, 2021

@Uzlopak e @SebastianKut I just noticed I was using an old CDN version. I have changed for "https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.min.js" and it worked.

@Maadtin
Copy link

Maadtin commented Mar 16, 2021

Im still having this problem and im at latest version :S

@jonasled
Copy link

I also have the problem with the latest version. I habe a little bit different scenarion than the example above. I'm currently rendering the html from a big paragraph.

@HackbrettXXX
Copy link
Collaborator

@Maadtin #2977 should fix this, but there hasn't been any progress recently...

@shweta21798
Copy link

shweta21798 commented Sep 15, 2021

I updated jspdf to version 2.4.0

, it has "autoPaging"
options in the html() method of jspdf, anyone knows what is it for?
I tried using it , but didnt see anything particualr in the generated pdf

@vikripermana21
Copy link

if anyone still facing the issue, you can just add autoPaging:'text' for the solution, it worked for me.
I hope this also work for anyone who faced this problem

Thankss

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

No branches or pull requests