docx2pdfmaker
Advanced tools
Comparing version 0.0.2 to 0.0.3
17
index.js
@@ -8,3 +8,3 @@ const jsdom = require('jsdom') | ||
async function ConvertToPdf (data, type, options) { | ||
async function ConvertToPdf (data, type, options, tableLayout) { | ||
let input = {} | ||
@@ -33,6 +33,8 @@ | ||
if (item.nodeName === 'TABLE') { | ||
const { formatTable, formatWidth } = makeRowHaveTheSameNumberOfColumns(item.table.body) | ||
return { | ||
...item, | ||
table: { | ||
body: makeRowHaveTheSameNumberOfColumns(item.table.body) | ||
widths: formatWidth, | ||
body: formatTable | ||
} | ||
@@ -46,3 +48,2 @@ } | ||
const dd = { | ||
pageMargins: [10, 25, 10, 60], | ||
content: convertedContent | ||
@@ -56,3 +57,3 @@ } | ||
function makeRowHaveTheSameNumberOfColumns (table) { | ||
const formatTable = table.map(row => { | ||
const formatTable = table.map((row, index) => { | ||
// make all rows have the same number of columns | ||
@@ -83,5 +84,11 @@ const numberOfColumns = Math.max(...table.map(row => row.length)) | ||
return formatTable | ||
const formatWidth = [] | ||
const numberOfColumns = Math.max(...formatTable.map(row => row.length)) | ||
for (let i = 0; i < numberOfColumns; i++) { | ||
formatWidth.push('*') | ||
} | ||
return { formatTable, formatWidth } | ||
} | ||
module.exports = { ConvertToPdf } |
{ | ||
"name": "docx2pdfmaker", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "NPM Package to convert .Docx file into Pdfmaker libary format", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,2 +43,2 @@ <h1 align="center"> | ||
Check the [demo folder](https://github.com/Igorcbraz/Docx2PdfMaker/tree/main/examples) for examples. | ||
Check the [demo folder](https://github.com/Igorcbraz/Docx2PdfMaker/tree/main/example) for examples. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
327246
76