Comparing version 0.3.0-beta.2 to 0.3.0-beta.3
# Changelog | ||
## 0.3.0-beta.3 - 2022-10-09 | ||
- Updated Roboto font (version 3.005) | ||
- Fixed calculating auto page height | ||
- Fixed TrueType Collection loading from URL | ||
- Fixed refetching fonts from URL | ||
## 0.3.0-beta.2 - 2022-04-01 | ||
@@ -4,0 +11,0 @@ |
@@ -148,23 +148,51 @@ "use strict"; | ||
if (this.fontDescriptors[font].normal) { | ||
let url = getExtendedUrl(this.fontDescriptors[font].normal); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].normal = url.url; | ||
if (Array.isArray(this.fontDescriptors[font].normal)) { | ||
// TrueType Collection | ||
let url = getExtendedUrl(this.fontDescriptors[font].normal[0]); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].normal[0] = url.url; | ||
} else { | ||
let url = getExtendedUrl(this.fontDescriptors[font].normal); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].normal = url.url; | ||
} | ||
} | ||
if (this.fontDescriptors[font].bold) { | ||
let url = getExtendedUrl(this.fontDescriptors[font].bold); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bold = url.url; | ||
if (Array.isArray(this.fontDescriptors[font].bold)) { | ||
// TrueType Collection | ||
let url = getExtendedUrl(this.fontDescriptors[font].bold[0]); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bold[0] = url.url; | ||
} else { | ||
let url = getExtendedUrl(this.fontDescriptors[font].bold); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bold = url.url; | ||
} | ||
} | ||
if (this.fontDescriptors[font].italics) { | ||
let url = getExtendedUrl(this.fontDescriptors[font].italics); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].italics = url.url; | ||
if (Array.isArray(this.fontDescriptors[font].italics)) { | ||
// TrueType Collection | ||
let url = getExtendedUrl(this.fontDescriptors[font].italics[0]); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].italics[0] = url.url; | ||
} else { | ||
let url = getExtendedUrl(this.fontDescriptors[font].italics); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].italics = url.url; | ||
} | ||
} | ||
if (this.fontDescriptors[font].bolditalics) { | ||
let url = getExtendedUrl(this.fontDescriptors[font].bolditalics); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bolditalics = url.url; | ||
if (Array.isArray(this.fontDescriptors[font].bolditalics)) { | ||
// TrueType Collection | ||
let url = getExtendedUrl(this.fontDescriptors[font].bolditalics[0]); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bolditalics[0] = url.url; | ||
} else { | ||
let url = getExtendedUrl(this.fontDescriptors[font].bolditalics); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bolditalics = url.url; | ||
} | ||
} | ||
@@ -272,3 +300,7 @@ } | ||
} else if (item.type === 'vector') { | ||
return item.item.y1 > item.item.y2 ? item.item.y1 : item.item.y2; | ||
if (typeof item.item.y1 !== 'undefined') { | ||
return item.item.y1 > item.item.y2 ? item.item.y1 : item.item.y2; | ||
} else { | ||
return item.item.h; | ||
} | ||
} else { | ||
@@ -275,0 +307,0 @@ // TODO: add support for next item types |
@@ -53,8 +53,13 @@ "use strict"; | ||
if (url.toLowerCase().indexOf('https://') === 0 || url.toLowerCase().indexOf('http://') === 0) { | ||
fetchUrl(url, headers).then(buffer => { | ||
this.fs.writeFileSync(url, buffer); | ||
if (this.fs.existsSync(url)) { | ||
// url was downloaded earlier | ||
resolve(); | ||
}, result => { | ||
reject(result); | ||
}); | ||
} else { | ||
fetchUrl(url, headers).then(buffer => { | ||
this.fs.writeFileSync(url, buffer); | ||
resolve(); | ||
}, result => { | ||
reject(result); | ||
}); | ||
} | ||
} else { | ||
@@ -61,0 +66,0 @@ // cannot be resolved |
{ | ||
"name": "pdfmake", | ||
"version": "0.3.0-beta.2", | ||
"version": "0.3.0-beta.3", | ||
"description": "Client/server side PDF printing in pure JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "js/index.js", |
@@ -56,3 +56,3 @@ # pdfmake [![Node.js CI][githubactions_img]][githubactions_url] [![GitHub][github_img]][github_url] [![npm][npm_img]][npm_url] [![Bower][bower_img]][bower_url] [![Packagist][packagist_img]][packagist_url] [![CDNJS][cdnjs_img]][cndjs_url] | ||
Source of documenation: https://github.com/pdfmake/docs **Improvements are welcome!** | ||
Source of documentation: https://github.com/pdfmake/docs **Improvements are welcome!** | ||
@@ -59,0 +59,0 @@ ## Building from sources |
@@ -129,20 +129,44 @@ import PDFDocument from './PDFDocument'; | ||
if (this.fontDescriptors[font].normal) { | ||
let url = getExtendedUrl(this.fontDescriptors[font].normal); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].normal = url.url; | ||
if (Array.isArray(this.fontDescriptors[font].normal)) { // TrueType Collection | ||
let url = getExtendedUrl(this.fontDescriptors[font].normal[0]); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].normal[0] = url.url; | ||
} else { | ||
let url = getExtendedUrl(this.fontDescriptors[font].normal); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].normal = url.url; | ||
} | ||
} | ||
if (this.fontDescriptors[font].bold) { | ||
let url = getExtendedUrl(this.fontDescriptors[font].bold); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bold = url.url; | ||
if (Array.isArray(this.fontDescriptors[font].bold)) { // TrueType Collection | ||
let url = getExtendedUrl(this.fontDescriptors[font].bold[0]); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bold[0] = url.url; | ||
} else { | ||
let url = getExtendedUrl(this.fontDescriptors[font].bold); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bold = url.url; | ||
} | ||
} | ||
if (this.fontDescriptors[font].italics) { | ||
let url = getExtendedUrl(this.fontDescriptors[font].italics); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].italics = url.url; | ||
if (Array.isArray(this.fontDescriptors[font].italics)) { // TrueType Collection | ||
let url = getExtendedUrl(this.fontDescriptors[font].italics[0]); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].italics[0] = url.url; | ||
} else { | ||
let url = getExtendedUrl(this.fontDescriptors[font].italics); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].italics = url.url; | ||
} | ||
} | ||
if (this.fontDescriptors[font].bolditalics) { | ||
let url = getExtendedUrl(this.fontDescriptors[font].bolditalics); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bolditalics = url.url; | ||
if (Array.isArray(this.fontDescriptors[font].bolditalics)) { // TrueType Collection | ||
let url = getExtendedUrl(this.fontDescriptors[font].bolditalics[0]); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bolditalics[0] = url.url; | ||
} else { | ||
let url = getExtendedUrl(this.fontDescriptors[font].bolditalics); | ||
this.urlResolver.resolve(url.url, url.headers); | ||
this.fontDescriptors[font].bolditalics = url.url; | ||
} | ||
} | ||
@@ -248,3 +272,7 @@ } | ||
} else if (item.type === 'vector') { | ||
return item.item.y1 > item.item.y2 ? item.item.y1 : item.item.y2; | ||
if (typeof item.item.y1 !== 'undefined') { | ||
return item.item.y1 > item.item.y2 ? item.item.y1 : item.item.y2; | ||
} else { | ||
return item.item.h; | ||
} | ||
} else { | ||
@@ -251,0 +279,0 @@ // TODO: add support for next item types |
@@ -44,8 +44,13 @@ import http from 'http'; | ||
if (url.toLowerCase().indexOf('https://') === 0 || url.toLowerCase().indexOf('http://') === 0) { | ||
fetchUrl(url, headers).then(buffer => { | ||
this.fs.writeFileSync(url, buffer); | ||
if (this.fs.existsSync(url)) { | ||
// url was downloaded earlier | ||
resolve(); | ||
}, result => { | ||
reject(result); | ||
}); | ||
} else { | ||
fetchUrl(url, headers).then(buffer => { | ||
this.fs.writeFileSync(url, buffer); | ||
resolve(); | ||
}, result => { | ||
reject(result); | ||
}); | ||
} | ||
} else { | ||
@@ -52,0 +57,0 @@ // cannot be resolved |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
15123218
97833