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

bullet support for <li> #486

Closed
wants to merge 2 commits into from
Closed

bullet support for <li> #486

wants to merge 2 commits into from

Conversation

Flamenco
Copy link

I re-added elements from your previous implementation, plus added native context2d drawing for unordered lists.
http://rawgit.com/Flamenco/html2canvas/master/examples/lists.html

You might enjoy this, too:
http://rawgit.com/Flamenco/jsPDF/master/examples/html2pdf/lists.html

I have successfully bridged html2canvas code in order to generate a PDF instead of a canvas. The nice thing about this is the PDFs can be scaled, selected, searched, and annotated (vs canvas). Notice how much sharper the PDF is compared to the canvas implementation.

Here are your 2 demo files rendered to PDF format:
http://rawgit.com/Flamenco/jsPDF/master/examples/html2pdf/pdf.html
http://rawgit.com/Flamenco/jsPDF/master/examples/html2pdf/pdf2.html

You can view all examples here:
https://github.com/Flamenco/jsPDF/wiki/html2pdf

I needed to make a few modifications to the html2canvas code for signaling page breaks (page-break-before) to the canvas/context2d. Please let me know if you are interesting in incorporating them and/or establishing an interface for pagination during the rendering process.

Thanks for your great work!

@niklasvh
Copy link
Owner

Thanks for the pull request!

There are a few issues in the PR:

  • All changes should be made in the source files, (reside under src/)
  • All draw related issues should reside under an implementation of a Renderer, which would be CanvasRenderer in this case. The NodeParser does not rely on an implementation of canvas to be available, and it could be used to render onto a webgl context, or just a serialized json list of draw commands.
  • Some (mocha) unit tests for the generation of list items would be nice

@niklasvh niklasvh mentioned this pull request Feb 4, 2015
herringtown added a commit to Dorsata/html2canvas that referenced this pull request Feb 15, 2015
@sakoht
Copy link

sakoht commented Mar 30, 2016

I need this too.

@Flamenco have you moved on to other things?

I don't want to start on it if someone else is mostly there...

@Flamenco
Copy link
Author

We are using an internal fork of this repo, as we don't have the time or resources to make the submitted patch conform to requested standards.

@andrewhilts
Copy link

This solution also doesn't support rtl text direction.

@niklasvh niklasvh closed this Jul 28, 2017
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.

None yet

4 participants