Skip to content

Commit

Permalink
Cut off outline extraction if results are potentially bad
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtcode committed Jun 21, 2024
1 parent b4e8ed4 commit 61ddba8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/module/outline-extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export async function extractOutline(pdfDocument, structuredCharsProvider) {
}

// If no common title found, use the biggest font
if (!h1) {
if (!h1.length && 0) {
for (let i = 0; i < fontRanges.length; i++) {
let ranges = fontRanges[i];

Expand Down Expand Up @@ -400,6 +400,10 @@ export async function extractOutline(pdfDocument, structuredCharsProvider) {

// console.log('bold ranges', list)

if (h1.length < 4) {
return;
}

let items = [
...h1,
...h2,
Expand Down

0 comments on commit 61ddba8

Please sign in to comment.