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

fix: Using canvas as a direct source #701

Merged
merged 5 commits into from
Jun 30, 2024
Merged

fix: Using canvas as a direct source #701

merged 5 commits into from
Jun 30, 2024

Conversation

eKoopmans
Copy link
Owner

It's supposed to be possible to use a canvas as a direct source, with either of:

  1. html2pdf().from(canvas).save() etc.
  2. html2pdf().set({ canvas: canvas }).save() etc.

But there were two errors preventing this from working:

  1. Typo in getType when using toLowerCase(), meaning the .from() approach didn't work
  2. Missing pageSize initialization in toPdf, meaning both approaches didn't work

This PR should solve the issue - added the all-tags_canvas.pdf snapshot test to verify the fix.

Closes #699

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

Successfully merging this pull request may close these issues.

Function "toLowerCase" not called, impossible to insert a canvas directly
1 participant