I want to create PDF's clientside (in the browser). I'm using WebPack to bundle my javascript application and npm to install the needed libraries. I've tried the following without success:
pdfmake
jspdf
pdfkit
Has anyone here gotten this setup to work with any of these (or some other) libraries? Mind sharing how?
You can use pdfmake-client which is a wrapper to the pdfmake library that serves the client build over npm.
In general pdfmake does have a client build but serves the node version over NPM, this is likely a good case for a PR for that project so it will serve the correct version.
I was able to get jspdf to work, but the version from npm didn't work.
First I ran npm install jspdf --save
Then I downloaded the the lastest code from https://github.com/MrRio/jsPDF
and ran npm run build
then I replaced node_modules\jspdf\dist\jspdf.min.js with the one I just built.
Then the following code worked
import jsPDF from 'jspdf';
var doc = new jsPDF();
doc.text(20, 20, 'Hello world.');
doc.save('Test.pdf');
I'm using webpack and nothing needed to be added to the config
More samples of usage can be found here: https://parall.ax/products/jspdf
Related
With version 1.0.0-beta.13 of the aurelia cli with the webpack option selected I am trying to add Font Awesome via npm. There are several questions regarding this but nothing with the current cli and webpack. I have installed Font Awesome via npm and imported it into my main.js
import 'font-awesome/css/font-awesome.css
I have also tried requiring it in my app.html but it still does not work. I can add the Font Awesome cdn link to my index.ejs and it works as expected but I would like to use it via npm.
Thanks
I am currently working on making a component much like the contribution graph from Github and struggling a bit to share it as an npm package.
The component vue-contribution-graph packaged with npm doesn't display the tooltip properly. The CSS for the b-tooltipcomponent is working on the original project but it seems not to be included properly in the packaged component. Indeed, after running npm i vue-contribution-graph, the tooltip background doesn't appear.
I have created a GitHub issue just to make it clearer: https://github.com/estelled/vue-contribution-graph/issues/4
The behavior remains the same after installing all the dependencies manually.
I followed this tutorial for npm packaging.
Files changed to package the component:
package.json
added a vue.config.jsfile, to include CSS in the package
How do I fix it?
My guess is that it's not working when installing via npm, because the path to the CSS files are wrong. They are, however, correct when running the vue-contribution-graph package as standalone.
Having looked at your demo.html, it looks like it's requiring a missing file: ./vue-contribution-graph.css. Have you tried setting extract: false for your CSS to automatically be included in the bundle?
I have a problem with weex. I wanted to start to learn to write a Vue app using weex, but I have a problem because I can not download the package. I have an empty folder and enter the command from the npm documentation install weex-toolkit -g, but it will give me such an error.
Image error:
https://cdn.discordapp.com/attachments/424284796068429824/431948032897187841/unknown.png
The error is from an npm dependency, fsevents, not weex per-se.
Have you tried on a different platform, or see if the toolkit got installed anyway?
I would like to share my Vue js application project which is in my repository with a friend. So I used vue-cli, npm/yarn and webpack to develope.
I would like to know if he needs to install also cli to run the app on his computer, or just npm install and npm run? thanks
No, the vue-cli is not strictly necessary. However, if you're used to using vue build to build & run your app, your friend might want that too. He/she could just use some other way to run the webpack build operation if installing vue-cli isn't an option.
I'm following the "Contact Manager" introduction in Aurelia HUB, using the aspnetcore typescript skeleton. Thus, my solution havn't been set up using au new from the Aurelia CLI.
For the last bit of the tutorial, nprogress must be installed, and I'm struggling with that part. I've npm install nprogress --save and nprogress has been added to package.json. I've also installed the typing from Definitely Typed. So far so good.
Now the tutorial wants me to add nprogress to the vendor-bundle.js bundle, which is part of the CLI installation. So I don't have that bundle.
How do I go on from here? I've tried adding nprogress to the bundles.js file, but the reference is still missing when I run the app. There's also a config.js file that has som mappings, which I believe are used by aurelia require. I've tried adding nprogress here as well, but no dice.
All these configuration files are somewhat confusing. How do I get a package running? Thanks.
jspm install nprogress did the trick.