yWorks / jsPDF

JavaScript PDF generation to work with SVG
MIT License
56 stars 23 forks source link

jspdf not compatible with AutoTable plugin of jspdf #2

Closed saurabhdomain closed 6 years ago

saurabhdomain commented 7 years ago

Hi, I was trying to print some table using this version of jspdf. I have tried the following approaches

  1. Using AutoTable plugin designed to work with MrRio/jspdf, but the resulted table is not as expected.
  2. Using default table version of jspdf . The result was still unexpected.

Problems found were same. The color of text and header fill color is same and the position of header and the text are not align. ( All the text are coming inside the header rect) I am using "Version 1.2.68 Built on 2016-06-30T16:13:12.826Z" jspdf.debug.js.

I am not able to attach the sample pdf. If required I can mail the same

Please help me on the same and if this an open bug please let me know the workaround for print table

Thanks Saurabh

yGuy commented 7 years ago

This fork of jsPDF is mainly meant to be used in conjunction with svg2pdf.js and the main use of it is to convert svg to pdfs. Does the same problem exist with the original jsPDF or is it specific to this fork? If so, please file the bug against the original jsPDF. That said, we won't be fixing problems with third party plugins, however we will of course accept pull-requests that improve the compatibility with such plugins. Please investigate the issue yourself and see if you can pinpoint the problem. Maybe we can include a workaround, but it's not a goal of this project to fix problems outside of the svg conversions that originate in the original jsPDF sources.

saurabhdomain commented 7 years ago

Hi Thanks for the quick reply No with original jspdf things are working perfectly fine . This problem is with this fork . Apart form the plugin compatibility the default function of creating Table ( present in original version) is also not working as expected with this fork. I tried to figure out the issue but was not able to pinpoint the exact problem.

Thanks Saurabh

pxr64 commented 6 years ago

Any news on this, I am facing the same problem.

yGuy commented 6 years ago

No news, here. This is basically blocked by #13 and a duplicate of #3

We are currently considering to resolve #13 which should "fix" this issue, too. Note again, that this fork was not meant to be used as a replacement to the original JSPdf and thus was never meant to be compatible with plugins for the original one. It was meant to support svg2pdf.

HackbrettXXX commented 6 years ago

I have some good news: the AutoTable plugin works now on the https://github.com/yWorks/jsPDF/tree/compatible-API branch, which will be merged and released in the near future.

msteigenberger commented 4 years ago

@HackbrettXXX: Can you please tell me how you got it working? I'm facing the issue that while building my ts project: ERROR in ./node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js Module not found: Error: Can't resolve 'jspdf' in '...\node_modules\jspdf-autotable\dist' When adding it as dev dependency it can be build, however at runtime facing the issue: doc.autoTable is not a function when trying to use the plugin this way:

const doc = new jsPDF();
doc.autoTable({
                html: '#basic-table-header-start',
                startY: yAxisValue += 10,
                headStyles: { margin: { bottom: 20 }, fontStyle: 'bold', fillColor: '#F37B10', textColor: 'white', fontSize: '15' }
            });

I'm importing it via

import * as jsPDF from 'jspdf-yworks';
import 'jspdf-autotable';

Thanks for your help!

yGuy commented 4 years ago

You will have to fork/patch jspdf-autotable, too so that it resolves the jspdf dependency to our fork, if you want to use the default node_modules resolution mechanism to work. It still expects the original repo to be available.