cancel
Showing results for 
Search instead for 
Did you mean: 

JSPDF error: Auto table function is not working

Ruchi691
Participant
842

Hello SAP,

We have requirement to get the smartforms colums value in PDF form. Hence we tried to incorporate the JsPdf library in our sample code. attched codes datails in text form below.

productview.xml

product-json.txt

productcontroller.txt

models.txt manifest.txt

Index.html code

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>proddetails</title>

<script id="sap-ui-bootstrap"

src="resources/sap-ui-core.js"

data-sap-ui-theme="sap_fiori_3"

data-sap-ui-resourceroots='{"prod.proddetails": "./"}'

data-sap-ui-compatVersion="edge"

data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"

data-sap-ui-async="true"

data-sap-ui-frameOptions="trusted">

</script>

</head>

<body class="sapUiBody">

<!-- Include jsPDF library -->

<script src="JS/jspdf.min.js"></script>

<script src="JS/jspdf.js"></script>

<script src="JS/jspdf.plugin.autotable.js"></script>

<div data-sap-ui-component data-name="prod.proddetails" data-id="container" data-settings='{"id" : "proddetails"}'></div>

</body>

</html>

But we are getting error as shown below:

image.png

Please suggest where we are getting wrong and why we are getting autotable plugin issue. We have also tried using autotable files as attached

jspdfpluginautotable.txt

jspdfmin.txt

jspdf.txt

Thanks and Regards

Ruchi Kesharwani

Accepted Solutions (0)

Answers (1)

Answers (1)

zamboni
Explorer

Hi, if you already use the jsPDFauto table library, try making the call this way.

If you don't use this library, I'll leave the link so you can download it.

https://github.com/simonbengtsson/jsPDF-AutoTable

Always remember to reference your library in the file where you will use it.

zamboni
Explorer
0 Kudos

I encountered the same problem as you a while ago, and the solution was to use the JS AutoTable library to make the call and create the jsPDF object and thus have access to the autotable. If this library doesn't work for you, try looking for another with the same logic using a similar call. If you have any questions, please get in touch and I'm at your disposal.