Git Product home page Git Product logo

Comments (9)

simonbengtsson avatar simonbengtsson commented on September 23, 2024

Hi! Can you post the code you are using? Preferably a working example on codepen or similar that demonstrates the issue. Unfortunately I'm not sure I understand your problem

from jspdf-autotable.

cometaRobertillo avatar cometaRobertillo commented on September 23, 2024

Sure, take a look

$scope.callJspdfAfterSubmitButton = function(){
var doc = new jsPDF('p', 'pt', 'letter');
var elementHandler = {
  '#ignorePDF': function (element, renderer) {
    return true;
  }
};
var canvas = document.getElementsByClassName('canvasjs-chart-canvas');
document.getElementById('chartContainer').style.width = "550px"
$scope.chart.render();

var imgData = canvas[0].toDataURL("image/png", 1.0);

doc.addImage(imgData, 'PNG', 30, 15);

var totalPagesExp = "{total_pages_count_string}";

var footer = function (doc, lastCellPos, pageCount, options) {
var str = "Page " + pageCount;
// Total page number plugin only available in jspdf v1.0+
if (typeof doc.putTotalPages === 'function') {
  str = str + " of " + totalPagesExp;
}
  doc.text(str, options.margins.horizontal, doc.internal.pageSize.height - 30);
};

var options = {
  renderFooter: footer,
  startY: 315, // The start Y position on the first page. If set to false, top margin is used
  overflow: 'linebreak' // false, ellipsize or linebreak (false passes the raw text to renderCell)
};

var columns = 
  [{title: "col1", key: "key1", width: 90 },
  {title: "col2", key: "key2", width: 300},
  {title: "col3", key: "key3", width: 220}, 
  {title: "col4", key: "key4", width: 90}, 
  {title: "col5", key: "key5", width: 100}];

var data = $scope.data.tipe1;
data.extend($scope.data.tipe2);
data.extend($scope.data.tip3);
data.extend($scope.data.tip4);

//parametros (columnas, info, options)
doc.autoTable(columns, data, options);
if (typeof doc.putTotalPages === 'function') {
  doc.putTotalPages(totalPagesExp);
}
doc.output("datauri");

};

see the result, bro.

Erase photo for personal reasons, bro
if i set

margins: {bottom: 160},

the problem is fixed, but only because i say the last row was created soo distant from page foot, you know?.

if my columns have a loot of info, the issue appear.

from jspdf-autotable.

cometaRobertillo avatar cometaRobertillo commented on September 23, 2024

If can't understand what happen here with this portion of code and the image, please tell me, to make a working demostration.

from jspdf-autotable.

simonbengtsson avatar simonbengtsson commented on September 23, 2024

Thanks for reporting this issue! When I tried your code and found multiple bugs when having long text in a table wrapping more than one page. I don't think it has anything todo with images though? I will look into this as soon as possible.

Partly this is fixed in the very experimental version 2.0 of the library which can be found in the v2 branch. However, there were still issues and it's probably not worth testing until it is officially released.

from jspdf-autotable.

cometaRobertillo avatar cometaRobertillo commented on September 23, 2024

Maybe i should change the issue name, right? because Isnt the image problem, i think it was but.. is just the columns wth long text.

i will try version 2.0 thnx for quick answer!

Good luck.

from jspdf-autotable.

simonbengtsson avatar simonbengtsson commented on September 23, 2024

It should now definitely be fixed in version 2.0. Keep in mind that custom column widths are not supported in that version as of yet however.

from jspdf-autotable.

cometaRobertillo avatar cometaRobertillo commented on September 23, 2024

One last thing SomeAtoms, what should i change in my code to make it run?... can't make it ran with v2

from jspdf-autotable.

simonbengtsson avatar simonbengtsson commented on September 23, 2024

I will write an upgrade guide when it is officially released. For now you would have to check the examples.

from jspdf-autotable.

simonbengtsson avatar simonbengtsson commented on September 23, 2024

Version 2.0 is released which should fix this issue.

from jspdf-autotable.

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.