Comments (17)
You're going to say this isn't obvious - and you'd probably be right - but again as mentioned in the readme, the order of the dependencies is important.
jsPDF includes an out-of-date version of html2canvas internally, so you need to include html2canvas after jsPDF and before html2pdf. I've updated the order of the includes in your fiddle (the only change I made is including html2canvas before html2pdf instead of after).
Maybe it would be best to package all of the dependencies together with Browserify and offer a html2pdf.bundle.js to avoid all of these sorts of issues. In any case, please try the link I sent and let me know if it's still producing the black bars or boxes (neither show up for me).
from html2pdf.js.
No problem @lidijarad! I'm glad everything's working well, let me know if you run into any other problems.
from html2pdf.js.
Yep, that looks like a problem! I'll look into it.
from html2pdf.js.
Hi @eKoopmans thank you for your library, I found a similar error, and this happened if I changed the margin != 1. If margin is set to 1, then the output is ok. I just checked and this seems to happen if I change any of the values that you provide in your example in the README.
from html2pdf.js.
Hi @alundiak @lidijarad, I'd definitely like to resolve this issue but I haven't yet been able to reproduce it. It could be a platform thing. Could you please:
- Create a fork of this jsFiddle that illustrates the issue (the dependencies are already included in the fiddle), and
- Tell me what browser, OS, and PDF viewer you're using?
Thanks!
from html2pdf.js.
@eKoopmans
This jsFiddle example uses your repo js files via raw access. And result file.pdf is with vertical lines and black region.
html2canvas 0.5.0-beta4
jspdf/1.3.4/jspdf.debug.js
I also tried with https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0-beta4/html2canvas.min.js
which is in fact beta-3
- result the same.
from html2pdf.js.
Hi, as I mentioned in the readme, html2pdf works best with the custom builds of html2canvas and jsPDF included in the /vendor/
directory. Specifically here, the black bars are caused by an html2canvas issue with offscreen rendering, which is resolved in the custom build in /vendor/
.
The jsFiddle I linked uses the /vendor/
files for both dependencies. Here's a fiddle with your code in it, the result for me doesn't produce any black bars.
from html2pdf.js.
ok, then close this issue, if it's not an issue.
from html2pdf.js.
I think it's bug, because as an end consumer, I want to use 3rd party libs and not depend on your own build of the lib code. Otherwise such lib is not well maintainable. When new version/release of html2canvas appear, u will update ur repo and I will have to update my code with file from your repo directly. I would like to install by npm or bower module/component and rely on it strictly from official releases.
from html2pdf.js.
@alundiak I hear you, I'd rather be able to use the stock versions too, but right now that offscreen rendering issue is an unavoidable bug in html2canvas. There's no way I could fix it from the outside. I'm waiting on the pull request to be merged in over there, as soon as it is then there will be no need for custom builds!
Your initial issue, with the dark vertical strip to the left of the text, seems separate from the black boxes, and I'd still like to resolve it. Have you tested with the custom html2canvas?
from html2pdf.js.
html2canvas issue with offscreen rendering, which is resolved in the custom build in /vendor/
If u did changes in minified file, then I would suggest u add comment on header of file, so that code researcher realize, that minified file IS NOT the same version as version published on CDN or elsewhere. Doing this, u will show, the reason why u have copy of file in code itself. U know - if I saw it in code, I would know why u have copy. Yes I read it in readme, and I realise the reason of copy in vendor. But hope u agree, that from code perspective, it's not informative, that 3rd-party library has been somehow changed.
from html2pdf.js.
You're right @alundiak, I've added info about the custom builds to both vendor dependencies in 474b36e.
from html2pdf.js.
@eKoopmans this is "html2pdf usage - NEW" jsfiddle.
It uses:
- https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.debug.js
- https://raw.githubusercontent.com/eKoopmans/html2pdf/master/vendor/html2canvas.min.js (with ur: "2017-05-13 Custom build by Erik Koopmans, featuring latest bugfixes and features")
- also tried with this https://rawgit.com/eKoopmans/html2pdf/master/vendor/html2canvas.min.js
- https://rawgit.com/eKoopmans/html2pdf/master/src/html2pdf.js
Results is the same:
file_May-13-2017_.pdf
MacOS 10.12.4, Chrome 58.0, Safari 10.1, Firefox 53.0.2
Adobe Acrobat Reader
Architecture: x86_64
Build: 17.9.20044.222436
AGM: 4.30.69
CoolType: 5.14.5
JP2K: 1.2.2.38123
from html2pdf.js.
@eKoopmans :) I tried, and the reality of JS proves that all works fine now. Silly, but have to admit. One bundle would be great.
from html2pdf.js.
Agreed, I'll make a bundle (and NPM package info etc) in the near future. Thanks for helping track down this problem!
from html2pdf.js.
@eKoopmans, I have updated the order in which I load the files and am using your modified versions of the other libs and the output of the pdf seems to be good now. Thank you so much for tending to this so promptly.
from html2pdf.js.
Btw, bundle was added in v0.8.0.
from html2pdf.js.
Related Issues (20)
- Request for Assistance: Addressing Text Overlapping Issue with Next.js and html2pdf.js
- Page break "avoid" does nothing at all
- CVE-2020-7691 Security Vulnerability Issue HOT 2
- Broken image after created pdf
- Multiple Page download found slowness while downloading
- Memory is not deallocating for html2pdf even though for small data
- Html2pdf bloburl promise return causing UI stuck and increasing jsheap also
- Checkbox states unexpectedly changing to "on" when generating PDF with html2pdf.js HOT 1
- To add a logo to the PDF page. HOT 1
- Longer page being misaligned on page and truncated at bottom HOT 1
- base64 file not showing on first render - Safari
- Multi Language Support HOT 1
- Hi everyone, PDF content is blank after download in IOS
- Using HTML2PDF, text taking extra space HOT 1
- Date format change from dd-mm-yyyy to yyyy-mm-dd
- I want o set both orientation in same pdf
- page break in between text line while convert html to pdf HOT 3
- Can I get the progress bar example source? HOT 1
- scale issue to generate pdf
- Number Of pages in pdf
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html2pdf.js.