Coder Social home page Coder Social logo

ember-js-pdf's People

Contributors

0000marcell avatar ember-tomster avatar matt-jensen avatar turbo87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ember-js-pdf's Issues

Building steps on the fly

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?

Using addHTML step

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?

User Configurable JsPDF Plugins

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:

  • Addon users should be able to modify the jsPDF instance with a configurable list of plugins via config/environment.js.
  • Addon users should be able to include: jsPDF plugins, 3rd party npm packages, and scripts in host app's /vendor via config/environment.js.
  • System should import and concatenate these plugins files to import and modify the jsPDF instance.

With this approach in mind users would then likely have to extend js-pdf component to utilize any new plugin features.

Can't use splitTextToSize

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 !

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.