Skip to Main Content

Visual Builder

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Export oj-table data as pdf in oracle visual builder

Abhishek RathoreMay 4 2023 — edited May 4 2023

Hi All,

I have a use case in which I want to export my table data as pdf document with some pre defined pdf headers. I tried using jsPDF library to do it but its not working.

Javascript function:

 PageModule.prototype.PDFheaders = function(myTable){
    var doc = new jsPDF();
    var headers = function(){
      doc.setFontSize(15);
      doc.text("Sample predefined headers", doc.internal.pageSize.width / 2, 10,'center');
    };
    doc.autoTable({
    startY: 20,
    head: [[{content: '{html: myTable}', styles: {halign: 'center'}}]],
    didDrawPage: headers
  });
  doc.setFont("times", "normal");
  doc.setFontSize(12);
  doc.text("Lorem ipsum text", 20, 40);
  window.open(URL.createObjectURL(doc.output("blob")));
  };

I am passing the id of oj-table in myTable parameter.

Above function is generating the pdf with headers but table data is not generating into pdf.

How to generate the table data into PDF.

@shay-shmeltzer-oracle

Comments
Post Details
Added on May 4 2023
4 comments
723 views