Closed tianmuji closed 2 months ago
With "charts" you mean graphic charts?
With "charts" you mean graphic charts?
Nope, charts means for characters, sorry for the abbreviation I focus on all characters I want to get all characters and its style
My goal is to edit the text content so I firstly try to get all text style to make editing effect then I want to use FPDFTextObj_Insert api to update the text object
the first parameter of FPDFText_GetUnicode should be firstPageText instead of firstPage
I am trying to get font information from page, here is the code
const firstPage = FPDF.LoadPage(doc.processor.wasmData.wasm, 0);
const firstPageText = FPDF.FPDFText_LoadPage(firstPage);
const charts = FPDF.FPDFText_CountChars(firstPageText);
console.log('firstPageText:'+charts);
let output = '';
for (let i = 0; i < charts; i++) {
const unicode = FPDF.FPDFText_GetUnicode(firstPage, i);
const char = String.fromCharCode(unicode);
const fontSize = FPDF.FPDFText_GetFontSize(firstPage, i);
output +=
Character at index ${i}: ${char} (font: ${fontSize})\n;
}
console.log(output);
the problem is charts sometimes return 0 unicode and fontSize always return 0
I am wondering if I can use api from TextModule the api doc says it will not work without purchasing
Could you plz help me find the issue