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

HTML Content not scale to the A4 size. Content smaller than browser view. #1482

Closed
sheroqueen opened this issue Oct 20, 2017 · 8 comments
Closed

Comments

@sheroqueen
Copy link

When button onclick run the export_form() function, what I miss up? The content is not as like in the browser view. It's smaller from my browser.

untitled

function export_form(){
	console.log('export');

	var pdf = new jsPDF("p", "pt", "a4");
	pdf.addHTML($('#container_section'), 15, 15, function() {
		console.log('export');
	  pdf.save('web.pdf');
	});
}
@Uzlopak
Copy link
Collaborator

Uzlopak commented Oct 22, 2017

Do you need help in webdesign?
SCNR.

@sheroqueen
Copy link
Author

May I know what is the problem?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Oct 23, 2017

The browserview is depending on your css etc.. So if your html-code or css is faulty, what do you expect you get in the pdf?

@Uzlopak Uzlopak closed this as completed Feb 24, 2018
@krishnasharma1234
Copy link

krishnasharma1234 commented Jun 8, 2018

use particular size of a4 shit
var pdf = new jsPDF('l','mm',[297, 210]);

It will work

@kgrosvenor
Copy link

use particular size of a4 shit
var pdf = new jsPDF('l','mm',[297, 210]);

It will work

Sheet * not shit ;)

@Histamina
Copy link

The browserview is depending on your css etc.. So if your html-code or css is faulty, what do you expect you get in the pdf?

Wow, that was so rude. We clearly have a genius here 🤡


@sheroqueen checkout this solution https://newbedev.com/how-to-set-image-to-fit-width-of-the-page-using-jspdf

@HackbrettXXX
Copy link
Collaborator

@Histamina since jsPDF@2.4.0 it's possible to pass width and windowWidth to the html function, which can be used to scale the HTML to fit the page.

@risalfajar
Copy link

@HackbrettXXX windowWidth is in CSS pixels unit, how to make it fit an A4 paper?

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

7 participants