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

Update addhtml to handle bigger content #1450

Merged
merged 7 commits into from
Jan 11, 2018
Merged

Update addhtml to handle bigger content #1450

merged 7 commits into from
Jan 11, 2018

Conversation

Uzlopak
Copy link
Collaborator

@Uzlopak Uzlopak commented Sep 20, 2017

Example:

const doc = jsPDF()
    doc.addHTML(document.getElementById('toHTML'), 10, 10, {pagesplit: true, margin: {top: 10, right: 10, bottom: 10, left: 10, useFor: 'page'}}, function () {doc.save("test.pdf")})

image

const doc = jsPDF()
   doc.addHTML(document.getElementById('toHTML'), 10, 10, {pagesplit: true, margin: {top: 10, right: 10, bottom: 10, left: 10, useFor: 'content'}}, function () {doc.save("test.pdf")})

image

fix small mistake
@MrRio
Copy link
Member

MrRio commented Sep 20, 2017

Seems to be the tests on IE11 that aren't having a good time

@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Sep 20, 2017

I realized my master-branch is tainted with a changed standardfontmetrics.js

@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Sep 20, 2017

Well reverting the file standardfontmetrix.js fixed it. :)

I wrote this PR to close some open issues and because some people still use this plugin and ask for margins....

@MrRio
Copy link
Member

MrRio commented Sep 22, 2017

Thanks very much for this PR. I’ll get it reviewed and merged :-)

@hrc7505
Copy link

hrc7505 commented Nov 29, 2017

I have used this

const doc = jsPDF()
    doc.addHTML(document.getElementById('toHTML'), 10, 10, {pagesplit: true, margin: {top: 10, right: 10, bottom: 10, left: 10, useFor: 'page'}}, function () {doc.save("test.pdf")})

but still my pdf look like this
image

@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Nov 29, 2017

Did you applied the necessary changes?
https://github.com/MrRio/jsPDF/pull/1450/files

@hrc7505
Copy link

hrc7505 commented Nov 29, 2017

I have installed jsPDF by using npm i jspdf --save.
so inside node_modules->jspdf there are only two js files,

  1. jspdf.debug.js
  2. jspdf.min.js

No other libraries are there.
So how can I put these changes to that.
And I have also used following to js files from latest master.
1). html2pdf.js
2). html2canvas.js

Still I don't have any other js for support.
Do I need to link those js files of your latest master to my project?
How can I put these changes to my project?

@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Nov 29, 2017

if you don't apply the changes from the pull request then you can't expect that it will work. Please inform yourself what a Pullrequest is.

@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Nov 29, 2017

@ghost
Copy link

ghost commented Nov 29, 2017

I applied all the changes in your PR but I'm getting an error.
The error is:
Uncaught TypeError: Cannot read property 'apply' of undefined at line 132 of addhtml.js

I'm using the latest master release and I included jspdf.js, addhtml.js, from_html.js, split_text_to_size.js, standard_fonts_metrics.js, html2canvas.js

@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Nov 29, 2017

Line 132 is

this.addImage.apply(this, args);

So probably you should add addImage Plugin...

@hrc7505
Copy link

hrc7505 commented Nov 30, 2017

Thank you arasabbasi. I applied the changes on the given link https://github.com/MrRio/jsPDF/pull/1450/files and it works.

@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Nov 30, 2017

Thank you for your feedback

@MrRio MrRio merged commit fe4e39e into parallax:master Jan 11, 2018
@Uzlopak Uzlopak deleted the update_addhtml branch January 11, 2018 15:01
@FaiyazMdAbdul
Copy link

Hi ..

  • I cloned the latest master.
  • did npm install
  • npm start
  • Tested this example http://localhost:8000/examples/html2pdf/showcase_supported_html.html by adding this script
    const doc = jsPDF() doc.addHTML(document.body, 10, 10, {pagesplit: true, margin: {top: 10, right: 10, bottom: 10, left: 10, useFor: 'page'}}, function () {doc.save("test.pdf")}) .

but I am getting blank screen.
image

*Since this commit is merged into master, I haven`t edited the changes mentioned in updated files .

where am i going wrong?

Copy link

@yasirrafiq33 yasirrafiq33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@yasirrafiq33 yasirrafiq33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yasirrafiq33
Copy link

https://github.com/MrRio/jsPDF/pull/1450/files

How can I merge this pull request to my code?
Please help ASAP.

@philharmonie
Copy link

philharmonie commented Oct 8, 2018

This is merged to the master, right? I don't see any margins. Am I'm doing something wrong?
`var doc = new jsPDF('p','mm','a4');

	var margins = {top: 90, bottom: 60, left: 90, width: 900};

	doc.internal.scaleFactor = 6;
	doc.addHTML(document.body, margins, function() {
			doc.save("test.pdf");
	});
}`

@parallax parallax locked as off-topic and limited conversation to collaborators Oct 8, 2018
@Uzlopak
Copy link
Collaborator Author

Uzlopak commented Oct 8, 2018

@philharmonie
Please open an issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants