mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
XFA - Add the possibily to layout and measure text
- some containers doesn't always have their 2 dimensions and those dimensions re based on contents; - so in order to measure text, we must get the glyph widths (for the xfa fonts) before starting the layout; - implement a word-wrap algorithm; - handle font change during text layout.
This commit is contained in:
parent
335d4cb2fc
commit
8eeb7ab4a3
12 changed files with 416 additions and 91 deletions
|
@ -857,6 +857,10 @@ class PDFDocument {
|
|||
return shadow(this, "xfaFaxtory", null);
|
||||
}
|
||||
|
||||
get isPureXfa() {
|
||||
return this.xfaFactory && this.xfaFactory.isValid();
|
||||
}
|
||||
|
||||
get htmlForXfa() {
|
||||
if (this.xfaFactory) {
|
||||
return this.xfaFactory.getPages();
|
||||
|
@ -898,8 +902,14 @@ class PDFDocument {
|
|||
options,
|
||||
});
|
||||
const operatorList = new OperatorList();
|
||||
const pdfFonts = [];
|
||||
const initialState = {
|
||||
font: null,
|
||||
get font() {
|
||||
return pdfFonts[pdfFonts.length - 1];
|
||||
},
|
||||
set font(font) {
|
||||
pdfFonts.push(font);
|
||||
},
|
||||
clone() {
|
||||
return this;
|
||||
},
|
||||
|
@ -947,6 +957,7 @@ class PDFDocument {
|
|||
);
|
||||
}
|
||||
await Promise.all(promises);
|
||||
this.xfaFactory.setFonts(pdfFonts);
|
||||
}
|
||||
|
||||
get formInfo() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue