I try to use jsPDF in a React-Native app but i have this error on loading.
Unhandled JS Exception: undefined is not an object (evaluating 't.createElementNS')
I try to install jsPDF like this:
npm install jspdf --save
and by specify the git commit, the lib is correctly downloaded in the node_modules directory.
I tried to import like this:
import * as jsPDF from 'jspdf';
or
import { default as JSPDF } from 'jspdf';
or
import jsPDF from 'jspdf';
or
var jsPDF = require('jspdf');
So anyone have an idea ?
Thanks.
Is it even for React Native? Something like this better?
https://www.npmjs.com/package/react-native-pdf-lib
Related
I would like to import pdf-lib into my vue.js application.
Installed using npm
npm install --save pdf-lib
Imported into my component like this,
import _ from "#pdf-lib";
export default {
data() {
I get the following error message,
Module not found: Error: Can't resolve 'pdf-lib' in
I searched all over the internet but found nothing. I know this is a noob question.
I installed jspdf and jspdf-autotable over npm in my vue project:
npm install jspdf --save
npm install jspdf-autotables --save
Packages installed successfully. I'm importing jspdf and jspdf-autotable in main.js file like that:
import jsPDF from 'jspdf';
import 'jspdf-autotable';
Vue.use(jsPDF)
Then in my .vue file I import jsPDF first:
import jsPDF from 'jspdf';
and then in mounted() hook:
let doc = new jsPDF();
doc.autoTable({ html: '#my-table' });
doc.save('table.pdf');
But autoTable is not imported. It says unresolved method or hook autotable. I get empty pdf.
I don't know how to import autoTable. Please help me. It's one day left to finish my job. Sorry I'm new to Vue js. Many thanks in advance!
Good question, but not necessary you use this in your main file, you can use this in your specific file (for performance reasons). The autotable is one complement to work with table in your JsPdf. This necessary only load the file in your component.
e.g.:
import JsPDFAutotable from 'jspdf-autotable'
and your component
components: { JsPDFAutotable }
you don't need the imports in the main.js file.
Do you import directly in your .vue file. that work well.
import jsPDF from 'jspdf'
import 'jspdf-autotable'
and then in mounted() hook:
let doc = new jsPDF();
doc.autoTable({ html: '#my-table' });
doc.save('table.pdf');
I would like to use https://github.com/dgladkov/react-native-image-rotate in react-native project
I download it with yarn add react-native-image-rotate
I link it with react-native link
I import it in my component with import ImageRotate from 'react-native-image-rotate';
But when I try to use it I have a Cannot read property 'rotateImage' of undefined
I put a break-point in node_modules/react-native-image-rotate/index.js on the line:
const RCTImageRotateModule = NativeModules.ImageRotateModule;
And in the object NativeModules there is no ImageRotateModule object.
How Can I add ImageRotateModule in NativeModules ?
Im using react-native 0.50.3
Thx
react-native link react-native-image-rotate
I've created a new vue app using vue init webpack sample-app .
I'm trying to import this module (https://docs.botui.org/install.html) into my app.vue and make it show on.
What's the correct way to import this module into a Vue.JS app?
Open the terminal in your project root folder, then install the package:
npm install botui --save
Then open src/main.js in your text editor and add this:
import Vue from 'vue'
import BotUI from 'botui'
const botui = BotUI('my-botui-app', {
vue: Vue // pass the dependency.
})
This will create a botui instance. But that instance won't have any messages in it. You can check that it's working by adding a message:
botui.message.bot('Hello, how can I help?')
I'm trying to use the querystring package in an Aurelia application but getting Cannot read property 'stringify' of undefined error in the browser console.
These are the steps I took:
Install using jspm install querystring
Add import {querystring} from 'querystring' into the Aurelia model
Use in my model like so:
import {querystring} from 'querystring';
export class App {
criteria_words;
criteria_location;
constructor() {
}
submit() {
console.log(querystring.stringify(this));
}
}
What step am I missing?
First, jspm install querystring will not install the library that you have mentioned. The command that you should run is this:
jspm install npm:qs
Then, you can import and use it like this:
import querystring from 'qs';
// call querystring.stringify(someObject);
Or
import {stringify} from 'qs';
// call stringify(someObject);