matt-jensen / ember-js-pdf Goto Github PK
View Code? Open in Web Editor NEWClient-side JavaScript PDF generation for Embereños.
License: MIT License
Client-side JavaScript PDF generation for Embereños.
License: MIT License
First thanks for the addon, It's working nicely in one of my apps. In a new app, I have a requirement where I don't want to create the steps until the user actually saves the PDF.
I'm not showing the PDF, I just want to save the PDF as part of a table export component. The user can change the table data (CRUD) or filter it before exporting. I can update the steps in the actions as I'm doing in my other application but the user may only oqccaiosnally export the table.
The tables can be quite large and I don't want the overhead of modifying/creating the steps every time the user does something. I just want to populate steps when the user wants to do a PDF export.
I thought the onSave action was going to be the answer but that is called after addStepsToJsPdf does it work. Without a pre add Steps hook is there a way to accomplish this?
I have a problem with addHTML command:
import Component from '@ember/component';
import html2canvas from 'html2canvas';
import { set } from '@ember/object';
export default Component.extend({
init() {
this._super(...arguments);
window.html2canvas = html2canvas;
let steps = [
{ setFontSize: 40 },
{ text: [35, 25, 'Tomsters loves jsPDF'] },
{ addHTML: document.getElementById('abc') },
];
set(this, 'steps', steps);
},
});
It doesn't appear in the PDF (document.getElementById('abc') exists and has some example text) - and the browser PDF download window pops out before the html2canvas prints all logs to the console (doesn't wait for it to render stuff?). jsPDF examples have a callback for addHTML()/html() - how this translates to such list of commands?
jsPDF has a number of interesting plugins which generally seem to extend the global instance of jsPDF with new methods. @cwhittl is interested in providing users a simple way for them to add plugins on a component by component basis.
To my knowledge these plugins seem to extend jsPDF functionality globally, so instantiating plugins within the js-pdf
component, per component instance, doesn't currently make sense to me.
So to state the feature as clearly as I can:
config/environment.js
./vendor
via config/environment.js
.With this approach in mind users would then likely have to extend js-pdf component to utilize any new plugin features.
Hi,
I didn't find how to use the splitTextToSize
command with text. Do you have any example on how to use it ? Okay, I can add it to steps but in jsPDF examples, they split the text with splitTextToSize
and then set it into the text
=> see here in string splitting
.
Is there any way to return the values from steps ?
Thanks !
Hi Matt, thanks for the addon, is there a way to change orientation in the current API ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.