Code Monkey home page Code Monkey logo

Comments (17)

eKoopmans avatar eKoopmans commented on May 18, 2024 1

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.

eKoopmans avatar eKoopmans commented on May 18, 2024 1

No problem @lidijarad! I'm glad everything's working well, let me know if you run into any other problems.

from html2pdf.js.

eKoopmans avatar eKoopmans commented on May 18, 2024

Yep, that looks like a problem! I'll look into it.

from html2pdf.js.

lidijarad avatar lidijarad commented on May 18, 2024

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.

eKoopmans avatar eKoopmans commented on May 18, 2024

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:

  1. Create a fork of this jsFiddle that illustrates the issue (the dependencies are already included in the fiddle), and
  2. Tell me what browser, OS, and PDF viewer you're using?

Thanks!

from html2pdf.js.

alundiak avatar alundiak commented on May 18, 2024

@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.jswhich is in fact beta-3 - result the same.

file (1).pdf

from html2pdf.js.

eKoopmans avatar eKoopmans commented on May 18, 2024

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.

alundiak avatar alundiak commented on May 18, 2024

ok, then close this issue, if it's not an issue.

from html2pdf.js.

alundiak avatar alundiak commented on May 18, 2024

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.

eKoopmans avatar eKoopmans commented on May 18, 2024

@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.

alundiak avatar alundiak commented on May 18, 2024

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.

eKoopmans avatar eKoopmans commented on May 18, 2024

You're right @alundiak, I've added info about the custom builds to both vendor dependencies in 474b36e.

from html2pdf.js.

alundiak avatar alundiak commented on May 18, 2024

@eKoopmans this is "html2pdf usage - NEW" jsfiddle.
It uses:

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.

alundiak avatar alundiak commented on May 18, 2024

@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.

eKoopmans avatar eKoopmans commented on May 18, 2024

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.

lidijarad avatar lidijarad commented on May 18, 2024

@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.

eKoopmans avatar eKoopmans commented on May 18, 2024

Btw, bundle was added in v0.8.0.

from html2pdf.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.