Skip to content

A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!

fix: preserve Education ownership across PDF sections (RX-93)

Amruth Pillai26c0dfc6b5b6
diff --git a/apps/web/locales/af-ZA.po b/apps/web/locales/af-ZA.po
index 465133670..fca7a4392 100644
--- a/apps/web/locales/af-ZA.po
+++ b/apps/web/locales/af-ZA.po
@@ -3962,6 +3962,10 @@ msgstr "Kon nie daardie lêer lees nie. Probeer weer."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Kon nie die datums op {entries} lees nie, so hulle bly aan die einde. Maak hul datums reg en sorteer weer."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/am-ET.po b/apps/web/locales/am-ET.po
index b41083b8f..97c897f16 100644
--- a/apps/web/locales/am-ET.po
+++ b/apps/web/locales/am-ET.po
@@ -3962,6 +3962,10 @@ msgstr "ያንን ፋይል ማንበብ አልተቻለም። እንደገና
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "በ{entries} ላይ ያሉትን ቀኖች ማንበብ አልተቻለም፣ ስለዚህ መጨረሻ ላይ ይቆያሉ። ቀኖቻቸውን አስተካክለው እንደገና ይደርድሩ።"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ar-SA.po b/apps/web/locales/ar-SA.po
index fa083c2a3..80f7f5e50 100644
--- a/apps/web/locales/ar-SA.po
+++ b/apps/web/locales/ar-SA.po
@@ -3962,6 +3962,10 @@ msgstr "تعذّرت قراءة هذا الملف. حاول مرة أخرى."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "تعذّرت قراءة التواريخ في {entries}، لذا ستبقى في النهاية. صحّح تواريخها ثم أعد الفرز."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/az-AZ.po b/apps/web/locales/az-AZ.po
index d041801cb..6259b8c47 100644
--- a/apps/web/locales/az-AZ.po
+++ b/apps/web/locales/az-AZ.po
@@ -3962,6 +3962,10 @@ msgstr "Həmin faylı oxumaq mümkün olmadı. Yenidən cəhd edin."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} üzrə tarixləri oxumaq mümkün olmadı, ona görə də onlar sonda qalır. Tarixlərini düzəldin və yenidən sıralayın."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/bg-BG.po b/apps/web/locales/bg-BG.po
index 9c90b86b2..46fbf0983 100644
--- a/apps/web/locales/bg-BG.po
+++ b/apps/web/locales/bg-BG.po
@@ -3962,6 +3962,10 @@ msgstr "Файлът не можа да бъде прочетен. Опитай
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Датите в {entries} не можаха да бъдат прочетени, затова те остават в края. Поправете датите им и сортирайте отново."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/bn-BD.po b/apps/web/locales/bn-BD.po
index 592b1386c..0ce7f717f 100644
--- a/apps/web/locales/bn-BD.po
+++ b/apps/web/locales/bn-BD.po
@@ -3962,6 +3962,10 @@ msgstr "ফাইলটি পড়া যায়নি। আবার চ
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries}-এর তারিখ পড়া যায়নি, তাই সেগুলো শেষে থাকছে। তারিখগুলো ঠিক করে আবার সাজান।"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ca-ES.po b/apps/web/locales/ca-ES.po
index 92947ae50..530eb4c8d 100644
--- a/apps/web/locales/ca-ES.po
+++ b/apps/web/locales/ca-ES.po
@@ -3962,6 +3962,10 @@ msgstr "No s'ha pogut llegir aquest fitxer. Torneu-ho a provar."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "No s'han pogut llegir les dates de {entries}, de manera que queden al final. Corregiu-ne les dates i torneu a ordenar."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/cs-CZ.po b/apps/web/locales/cs-CZ.po
index a6ee538b0..5fdd63389 100644
--- a/apps/web/locales/cs-CZ.po
+++ b/apps/web/locales/cs-CZ.po
@@ -3962,6 +3962,10 @@ msgstr "Tento soubor se nepodařilo přečíst. Zkuste to znovu."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Data u {entries} se nepodařilo přečíst, takže zůstávají na konci. Opravte jejich data a seřaďte znovu."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/da-DK.po b/apps/web/locales/da-DK.po
index edb6dfca9..10ca68470 100644
--- a/apps/web/locales/da-DK.po
+++ b/apps/web/locales/da-DK.po
@@ -3962,6 +3962,10 @@ msgstr "Kunne ikke læse den fil. Prøv igen."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Kunne ikke læse datoerne for {entries}, så de bliver stående til sidst. Ret deres datoer, og sortér igen."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/de-DE.po b/apps/web/locales/de-DE.po
index a0328c615..3e3cec16e 100644
--- a/apps/web/locales/de-DE.po
+++ b/apps/web/locales/de-DE.po
@@ -3962,6 +3962,10 @@ msgstr "Diese Datei konnte nicht gelesen werden. Versuchen Sie es erneut."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Die Daten von {entries} konnten nicht gelesen werden, daher bleiben sie am Ende. Korrigieren Sie ihre Daten und sortieren Sie erneut."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/el-GR.po b/apps/web/locales/el-GR.po
index 7f97965cb..74736ed35 100644
--- a/apps/web/locales/el-GR.po
+++ b/apps/web/locales/el-GR.po
@@ -3962,6 +3962,10 @@ msgstr "Δεν ήταν δυνατή η ανάγνωση αυτού του αρ
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Δεν ήταν δυνατή η ανάγνωση των ημερομηνιών στο {entries}, οπότε παραμένουν στο τέλος. Διορθώστε τις ημερομηνίες τους και ταξινομήστε ξανά."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/en-GB.po b/apps/web/locales/en-GB.po
index ff1f292cc..2713caab0 100644
--- a/apps/web/locales/en-GB.po
+++ b/apps/web/locales/en-GB.po
@@ -3962,6 +3962,10 @@ msgstr "Couldn't read that file. Try again."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/en-US.po b/apps/web/locales/en-US.po
index 709652ff7..a26ea5f29 100644
--- a/apps/web/locales/en-US.po
+++ b/apps/web/locales/en-US.po
@@ -3957,6 +3957,10 @@ msgstr "Couldn't read that file. Try again."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr "Couldn't read the whole PDF. Split it into smaller files and try again."
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/es-ES.po b/apps/web/locales/es-ES.po
index 405e115c6..8de3a06c9 100644
--- a/apps/web/locales/es-ES.po
+++ b/apps/web/locales/es-ES.po
@@ -3962,6 +3962,10 @@ msgstr "No se pudo leer ese archivo. Inténtalo de nuevo."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "No se pudieron leer las fechas de {entries}, así que quedan al final. Corrige sus fechas y vuelve a ordenar."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/fa-IR.po b/apps/web/locales/fa-IR.po
index 0b0633121..3ad074898 100644
--- a/apps/web/locales/fa-IR.po
+++ b/apps/web/locales/fa-IR.po
@@ -3962,6 +3962,10 @@ msgstr "خواندن آن فایل ممکن نشد. دوباره امتحان ک
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "خواندن تاریخ‌های {entries} ممکن نشد، بنابراین در انتها می‌مانند. تاریخ‌هایشان را اصلاح کنید و دوباره مرتب کنید."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/fi-FI.po b/apps/web/locales/fi-FI.po
index 47777e0c8..3b55f5c4c 100644
--- a/apps/web/locales/fi-FI.po
+++ b/apps/web/locales/fi-FI.po
@@ -3962,6 +3962,10 @@ msgstr "Tiedostoa ei voitu lukea. Yritä uudelleen."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Merkintöjen {entries} päivämääriä ei voitu lukea, joten ne jäävät loppuun. Korjaa niiden päivämäärät ja lajittele uudelleen."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/fr-FR.po b/apps/web/locales/fr-FR.po
index 72e980650..5c83e5288 100644
--- a/apps/web/locales/fr-FR.po
+++ b/apps/web/locales/fr-FR.po
@@ -3962,6 +3962,10 @@ msgstr "Impossible de lire ce fichier. Réessayez."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Impossible de lire les dates de {entries} : ces entrées restent à la fin. Corrigez leurs dates et triez à nouveau."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/he-IL.po b/apps/web/locales/he-IL.po
index 70b906945..cacddc141 100644
--- a/apps/web/locales/he-IL.po
+++ b/apps/web/locales/he-IL.po
@@ -3962,6 +3962,10 @@ msgstr "לא ניתן היה לקרוא את הקובץ. נסה שוב."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "לא ניתן היה לקרוא את התאריכים ב-{entries}, ולכן הם נשארים בסוף. תקן את התאריכים שלהם ומיין שוב."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/hi-IN.po b/apps/web/locales/hi-IN.po
index 5e2f25543..cfab09362 100644
--- a/apps/web/locales/hi-IN.po
+++ b/apps/web/locales/hi-IN.po
@@ -3962,6 +3962,10 @@ msgstr "वह फ़ाइल पढ़ी नहीं जा सकी। प
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} की तारीखें पढ़ी नहीं जा सकीं, इसलिए वे अंत में रहेंगी। उनकी तारीखें ठीक करें और फिर से क्रमबद्ध करें।"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/hu-HU.po b/apps/web/locales/hu-HU.po
index 10d70b12d..068c97c31 100644
--- a/apps/web/locales/hu-HU.po
+++ b/apps/web/locales/hu-HU.po
@@ -3962,6 +3962,10 @@ msgstr "Nem sikerült beolvasni a fájlt. Próbáld újra."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Nem sikerült értelmezni a dátumokat itt: {entries}, ezért a végén maradnak. Javítsd a dátumaikat, és rendezd újra."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/id-ID.po b/apps/web/locales/id-ID.po
index 47af57a7c..4ae4f355d 100644
--- a/apps/web/locales/id-ID.po
+++ b/apps/web/locales/id-ID.po
@@ -3962,6 +3962,10 @@ msgstr "Tidak dapat membaca file itu. Coba lagi."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Tidak dapat membaca tanggal pada {entries}, jadi entri tersebut tetap di akhir. Perbaiki tanggalnya lalu urutkan lagi."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/it-IT.po b/apps/web/locales/it-IT.po
index 510de1f3e..bfe4171a5 100644
--- a/apps/web/locales/it-IT.po
+++ b/apps/web/locales/it-IT.po
@@ -3962,6 +3962,10 @@ msgstr "Impossibile leggere quel file. Riprova."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Impossibile leggere le date di {entries}, quindi restano in fondo. Correggi le date e ordina di nuovo."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ja-JP.po b/apps/web/locales/ja-JP.po
index d2a02a5b9..aba558746 100644
--- a/apps/web/locales/ja-JP.po
+++ b/apps/web/locales/ja-JP.po
@@ -3962,6 +3962,10 @@ msgstr "そのファイルを読み取れませんでした。もう一度お試
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} の日付を読み取れなかったため、末尾のままになっています。日付を修正して、もう一度並べ替えてください。"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/km-KH.po b/apps/web/locales/km-KH.po
index 0fd51d89b..fc6e6bed0 100644
--- a/apps/web/locales/km-KH.po
+++ b/apps/web/locales/km-KH.po
@@ -3962,6 +3962,10 @@ msgstr "មិនអាចអានឯកសារនោះបានទេ។
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "មិនអាចអានកាលបរិច្ឆេទនៅលើ {entries} បានទេ ដូច្នេះវានៅចុងបញ្ចប់។ កែកាលបរិច្ឆេទរបស់វា ហើយតម្រៀបម្តងទៀត។"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/kn-IN.po b/apps/web/locales/kn-IN.po
index 0352fdf83..987d544c9 100644
--- a/apps/web/locales/kn-IN.po
+++ b/apps/web/locales/kn-IN.po
@@ -3962,6 +3962,10 @@ msgstr "ಆ ಫೈಲ್ ಓದಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ.
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} ನಲ್ಲಿನ ದಿನಾಂಕಗಳನ್ನು ಓದಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ, ಆದ್ದರಿಂದ ಅವು ಕೊನೆಯಲ್ಲಿ ಉಳಿಯುತ್ತವೆ. ಅವುಗಳ ದಿನಾಂಕಗಳನ್ನು ಸರಿಪಡಿಸಿ ಮತ್ತು ಮತ್ತೆ ವಿಂಗಡಿಸಿ."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ko-KR.po b/apps/web/locales/ko-KR.po
index de4419d1b..858e27f6a 100644
--- a/apps/web/locales/ko-KR.po
+++ b/apps/web/locales/ko-KR.po
@@ -3962,6 +3962,10 @@ msgstr "해당 파일을 읽을 수 없습니다. 다시 시도해 보세요."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries}의 날짜를 읽을 수 없어 끝에 남아 있습니다. 날짜를 수정하고 다시 정렬하세요."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/lt-LT.po b/apps/web/locales/lt-LT.po
index 21469b44e..146f44f22 100644
--- a/apps/web/locales/lt-LT.po
+++ b/apps/web/locales/lt-LT.po
@@ -3962,6 +3962,10 @@ msgstr "Nepavyko nuskaityti to failo. Bandykite dar kartą."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Nepavyko nuskaityti įrašų {entries} datų, todėl jie lieka gale. Pataisykite jų datas ir rūšiuokite iš naujo."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/lv-LV.po b/apps/web/locales/lv-LV.po
index cf512cefa..08bab0378 100644
--- a/apps/web/locales/lv-LV.po
+++ b/apps/web/locales/lv-LV.po
@@ -3962,6 +3962,10 @@ msgstr "Nevarēja nolasīt šo failu. Mēģiniet vēlreiz."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Nevarēja nolasīt datumus ierakstos {entries}, tāpēc tie paliek beigās. Izlabojiet datumus un kārtojiet vēlreiz."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ml-IN.po b/apps/web/locales/ml-IN.po
index 760bd31a7..259683289 100644
--- a/apps/web/locales/ml-IN.po
+++ b/apps/web/locales/ml-IN.po
@@ -3962,6 +3962,10 @@ msgstr "ആ ഫയൽ വായിക്കാനായില്ല. വീണ
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} എന്നതിലെ തീയതികൾ വായിക്കാനായില്ല, അതിനാൽ അവ അവസാനം തുടരും. അവയുടെ തീയതികൾ ശരിയാക്കി വീണ്ടും ക്രമീകരിക്കുക."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/mr-IN.po b/apps/web/locales/mr-IN.po
index da720f2e7..8a010d5c3 100644
--- a/apps/web/locales/mr-IN.po
+++ b/apps/web/locales/mr-IN.po
@@ -3962,6 +3962,10 @@ msgstr "ती फाइल वाचता आली नाही. पुन्
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} वरील तारखा वाचता आल्या नाहीत, म्हणून त्या शेवटी राहतात. त्यांच्या तारखा दुरुस्त करा आणि पुन्हा क्रमवार लावा."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ms-MY.po b/apps/web/locales/ms-MY.po
index ce7545771..b909b3a81 100644
--- a/apps/web/locales/ms-MY.po
+++ b/apps/web/locales/ms-MY.po
@@ -3962,6 +3962,10 @@ msgstr "Tidak dapat membaca fail itu. Cuba lagi."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Tidak dapat membaca tarikh pada {entries}, jadi ia kekal di hujung. Betulkan tarikhnya dan isih semula."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ne-NP.po b/apps/web/locales/ne-NP.po
index 2500276c2..931dfb98e 100644
--- a/apps/web/locales/ne-NP.po
+++ b/apps/web/locales/ne-NP.po
@@ -3962,6 +3962,10 @@ msgstr "त्यो फाइल पढ्न सकिएन। पुन: प
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} का मितिहरू पढ्न सकिएन, त्यसैले तिनीहरू अन्त्यमै रहन्छन्। तिनका मितिहरू सच्याएर फेरि क्रमबद्ध गर्नुहोस्।"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/nl-NL.po b/apps/web/locales/nl-NL.po
index ac794d3dd..763890aec 100644
--- a/apps/web/locales/nl-NL.po
+++ b/apps/web/locales/nl-NL.po
@@ -3962,6 +3962,10 @@ msgstr "Kan dat bestand niet lezen. Probeer het opnieuw."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Kan de datums van {entries} niet lezen, dus blijven ze onderaan. Corrigeer hun datums en sorteer opnieuw."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/no-NO.po b/apps/web/locales/no-NO.po
index 2b2ba2764..c1f5121d9 100644
--- a/apps/web/locales/no-NO.po
+++ b/apps/web/locales/no-NO.po
@@ -3962,6 +3962,10 @@ msgstr "Kunne ikke lese filen. Prøv igjen."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Kunne ikke lese datoene for {entries}, så de blir stående sist. Rett datoene og sorter på nytt."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/or-IN.po b/apps/web/locales/or-IN.po
index 7098c967f..b03614306 100644
--- a/apps/web/locales/or-IN.po
+++ b/apps/web/locales/or-IN.po
@@ -3962,6 +3962,10 @@ msgstr "ସେହି ଫାଇଲ୍ ପଢ଼ିହେଲା ନାହିଁ।
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} ର ତାରିଖ ପଢ଼ିହେଲା ନାହିଁ, ତେଣୁ ସେଗୁଡ଼ିକ ଶେଷରେ ରହିବ। ସେଗୁଡ଼ିକର ତାରିଖ ଠିକ୍ କରି ପୁଣି ସଜାନ୍ତୁ।"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/pl-PL.po b/apps/web/locales/pl-PL.po
index bafb12a3b..9f4646170 100644
--- a/apps/web/locales/pl-PL.po
+++ b/apps/web/locales/pl-PL.po
@@ -3962,6 +3962,10 @@ msgstr "Nie udało się odczytać tego pliku. Spróbuj ponownie."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Nie udało się odczytać dat wpisów {entries}, więc pozostają na końcu. Popraw ich daty i posortuj ponownie."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/pt-BR.po b/apps/web/locales/pt-BR.po
index aab5a0d7e..5f23c9b3a 100644
--- a/apps/web/locales/pt-BR.po
+++ b/apps/web/locales/pt-BR.po
@@ -3962,6 +3962,10 @@ msgstr "Não foi possível ler esse arquivo. Tente novamente."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Não foi possível ler as datas de {entries}, por isso elas ficam no final. Corrija as datas e ordene novamente."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/pt-PT.po b/apps/web/locales/pt-PT.po
index 1ac2ac3c8..784e15fe4 100644
--- a/apps/web/locales/pt-PT.po
+++ b/apps/web/locales/pt-PT.po
@@ -3962,6 +3962,10 @@ msgstr "Não foi possível ler esse ficheiro. Tente novamente."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Não foi possível ler as datas de {entries}, por isso ficam no fim. Corrija as datas e ordene novamente."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ro-RO.po b/apps/web/locales/ro-RO.po
index 36abdb01a..6df28397f 100644
--- a/apps/web/locales/ro-RO.po
+++ b/apps/web/locales/ro-RO.po
@@ -3962,6 +3962,10 @@ msgstr "Nu s-a putut citi fișierul. Încearcă din nou."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Nu s-au putut citi datele pentru {entries}, așa că rămân la final. Corectează datele și sortează din nou."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ru-RU.po b/apps/web/locales/ru-RU.po
index c0e030513..cbfaec4f7 100644
--- a/apps/web/locales/ru-RU.po
+++ b/apps/web/locales/ru-RU.po
@@ -3962,6 +3962,10 @@ msgstr "Не удалось прочитать этот файл. Попробу
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Не удалось распознать даты в {entries}, поэтому они остаются в конце. Исправьте даты и отсортируйте снова."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/sk-SK.po b/apps/web/locales/sk-SK.po
index 576ffb234..332248241 100644
--- a/apps/web/locales/sk-SK.po
+++ b/apps/web/locales/sk-SK.po
@@ -3962,6 +3962,10 @@ msgstr "Tento súbor sa nepodarilo prečítať. Skúste to znova."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Dátumy pri {entries} sa nepodarilo prečítať, preto zostávajú na konci. Opravte ich dátumy a zoraďte znova."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/sl-SI.po b/apps/web/locales/sl-SI.po
index 0a273c3aa..ef42aaf7d 100644
--- a/apps/web/locales/sl-SI.po
+++ b/apps/web/locales/sl-SI.po
@@ -3962,6 +3962,10 @@ msgstr "Te datoteke ni bilo mogoče prebrati. Poskusite znova."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Datumov pri {entries} ni bilo mogoče prebrati, zato ostanejo na koncu. Popravite njihove datume in znova razvrstite."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/sq-AL.po b/apps/web/locales/sq-AL.po
index 41c947100..d14893e9e 100644
--- a/apps/web/locales/sq-AL.po
+++ b/apps/web/locales/sq-AL.po
@@ -3962,6 +3962,10 @@ msgstr "Ai skedar nuk mund të lexohej. Provoni përsëri."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Datat te {entries} nuk mund të lexoheshin, prandaj mbeten në fund. Rregulloni datat e tyre dhe renditni përsëri."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/sr-SP.po b/apps/web/locales/sr-SP.po
index d6e64c998..b8f70f4e5 100644
--- a/apps/web/locales/sr-SP.po
+++ b/apps/web/locales/sr-SP.po
@@ -3962,6 +3962,10 @@ msgstr "Није могуће прочитати ту датотеку. Поку
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Није могуће прочитати датуме за {entries}, па остају на крају. Исправите њихове датуме и поново сортирајте."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/sv-SE.po b/apps/web/locales/sv-SE.po
index 059f91b9f..dc38cef50 100644
--- a/apps/web/locales/sv-SE.po
+++ b/apps/web/locales/sv-SE.po
@@ -3962,6 +3962,10 @@ msgstr "Det gick inte att läsa filen. Försök igen."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Det gick inte att läsa datumen för {entries}, så de hamnar sist. Rätta datumen och sortera igen."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/ta-IN.po b/apps/web/locales/ta-IN.po
index 7c4509539..0281f0a0c 100644
--- a/apps/web/locales/ta-IN.po
+++ b/apps/web/locales/ta-IN.po
@@ -3962,6 +3962,10 @@ msgstr "அந்தக் கோப்பைப் படிக்க முட
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} இல் உள்ள தேதிகளைப் படிக்க முடியவில்லை, எனவே அவை இறுதியில் இருக்கும். அவற்றின் தேதிகளைச் சரிசெய்து மீண்டும் வரிசைப்படுத்தவும்."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/te-IN.po b/apps/web/locales/te-IN.po
index be42462ea..4add7e4fc 100644
--- a/apps/web/locales/te-IN.po
+++ b/apps/web/locales/te-IN.po
@@ -3962,6 +3962,10 @@ msgstr "ఆ ఫైల్‌ను చదవడం సాధ్యపడలేద
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries}లోని తేదీలను చదవడం సాధ్యపడలేదు, కాబట్టి అవి చివరలోనే ఉంటాయి. వాటి తేదీలను సరిచేసి మళ్ళీ క్రమబద్ధీకరించండి."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/th-TH.po b/apps/web/locales/th-TH.po
index 851e2f8c1..cc47979ca 100644
--- a/apps/web/locales/th-TH.po
+++ b/apps/web/locales/th-TH.po
@@ -3962,6 +3962,10 @@ msgstr "อ่านไฟล์นั้นไม่ได้ ลองอี
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "อ่านวันที่ของ {entries} ไม่ได้ จึงยังอยู่ท้ายสุด แก้ไขวันที่แล้วจัดเรียงอีกครั้ง"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/tr-TR.po b/apps/web/locales/tr-TR.po
index 488863812..ffaa9c9cf 100644
--- a/apps/web/locales/tr-TR.po
+++ b/apps/web/locales/tr-TR.po
@@ -3962,6 +3962,10 @@ msgstr "Bu dosya okunamadı. Tekrar deneyin."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} içindeki tarihler okunamadı, bu yüzden sonda kalıyorlar. Tarihlerini düzeltip yeniden sıralayın."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/uk-UA.po b/apps/web/locales/uk-UA.po
index 0356401f9..0ddfeef62 100644
--- a/apps/web/locales/uk-UA.po
+++ b/apps/web/locales/uk-UA.po
@@ -3962,6 +3962,10 @@ msgstr "Не вдалося прочитати цей файл. Спробуйт
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Не вдалося прочитати дати в {entries}, тому вони залишаються в кінці. Виправте їхні дати й відсортуйте знову."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/uz-UZ.po b/apps/web/locales/uz-UZ.po
index 7a4605308..1a25326ff 100644
--- a/apps/web/locales/uz-UZ.po
+++ b/apps/web/locales/uz-UZ.po
@@ -3962,6 +3962,10 @@ msgstr "Bu faylni o'qib bo'lmadi. Qayta urinib ko'ring."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "{entries} dagi sanalarni o'qib bo'lmadi, shuning uchun ular oxirida qoladi. Sanalarini tuzating va qayta tartiblang."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/vi-VN.po b/apps/web/locales/vi-VN.po
index a60ceccdb..d5a378388 100644
--- a/apps/web/locales/vi-VN.po
+++ b/apps/web/locales/vi-VN.po
@@ -3962,6 +3962,10 @@ msgstr "Không thể đọc tệp đó. Hãy thử lại."
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "Không thể đọc ngày của {entries}, nên chúng vẫn ở cuối. Hãy sửa ngày rồi sắp xếp lại."
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/zh-CN.po b/apps/web/locales/zh-CN.po
index 775c563af..8327b5c7f 100644
--- a/apps/web/locales/zh-CN.po
+++ b/apps/web/locales/zh-CN.po
@@ -3962,6 +3962,10 @@ msgstr "无法读取该文件。请重试。"
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "无法读取 {entries} 的日期,因此它们保留在末尾。请修正日期后重新排序。"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/zh-TW.po b/apps/web/locales/zh-TW.po
index 8d2fc1877..a3c4d5076 100644
--- a/apps/web/locales/zh-TW.po
+++ b/apps/web/locales/zh-TW.po
@@ -3962,6 +3962,10 @@ msgstr "無法讀取該檔案。請再試一次。"
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr "無法讀取 {entries} 的日期,因此它們保留在末尾。請修正日期後重新排序。"
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/locales/zu-ZA.po b/apps/web/locales/zu-ZA.po
index 4f49e534b..3f313bd97 100644
--- a/apps/web/locales/zu-ZA.po
+++ b/apps/web/locales/zu-ZA.po
@@ -3957,6 +3957,10 @@ msgstr ""
msgid "Couldn't read the dates on {entries}, so they stay at the end. Fix their dates and sort again."
msgstr ""
+#: src/features/resume/import/pdf-text.ts
+msgid "Couldn't read the whole PDF. Split it into smaller files and try again."
+msgstr ""
+
#. placeholder {0}: part.errorText
#: src/features/assistant/conversation.tsx
msgid "Couldn't read this page: {0}"
diff --git a/apps/web/src/features/resume/import/error.ts b/apps/web/src/features/resume/import/error.ts
new file mode 100644
index 000000000..99a158c8d
--- /dev/null
+++ b/apps/web/src/features/resume/import/error.ts
@@ -0,0 +1,2 @@
+/** An import failure worded for the person importing. */
+export class ImportError extends Error {}
diff --git a/apps/web/src/features/resume/import/pdf-text.test.ts b/apps/web/src/features/resume/import/pdf-text.test.ts
index b8dec445c..7534c2d78 100644
--- a/apps/web/src/features/resume/import/pdf-text.test.ts
+++ b/apps/web/src/features/resume/import/pdf-text.test.ts
@@ -1,13 +1,16 @@
import type { RawExtraction } from "@reactive-resume/resume/ats-pdf";
-import { describe, expect, it, vi } from "vite-plus/test";
+import { beforeAll, describe, expect, it, vi } from "vite-plus/test";
+import { i18n } from "@lingui/core";
import { parseResumeText } from "@reactive-resume/import/plain-text";
import { buildExtractedDocument } from "@reactive-resume/resume/ats-pdf";
import { documentToLines } from "./pdf-text";
-import { readResumeFile } from "./read-file";
+import { ImportError, readResumeFile } from "./read-file";
const extract = vi.hoisted(() => vi.fn());
vi.mock("@/features/ats-checker/extract-client", () => ({ extractPdf: extract }));
+beforeAll(() => i18n.loadAndActivate({ locale: "en-US", messages: {} }));
+
const PAGE = { width: 595, height: 842 };
const FONT_SIZE = 10;
const CHAR_WIDTH = 5;
@@ -57,6 +60,14 @@ function rawExtraction(pages: FixtureItem[][]): RawExtraction {
const linesOf = (...pages: FixtureItem[][]) => documentToLines(buildExtractedDocument(rawExtraction(pages)));
+it("refuses a partial PDF harvest before it can report a successful no-AI import", async () => {
+ const raw = rawExtraction([[{ text: "Only the first harvested page", x: 40, y: 60 }]]);
+ extract.mockResolvedValue({ ...raw, pageCount: 31, truncated: true });
+ const result = readResumeFile(new File(["%PDF-fixture"], "resume.pdf"), "pdf", { aiAvailable: false });
+ await expect(result).rejects.toThrow(ImportError);
+ await expect(result).rejects.toThrow("Split it into smaller files and try again.");
+});
+
describe("documentToLines", () => {
it("groups items on the same baseline into one line", () => {
expect(
diff --git a/apps/web/src/features/resume/import/pdf-text.ts b/apps/web/src/features/resume/import/pdf-text.ts
index aca426cd9..9838c9b53 100644
--- a/apps/web/src/features/resume/import/pdf-text.ts
+++ b/apps/web/src/features/resume/import/pdf-text.ts
@@ -1,10 +1,14 @@
+import { t } from "@lingui/core/macro";
import { parsePdfResume } from "@reactive-resume/import/pdf-lines";
import { buildExtractedDocument } from "@reactive-resume/resume/ats-pdf";
+import { ImportError } from "./error";
import { extractPdf } from "@/features/ats-checker/extract-client";
export { documentToLines } from "@reactive-resume/import/pdf-lines";
export async function readPdfResume(file: File) {
- const doc = buildExtractedDocument(await extractPdf(file, { operatorBudgetMs: 0 }));
+ const raw = await extractPdf(file, { operatorBudgetMs: 0 });
+ if (raw.truncated) throw new ImportError(t`Couldn't read the whole PDF. Split it into smaller files and try again.`);
+ const doc = buildExtractedDocument(raw);
return doc.lines.length ? parsePdfResume(doc) : null;
}
diff --git a/apps/web/src/features/resume/import/read-file.ts b/apps/web/src/features/resume/import/read-file.ts
index 6d80d9320..122383a17 100644
--- a/apps/web/src/features/resume/import/read-file.ts
+++ b/apps/web/src/features/resume/import/read-file.ts
@@ -6,8 +6,11 @@ import { parseReactiveResumeV4JSON } from "@reactive-resume/import/reactive-resu
import { convertLegacyStylesheet, needsLegacyStyleConversion } from "@reactive-resume/pdf/semantic-legacy";
import { forEachDatedEntry, hasUnreadableDateText } from "@reactive-resume/schema/resume/dates";
import { stripHtml } from "@reactive-resume/utils/string";
+import { ImportError } from "./error";
import { client } from "@/libs/orpc/client";
+export { ImportError } from "./error";
+
/** What a file holds, read from its bytes and shape rather than its extension or type. */
export type ImportKind =
| "pdf"
@@ -20,9 +23,6 @@ export type ImportKind =
type ResumeJsonKind = "reactive-resume-json" | "reactive-resume-v4-json" | "json-resume-json";
-/** An import failure worded for the person importing. */
-export class ImportError extends Error {}
-
// Exports from before Semantic CSS carry legacy style rules, which nothing renders any more: they come in converted.
const withLegacyStylesConverted = (data: ResumeData): ResumeData =>
needsLegacyStyleConversion(data.metadata)
diff --git a/docs/guides/importing-resumes.mdx b/docs/guides/importing-resumes.mdx
index ef67b2c3e..88ab8e9ca 100644
--- a/docs/guides/importing-resumes.mdx
+++ b/docs/guides/importing-resumes.mdx
@@ -109,6 +109,8 @@ Go through every section before you send the resume. PDF and Word files don't st
/>
</Frame>
+**"Couldn't read the whole PDF."** Text-layer import supports up to 30 pages. Split a longer PDF into smaller files and import each separately. A partial file is never imported as a complete resume.
+
**"This PDF is a scanned image."** Try the Word version of the resume, set up an AI provider, or start blank and paste your sections in.
**"This ZIP doesn't look like a LinkedIn data export."** Make sure you're importing the archive LinkedIn sent you, not a ZIP you made yourself.
diff --git a/packages/api/src/features/resume/fixtures/pdf-education.ts b/packages/api/src/features/resume/fixtures/pdf-education.ts
index 1ba857df4..3fc4775cc 100644
--- a/packages/api/src/features/resume/fixtures/pdf-education.ts
+++ b/packages/api/src/features/resume/fixtures/pdf-education.ts
@@ -1,7 +1,9 @@
import type { ResumeData } from "@reactive-resume/schema/resume/data";
import { readLegacyDates } from "@reactive-resume/schema/resume/dates";
+import { sectionDefaults } from "@reactive-resume/schema/resume/default";
import { defaultResumeData } from "@reactive-resume/schema/resume/default";
import { templateSchema } from "@reactive-resume/schema/templates";
+import { ownershipSource } from "./pdf-ownership";
export const educationCases = templateSchema.options.flatMap((template) =>
[
@@ -160,3 +162,66 @@ export function educationWords(items: ResumeData["sections"]["education"]["items
.match(/[\p{L}\p{N}]+/gu) ?? []
);
}
+
+export const educationOwnershipCases = templateSchema.options.flatMap((template) =>
+ ["full-before", "two-before"].flatMap((layout) =>
+ ["distinct", "identical", "substring-short", "substring-long", "mentioned", "three-runs"].map((kind) => ({
+ template,
+ layout,
+ kind,
+ })),
+ ),
+);
+
+export function educationOwnershipSource({ template, layout, kind }: (typeof educationOwnershipCases)[number]) {
+ const source = ownershipSource({ template, kind: layout });
+ const first = source.sections.education.items[0];
+ const page = source.metadata.layout.pages[0];
+ if (!first || !page) throw new Error("Missing Education fixture");
+ if (kind === "substring-short") first.school = "Leeds College";
+ if (kind === "substring-long") first.school = "Leeds College of Art";
+ const second = {
+ ...structuredClone(first),
+ id: "qualification-1",
+ school:
+ kind === "identical" || kind === "three-runs"
+ ? first.school
+ : kind === "substring-short"
+ ? "Leeds College of Art"
+ : kind === "substring-long"
+ ? "Leeds College"
+ : "Northfield Institute",
+ degree: "PGCert",
+ area: "Teaching",
+ location: "York, UK",
+ period: "2018 – 2019",
+ dates: readLegacyDates("2018 – 2019", { locale: "en-US", single: false }),
+ website: { url: "https://example.invalid/quals", label: "Details", inlineLink: false },
+ description:
+ kind === "mentioned"
+ ? `<p>Evening programme accredited by ${first.school}.</p>`
+ : "<p>Evening programme in adult education.</p>",
+ };
+ const add = (id: string, title: string, item: typeof second) => {
+ source.customSections.push({ ...sectionDefaults(id), id, type: "education", title, items: [item] });
+ page.main.splice(page.main.indexOf("education") + 1, 0, id);
+ };
+ add("quals", "Qualifications", second);
+ if (kind === "three-runs") {
+ source.sections.education.items.push({
+ ...structuredClone(second),
+ id: "masters",
+ degree: "MSc",
+ area: "Data Science",
+ website: { ...second.website, url: "https://example.invalid/masters" },
+ });
+ add("training", "Education and Training", {
+ ...structuredClone(second),
+ id: "training-cert",
+ degree: "Certificate",
+ area: "Accessible Computing",
+ website: { ...second.website, url: "https://example.invalid/training" },
+ });
+ }
+ return source;
+}
diff --git a/packages/api/src/features/resume/import-annotations.test.ts b/packages/api/src/features/resume/import-annotations.test.ts
new file mode 100644
index 000000000..c1f0b7389
--- /dev/null
+++ b/packages/api/src/features/resume/import-annotations.test.ts
@@ -0,0 +1,469 @@
+import type { ResumeData } from "@reactive-resume/schema/resume/data";
+import { expect, it, vi } from "vite-plus/test";
+import { call } from "@orpc/server";
+import { createResumePdfFile } from "@reactive-resume/pdf/server";
+import { templateSchema } from "@reactive-resume/schema/templates";
+import { ownershipSource } from "./fixtures/pdf-ownership";
+
+const create = vi.hoisted(() => vi.fn().mockResolvedValue("imported"));
+vi.mock("./service", () => ({ resumeService: { create } }));
+vi.mock("@reactive-resume/auth/config", () => ({
+ auth: { api: { getSession: vi.fn().mockResolvedValue({ user: { id: "owner" } }) } },
+ verifyOAuthToken: vi.fn(),
+}));
+vi.mock("@reactive-resume/db/client", () => ({
+ db: { select: () => ({ from: () => ({ where: () => ({ limit: async () => [{ id: "owner", banned: false }] }) }) }) },
+}));
+const { importResumeFile } = await import("./imports");
+
+const keys = ["education", "projects", "experience"] as const;
+const linkText = "Read the thesis";
+const longText =
+ "Read the complete published thesis about distributed accessible scheduling systems and their careful evaluation across many fictional institutions";
+const paragraph = "Studied systems.";
+const linkedParagraph = (text: string) => `<p><a href="https://desc.example/thesis">${text}</a></p>`;
+const plain = (html: string) =>
+ html
+ .replace(/<[^>]+>/g, " ")
+ .replace(/\s+/g, " ")
+ .trim();
+const cases = templateSchema.options.flatMap((template) =>
+ ["full-before", "two-before"].flatMap((layout) =>
+ [
+ "leading-link",
+ "bare-url",
+ "uppercase-body",
+ "uppercase-sublabels-short",
+ "wrapped-link",
+ "no-website",
+ "no-website-leading-link",
+ "no-website-wrapped-link",
+ "references-first",
+ ].map((kind) => ({ template, layout, kind })),
+ ),
+);
+
+/** Keep only Summary, Experience and Education, as in a short resume. */
+function keepShortResume(source: ResumeData) {
+ for (const key of Object.keys(source.sections) as (keyof typeof source.sections)[])
+ if (key !== "experience" && key !== "education") source.sections[key].items = [];
+ source.customSections = [];
+ for (const page of source.metadata.layout.pages) {
+ page.main = page.main.filter((id) => ["summary", "experience", "education"].includes(id));
+ page.sidebar = [];
+ }
+}
+
+async function save(data: ResumeData, template: (typeof templateSchema.options)[number]) {
+ const file = await createResumePdfFile({ data, template, filename: "annotations.pdf" });
+ create.mockClear();
+ await call(importResumeFile, { file, format: "PDF" }, { context: { locale: "en-US", reqHeaders: new Headers() } });
+ expect(create).toHaveBeenCalledTimes(1);
+ const saved = create.mock.calls[0]?.[0] as { userId: string; data: ResumeData } | undefined;
+ if (!saved) throw new Error("Import did not save a resume");
+ expect(saved.userId).toBe("owner");
+ return saved.data;
+}
+
+it.each(cases)(
+ "keeps annotation and body ownership / $template / $layout / $kind",
+ async ({ template, layout, kind }) => {
+ const source = ownershipSource({ template, kind: layout });
+ for (const key of keys) {
+ const item = source.sections[key].items[0];
+ if (!item) throw new Error("Missing source record");
+ if (kind === "bare-url") item.website.label = "";
+ if (kind === "leading-link") item.description = linkedParagraph(linkText) + `<p>${paragraph}</p>`;
+ if (kind === "wrapped-link") item.description = `<p>${paragraph}</p>` + linkedParagraph(longText);
+ if (kind === "no-website" || kind === "no-website-wrapped-link") {
+ item.website = { url: "", label: "", inlineLink: false };
+ item.description = `<p>${paragraph}</p>` + linkedParagraph(kind === "no-website" ? linkText : longText);
+ }
+ if (kind === "no-website-leading-link") {
+ item.website = { url: "", label: "", inlineLink: false };
+ item.description = linkedParagraph(linkText) + `<p>${paragraph}</p>`;
+ }
+ }
+ const experience = source.sections.experience.items[0];
+ if (!experience) throw new Error("Missing experience");
+ if (kind === "uppercase-body")
+ experience.description = "<ul><li>Built reliable tools.</li></ul><p>REFERENCES</p><p>Mentored engineers.</p>";
+ if (kind === "uppercase-sublabels-short") {
+ // A short resume: role sub-labels in the body style must not outnumber its few real headings.
+ experience.description =
+ "<p>ACHIEVEMENTS</p><ul><li>Cut costs by a fifth.</li></ul><p>PROJECTS</p><ul><li>Built Atlas tooling.</li></ul><p>SKILLS</p><ul><li>Led platform reviews.</li></ul>";
+ keepShortResume(source);
+ }
+ if (kind === "references-first")
+ for (const page of source.metadata.layout.pages) {
+ // A reference's phone and link sit where identity contacts often do: just below Summary or atop the sidebar.
+ page.main = page.main.filter((id) => id !== "references");
+ if (page.fullWidth) page.main.splice(1, 0, "references");
+ else page.sidebar.unshift("references");
+ }
+ const data = await save(source, template);
+ if (kind === "references-first") {
+ expect(data.basics.website).toEqual(source.basics.website);
+ expect(data.basics.customFields).toEqual([]);
+ expect(data.sections.references.items).toHaveLength(1);
+ expect(data.sections.references.items[0]?.name).toBe("Pat Example");
+ expect(data.sections.references.items[0]?.website).toEqual(source.sections.references.items[0]?.website);
+ } else if (kind === "uppercase-sublabels-short") {
+ expect(plain(data.summary.content)).toBe(plain(source.summary.content));
+ expect(data.sections.experience.items).toHaveLength(1);
+ expect(data.sections.experience.items[0]?.website).toEqual(experience.website);
+ expect(plain(data.sections.experience.items[0]?.description ?? "")).toBe(
+ "ACHIEVEMENTS Cut costs by a fifth. PROJECTS Built Atlas tooling. SKILLS Led platform reviews.",
+ );
+ expect(data.sections.education.items).toHaveLength(1);
+ expect(data.sections.education.items[0]?.school).toBe(source.sections.education.items[0]?.school);
+ expect(data.sections.education.items[0]?.website).toEqual(source.sections.education.items[0]?.website);
+ for (const key of ["projects", "skills", "awards"] as const) expect(data.sections[key].items).toEqual([]);
+ } else if (kind === "bare-url") {
+ expect(data.basics.website).toEqual(source.basics.website);
+ expect(data.basics.customFields).toEqual([]);
+ } else if (kind === "uppercase-body") {
+ expect(plain(data.sections.experience.items[0]?.description ?? "")).toBe(
+ "Built reliable tools. REFERENCES Mentored engineers.",
+ );
+ expect(data.sections.references.items.map((item) => item.name)).not.toContain("Mentored engineers.");
+ } else
+ for (const key of keys) {
+ const expected = source.sections[key].items[0];
+ const actual = data.sections[key].items[0];
+ if (!expected || !actual) throw new Error(`Missing ${key} record`);
+ expect(actual.website).toEqual(expected.website);
+ expect(plain(actual.description)).toBe(plain(expected.description));
+ }
+ },
+ 60000,
+);
+
+it("keeps a Research interest beneath its real heading", async () => {
+ const source = ownershipSource({ template: "azurill", kind: "two-before" });
+ const interest = source.sections.interests.items[0];
+ if (!interest) throw new Error("Missing source interest");
+ interest.name = "RESEARCH";
+ const data = await save(source, "azurill");
+ expect(data.sections.interests.items[0]?.name).toBe("RESEARCH");
+});
+
+const subLabels = [
+ ["ACHIEVEMENTS", "Cut costs by a fifth."],
+ ["PROJECTS", "Built Atlas tooling."],
+ ["SKILLS", "Led platform reviews."],
+ ["LANGUAGES", "Spoke at regional meetups."],
+] as const;
+const subLabelCases = templateSchema.options.flatMap((template) =>
+ ["full-before", "two-before"].flatMap((layout) =>
+ [
+ { heading: 9.5, labels: 4, emphasis: "" },
+ { heading: 10, labels: 3, emphasis: "" },
+ { heading: 10.5, labels: 4, emphasis: "" },
+ { heading: 10.5, labels: 4, emphasis: "strong" },
+ { heading: 10.8, labels: 4, emphasis: "" },
+ ].map((typography) => ({ template, layout, ...typography })),
+ ),
+);
+
+it.each(subLabelCases)(
+ "keeps short-resume sections beside role sub-labels / $template / $layout / heading $heading / $labels $emphasis",
+ async ({ template, layout, heading, labels, emphasis }) => {
+ // Headings close to the 10pt body size: only the real heading style may set the alias-count bar.
+ const source = ownershipSource({ template, kind: layout });
+ keepShortResume(source);
+ source.metadata.typography.heading = { ...source.metadata.typography.heading, fontSize: heading };
+ const runs = subLabels.slice(0, labels);
+ const experience = source.sections.experience.items[0];
+ const education = source.sections.education.items[0];
+ if (!experience || !education) throw new Error("Missing source record");
+ experience.description = runs
+ .map(
+ ([label, bullet]) =>
+ `<p>${emphasis ? `<${emphasis}>${label}</${emphasis}>` : label}</p><ul><li>${bullet}</li></ul>`,
+ )
+ .join("");
+ const data = await save(source, template);
+ expect(plain(data.summary.content)).toBe(plain(source.summary.content));
+ expect(data.sections.experience.items).toHaveLength(1);
+ expect(data.sections.experience.items[0]).toMatchObject({
+ company: experience.company,
+ position: experience.position,
+ website: experience.website,
+ });
+ expect(plain(data.sections.experience.items[0]?.description ?? "")).toBe(runs.flat().join(" "));
+ expect(data.sections.education.items).toHaveLength(1);
+ expect(data.sections.education.items[0]).toMatchObject({ school: education.school, website: education.website });
+ for (const key of ["projects", "skills", "awards", "languages"] as const)
+ expect(data.sections[key].items).toEqual([]);
+ },
+ 60000,
+);
+
+it.each(
+ templateSchema.options.flatMap((template) => ["full-before", "two-before"].map((layout) => ({ template, layout }))),
+)(
+ "keeps body words when every section title is hidden / $template / $layout",
+ async ({ template, layout }) => {
+ // Word retention only: without printed titles the sections cannot be recovered as structure.
+ const source = ownershipSource({ template, kind: layout });
+ source.summary.showHeading = false;
+ for (const key of Object.keys(source.sections) as (keyof typeof source.sections)[])
+ source.sections[key].showHeading = false;
+ for (const section of source.customSections) section.showHeading = false;
+ const text = JSON.stringify(await save(source, template));
+ for (const words of [
+ plain(source.summary.content),
+ "eBay",
+ "Built reliable tools for customers across every supported device.",
+ "Mentored engineers with exact complete wording.",
+ "Open-source scheduling toolkit.",
+ ])
+ expect(text).toContain(words);
+ },
+ 60000,
+);
+
+const longBullet = (role: number, label: number, bullet: number) =>
+ `Delivered careful fictional platform outcome ${role}-${label}-${bullet} for regional partners while keeping every accessible workflow available`;
+const roleLabelCases = templateSchema.options.flatMap((template) =>
+ ["full-before", "two-before"].flatMap((layout) =>
+ [
+ { trigger: "blank line", heading: 10, roles: 1, bullets: 1, emphasis: "" },
+ { trigger: "blank line", heading: 10.5, roles: 1, bullets: 1, emphasis: "" },
+ { trigger: "page break", heading: 10.5, roles: 3, bullets: 1, emphasis: "" },
+ { trigger: "page break", heading: 10.5, roles: 3, bullets: 3, emphasis: "" },
+ { trigger: "page break", heading: 10.5, roles: 3, bullets: 3, emphasis: "strong" },
+ ].map((variant) => ({ template, layout, ...variant })),
+ ),
+);
+
+it.each(roleLabelCases)(
+ "keeps entries when a role sub-label is isolated / $template / $layout / $trigger / heading $heading / $roles roles x $bullets $emphasis",
+ async ({ template, layout, trigger, heading, roles, bullets, emphasis }) => {
+ // A blank paragraph or a page top isolates a body sub-label; it must not outvote the real heading style.
+ const source = ownershipSource({ template, kind: layout });
+ keepShortResume(source);
+ source.metadata.typography.heading = { ...source.metadata.typography.heading, fontSize: heading };
+ const first = source.sections.experience.items[0];
+ const education = source.sections.education.items[0];
+ if (!first || !education) throw new Error("Missing source record");
+ for (let role = 1; role <= roles; role++) {
+ const item = role === 1 ? first : structuredClone(first);
+ if (role > 1) {
+ item.id = `${first.id}-${role}`;
+ item.company = `Fictional Company ${role}`;
+ item.position = `Staff Engineer ${role}`;
+ item.website = { url: `https://example.invalid/experience-${role}`, label: "Details", inlineLink: false };
+ source.sections.experience.items.push(item);
+ }
+ item.description = subLabels
+ .map(([label, bullet], index) => {
+ const items = [bullet, ...Array.from({ length: bullets - 1 }, (_, n) => longBullet(role, index, n + 1))];
+ const text = emphasis ? `<${emphasis}>${label}</${emphasis}>` : label;
+ return `${trigger === "blank line" ? "<p></p>" : ""}<p>${text}</p><ul>${items.map((entry) => `<li>${entry}</li>`).join("")}</ul>`;
+ })
+ .join("");
+ }
+ const data = await save(source, template);
+ expect(plain(data.summary.content)).toBe(plain(source.summary.content));
+ expect(data.sections.experience.items).toHaveLength(roles);
+ source.sections.experience.items.forEach((expected, index) => {
+ const actual = data.sections.experience.items[index];
+ expect(actual).toMatchObject({
+ company: expected.company,
+ position: expected.position,
+ website: expected.website,
+ });
+ expect(plain(actual?.description ?? "")).toBe(plain(expected.description));
+ });
+ expect(data.sections.education.items).toHaveLength(1);
+ expect(data.sections.education.items[0]).toMatchObject({ school: education.school, website: education.website });
+ for (const key of ["projects", "skills", "awards", "languages"] as const)
+ expect(data.sections[key].items).toEqual([]);
+ },
+ 60000,
+);
+
+const headingStyleCases = templateSchema.options.flatMap((template) =>
+ ["full-before", "two-before"].flatMap((layout) =>
+ ["body font", "body size", "sub-labels 10.5"].map((style) => ({ template, layout, style })),
+ ),
+);
+
+it.each(headingStyleCases)(
+ "keeps a full resume's entries with headings in the $style / $template / $layout",
+ async ({ template, layout, style }) => {
+ const source = ownershipSource({ template, kind: layout });
+ const { body, heading } = source.metadata.typography;
+ if (style === "body font") source.metadata.typography.heading = { ...body };
+ if (style === "body size") source.metadata.typography.heading = { ...heading, fontSize: body.fontSize };
+ const experience = source.sections.experience.items[0];
+ const education = source.sections.education.items[0];
+ if (!experience || !education) throw new Error("Missing source record");
+ if (style === "sub-labels 10.5") {
+ source.metadata.typography.heading = { ...heading, fontSize: 10.5 };
+ experience.description = subLabels
+ .map(([label, bullet]) => `<p>${label}</p><ul><li>${bullet}</li></ul>`)
+ .join("");
+ }
+ const data = await save(source, template);
+ expect(plain(data.summary.content)).toBe(plain(source.summary.content));
+ expect(data.sections.experience.items[0]).toMatchObject({
+ company: experience.company,
+ position: experience.position,
+ });
+ expect(plain(data.sections.experience.items[0]?.description ?? "")).toBe(plain(experience.description));
+ expect(data.sections.education.items.map((item) => item.school)).toEqual([education.school]);
+ },
+ 60000,
+);
+
+it.each(
+ templateSchema.options.flatMap((template) => ["full-before", "two-before"].map((layout) => ({ template, layout }))),
+)(
+ "keeps a header-only PDF with linked custom fields out of Summary / $template / $layout",
+ async ({ template, layout }) => {
+ const source = ownershipSource({ template, kind: layout });
+ source.basics.customFields = ownershipSource({ template, kind: "custom-links" }).basics.customFields;
+ source.summary.content = "";
+ for (const key of Object.keys(source.sections) as (keyof typeof source.sections)[]) source.sections[key].items = [];
+ source.customSections = [];
+ const data = await save(source, template);
+ expect(data.summary.content).toBe("");
+ expect(Object.values(data.sections).reduce((count, section) => count + section.items.length, 0)).toBe(0);
+ expect([data.basics.email, data.basics.phone]).toEqual([source.basics.email, source.basics.phone]);
+ },
+ 60000,
+);
+
+it.each(
+ templateSchema.options.flatMap((template) => ["full-before", "two-before"].map((layout) => ({ template, layout }))),
+)(
+ "keeps body words but not identity in Summary when Summary and Experience titles are hidden / $template / $layout",
+ async ({ template, layout }) => {
+ // Word retention only: with no printed title the role cannot be recovered as an entry.
+ const source = ownershipSource({ template, kind: layout });
+ for (const key of Object.keys(source.sections) as (keyof typeof source.sections)[])
+ if (key !== "experience") source.sections[key].items = [];
+ source.customSections = [];
+ source.summary.showHeading = false;
+ source.sections.experience.showHeading = false;
+ const experience = source.sections.experience.items[0];
+ if (!experience) throw new Error("Missing source record");
+ const data = await save(source, template);
+ expect([data.basics.email, data.basics.phone, data.basics.website.url]).toEqual([
+ source.basics.email,
+ source.basics.phone,
+ source.basics.website.url,
+ ]);
+ const summary = plain(data.summary.content);
+ for (const identity of [source.basics.email, source.basics.phone]) expect(summary).not.toContain(identity);
+ const text = plain(JSON.stringify(data));
+ for (const words of [
+ plain(source.summary.content),
+ experience.company,
+ ...plain(experience.description).split(". "),
+ ])
+ expect(text).toContain(words.replace(/\.$/, ""));
+ },
+ 60000,
+);
+
+const isolatedLabelCases = templateSchema.options.flatMap((template) =>
+ ["full-before", "two-before"].flatMap((layout) =>
+ [
+ "bold labels once after blank lines / heading 10.5",
+ "bold labels once after blank lines / heading 10",
+ "bold labels once across a page / heading 10.5",
+ "Technical Skills title and a bold label / heading 10.5",
+ "Achievements title and a bold label / heading 10.5",
+ "Qualifications title and a bold label / heading 10.5",
+ "Technical Skills title and a Languages skill group / heading 10.5",
+ "body typography headings and a bold label",
+ "Speaking section and a bold label / heading 10.5",
+ ].map((variant) => ({ template, layout, variant })),
+ ),
+);
+
+it.each(isolatedLabelCases)(
+ "keeps the real sections beside isolated or duplicated labels / $template / $layout / $variant",
+ async ({ template, layout, variant }) => {
+ // A sub-label style inside one section, or a second title for one section key, must not unseat the real headings.
+ const source = ownershipSource({ template, kind: layout });
+ const talk = source.customSections[0];
+ if (!talk) throw new Error("Missing source custom section");
+ const custom = (id: string, title: string) => {
+ source.customSections.push({
+ ...structuredClone(talk),
+ id,
+ title,
+ items: [
+ { id: `${id}-1`, hidden: false, content: "<p>Certified first aider with current fictional credentials.</p>" },
+ ],
+ });
+ const page = source.metadata.layout.pages[0];
+ if (page && !page.fullWidth && title !== "Speaking" && title !== "Qualifications") page.sidebar.push(id);
+ else page?.main.push(id);
+ };
+ const short =
+ variant.startsWith("bold labels") || variant.startsWith("Qualifications") || variant.startsWith("Speaking");
+ if (short) keepShortResume(source);
+ const size = /heading ([\d.]+)/.exec(variant)?.[1];
+ if (size) source.metadata.typography.heading = { ...source.metadata.typography.heading, fontSize: Number(size) };
+ if (variant.startsWith("body typography"))
+ source.metadata.typography.heading = { ...source.metadata.typography.body };
+ const experience = source.sections.experience.items[0];
+ const education = source.sections.education.items[0];
+ if (!experience || !education) throw new Error("Missing source record");
+ const bold = (label: string, bullets: string[]) =>
+ `<p><strong>${label}</strong></p><ul>${bullets.map((bullet) => `<li>${bullet}</li>`).join("")}</ul>`;
+ if (variant.includes("blank lines"))
+ experience.description = subLabels.map(([label, bullet]) => `<p></p>${bold(label, [bullet])}`).join("");
+ else if (variant.includes("across a page"))
+ experience.description = subLabels
+ .map(([label, bullet], index) =>
+ bold(label, [bullet, ...Array.from({ length: 9 }, (_, n) => longBullet(1, index, n + 1))]),
+ )
+ .join("");
+ else if (!variant.includes("skill group"))
+ experience.description += `<p></p>${bold("Projects", ["Built Atlas tooling."])}`;
+ if (variant.startsWith("Technical Skills")) custom("techskills", "Technical Skills");
+ if (variant.startsWith("Achievements")) custom("achievements", "Achievements");
+ if (variant.startsWith("Qualifications")) custom("qualifications", "Qualifications");
+ if (variant.startsWith("Speaking")) custom("speaking", "Speaking");
+ const skill = source.sections.skills.items[0];
+ if (variant.includes("skill group") && skill) {
+ skill.name = "Languages";
+ skill.keywords = ["TypeScript", "Go"];
+ }
+ const data = await save(source, template);
+ expect(plain(data.summary.content)).toBe(plain(source.summary.content));
+ expect(data.sections.experience.items).toHaveLength(1);
+ expect(data.sections.experience.items[0]).toMatchObject({
+ company: experience.company,
+ position: experience.position,
+ website: experience.website,
+ });
+ expect(plain(data.sections.experience.items[0]?.description ?? "")).toBe(plain(experience.description));
+ expect(data.sections.education.items[0]?.school).toBe(education.school);
+ // Known smeargle limit: with body-style headings an isolated degree line takes the Education website.
+ if (!(template === "smeargle" && variant.startsWith("body typography")))
+ expect(data.sections.education.items[0]?.website).toEqual(education.website);
+ if (!short) expect(data.sections.projects.items[0]?.name).toBe(source.sections.projects.items[0]?.name);
+ if (variant.includes("skill group"))
+ expect(data.sections.skills.items.map((item) => item.name)).toContain("Languages");
+ const text = plain(JSON.stringify(data));
+ if (variant.startsWith("Qualifications"))
+ expect(text).toContain("Certified first aider with current fictional credentials");
+ if (variant.startsWith("Speaking"))
+ // Some templates print section titles in capitals or letter-spaced; the title text is what the PDF carries.
+ expect(
+ data.customSections.map((section) => [
+ section.title.toLowerCase().replace(/\s/g, ""),
+ plain(section.items[0]?.content ?? ""),
+ ]),
+ ).toContainEqual(["speaking", "Certified first aider with current fictional credentials."]);
+ },
+ 60000,
+);
diff --git a/packages/api/src/features/resume/import-education.test.ts b/packages/api/src/features/resume/import-education.test.ts
index c59d1ef88..ae209e646 100644
--- a/packages/api/src/features/resume/import-education.test.ts
+++ b/packages/api/src/features/resume/import-education.test.ts
@@ -1,4 +1,4 @@
-import type { ResumeData } from "@reactive-resume/schema/resume/data";
+import type { EducationItem, ResumeData } from "@reactive-resume/schema/resume/data";
import { expect, it, vi } from "vite-plus/test";
import { call } from "@orpc/server";
import { createResumePdfFile } from "@reactive-resume/pdf/server";
@@ -13,7 +13,14 @@ vi.mock("@reactive-resume/db/client", () => ({
}));
const { importResumeFile } = await import("./imports");
-import { educationCases, educationSource, educationFields, educationWords } from "./fixtures/pdf-education";
+import {
+ educationCases,
+ educationSource,
+ educationFields,
+ educationWords,
+ educationOwnershipCases,
+ educationOwnershipSource,
+} from "./fixtures/pdf-education";
const save = async (file: File) => {
create.mockClear();
await call(importResumeFile, { file, format: "PDF" }, { context: { locale: "en-US", reqHeaders: new Headers() } });
@@ -36,3 +43,23 @@ it.each(educationCases)(
},
60000,
);
+
+it.each(educationOwnershipCases)(
+ "preserves ordered fields across Education runs / $template / $layout / $kind",
+ async (c) => {
+ const source = educationOwnershipSource(c);
+ const expected = source.metadata.layout.pages
+ .flatMap((page) => [...page.main, ...page.sidebar])
+ .flatMap((id) =>
+ id === "education"
+ ? source.sections.education.items
+ : source.customSections.flatMap((section) =>
+ section.id === id && section.type === "education" ? (section.items as EducationItem[]) : [],
+ ),
+ );
+ const file = await createResumePdfFile({ data: source, template: c.template, filename: "education-runs.pdf" });
+ const data = await save(file);
+ expect(educationFields(data.sections.education.items)).toEqual(educationFields(expected));
+ },
+ 60000,
+);
diff --git a/packages/import/src/pdf-lines.test.ts b/packages/import/src/pdf-lines.test.ts
index 01e9fdfbc..24cfbb9a0 100644
--- a/packages/import/src/pdf-lines.test.ts
+++ b/packages/import/src/pdf-lines.test.ts
@@ -1,34 +1,35 @@
import type { RawExtraction } from "@reactive-resume/resume/ats-pdf";
import { expect, it } from "vite-plus/test";
import { buildExtractedDocument } from "@reactive-resume/resume/ats-pdf";
-import { parsePdfResume } from "./pdf-lines";
+import { documentToLines, parsePdfResume } from "./pdf-lines";
-type Cell = { text: string; x: number; y: number; font?: string };
-function document(cells: Cell[]) {
+type Cell = { text: string; x: number; y: number; font?: string; page?: number; width?: number; size?: number };
+function document(cells: Cell[], links: RawExtraction["links"] = []) {
+ const pageCount = Math.max(1, ...cells.map((cell) => cell.page ?? 1));
const raw: RawExtraction = {
version: 1,
file: { name: "external.pdf", sizeBytes: 1000, magicBytesOk: true },
- pageCount: 1,
+ pageCount,
truncated: false,
- pages: [
- {
- pageNumber: 1,
- width: 595,
- height: 842,
- rotation: 0,
- operators: null,
- items: cells.map((c) => ({
+ pages: Array.from({ length: pageCount }, (_, index) => ({
+ pageNumber: index + 1,
+ width: 595,
+ height: 842,
+ rotation: 0,
+ operators: null,
+ items: cells
+ .filter((cell) => (cell.page ?? 1) === index + 1)
+ .map((c) => ({
str: c.text,
- transform: [10, 0, 0, 10, c.x, 832 - c.y],
- width: c.text.length * 5,
- height: 10,
+ transform: [c.size ?? 10, 0, 0, c.size ?? 10, c.x, 842 - c.y - (c.size ?? 10)],
+ width: c.width ?? c.text.length * 5,
+ height: c.size ?? 10,
fontRef: c.font ?? "body",
hasEol: false,
})),
- },
- ],
+ })),
fonts: [],
- links: [],
+ links,
metadata: {
producer: null,
creator: null,
@@ -81,6 +82,9 @@ it("declines destructive projection when a later title pair lacks a corroborated
]),
);
const stored = JSON.stringify(data.sections.education.items);
+ expect(data.sections.education.items).toHaveLength(1);
+ expect(data.sections.education.items[0]?.school).not.toContain("School Beta");
+ expect(data.sections.education.items[0]?.degree).not.toContain("Degree Beta");
for (const text of [
"School Alpha",
"Degree Alpha",
@@ -101,3 +105,411 @@ it("leaves identical-typography external records with the generic parser and ret
expect(stored).toContain(text);
expect(data.sections.education.items[0]?.area).toBe("");
});
+
+it.each([
+ { name: "partial overlap", rect: [40, 772, 52, 782], url: "https://portfolio.example/" },
+ { name: "edge contact only", rect: [85, 772, 110, 782], url: "" },
+])("matches annotation geometry with $name", ({ rect, url }) => {
+ const data = parsePdfResume(
+ document(
+ [
+ { text: "Fictional Reviewer", x: 40, y: 20 },
+ { text: "[email protected]", x: 40, y: 40 },
+ { text: "Portfolio", x: 40, y: 60 },
+ ...prefix.slice(2),
+ ...first,
+ ],
+ [{ page: 1, rect: rect as [number, number, number, number], url: "https://portfolio.example/" }],
+ ),
+ );
+ expect(data.basics.website.url).toBe(url);
+});
+
+it.each(["https://other.example/", "https://primary.example/"])(
+ "preserves a printed identity website alongside annotation %s",
+ (url) => {
+ const data = parsePdfResume(
+ document(
+ [
+ { text: "Fictional Reviewer", x: 40, y: 20 },
+ { text: "[email protected]", x: 40, y: 40 },
+ { text: "https://primary.example/", x: 40, y: 60 },
+ { text: "Portfolio", x: 40, y: 80 },
+ { text: "Education", x: 40, y: 120, font: "heading" },
+ ...first.map((cell) => ({ ...cell, y: cell.y + 40 })),
+ ],
+ [{ page: 1, rect: [40, 752, 85, 762], url }],
+ ),
+ );
+ expect(data.basics.website).toEqual({
+ url: "https://primary.example/",
+ label: url.includes("primary") ? "Portfolio" : "",
+ });
+ expect(data.basics.customFields).toMatchObject(url.includes("other") ? [{ text: "Portfolio", link: url }] : []);
+ },
+);
+
+it("keeps a full-column Education website block that precedes its description", () => {
+ const data = parsePdfResume(
+ document(
+ [
+ ...prefix,
+ ...first,
+ { text: "Details", x: 40, y: 150 },
+ { text: "Completed independent research.", x: 40, y: 170 },
+ { text: "Read the thesis", x: 40, y: 190 },
+ ],
+ [
+ { page: 1, rect: [40, 682, 550, 692], url: "https://school.example/" },
+ { page: 1, rect: [40, 642, 115, 652], url: "https://thesis.example/" },
+ ],
+ ),
+ );
+ expect(data.sections.education.items[0]?.website).toMatchObject({ url: "https://school.example/", label: "Details" });
+ expect(data.sections.education.items[0]?.description).toBe(
+ "<p>Completed independent research.</p><p>Read the thesis</p>",
+ );
+});
+
+it.each([
+ ["leading", 150, 170],
+ ["trailing", 170, 150],
+])("keeps a %s linked body paragraph in the description when there is no website", (_, linkY, proseY) => {
+ const data = parsePdfResume(
+ document(
+ [
+ ...prefix,
+ ...first,
+ { text: "Completed independent research.", x: 40, y: proseY },
+ { text: "Read the thesis", x: 40, y: linkY },
+ ],
+ [{ page: 1, rect: [40, 832 - linkY, 115, 842 - linkY], url: "https://thesis.example/" }],
+ ),
+ );
+ const paragraphs = ["<p>Completed independent research.</p>", "<p>Read the thesis</p>"];
+ expect(data.sections.education.items[0]?.website.url).toBe("");
+ expect(data.sections.education.items[0]?.description).toBe(
+ (linkY < proseY ? paragraphs.reverse() : paragraphs).join(""),
+ );
+});
+
+it("retains a full-row footer website after description text", () => {
+ const data = parsePdfResume(
+ document(
+ [
+ ...prefix,
+ ...first,
+ { text: "Completed independent research.", x: 40, y: 150 },
+ { text: "Details", x: 40, y: 170 },
+ ],
+ [{ page: 1, rect: [40, 662, 550, 672], url: "https://school.example/" }],
+ ),
+ );
+ expect(data.sections.education.items[0]?.website).toMatchObject({ url: "https://school.example/", label: "Details" });
+ expect(data.sections.education.items[0]?.description).toBe("<p>Completed independent research.</p>");
+});
+
+it.each([false, true])("joins a cross-page bullet only with a filled previous line (filled=%s)", (filled) => {
+ const lines = documentToLines(
+ document([
+ { text: "EXPERIENCE", x: 40, y: 80, font: "heading" },
+ { text: "Company Alpha", x: 40, y: 110, font: "strong" },
+ { text: "Engineer", x: 40, y: 130 },
+ { text: "2020 – 2021", x: 450, y: 130 },
+ { text: "•", x: 40, y: 800 },
+ { text: "Delivered useful work", x: 50, y: 800, width: filled ? 500 : 100 },
+ { text: "Company Beta", x: 50, y: 40, page: 2 },
+ { text: "• Another achievement", x: 40, y: 80, page: 2 },
+ ]),
+ );
+ expect(lines).toContain(filled ? "• Delivered useful work Company Beta" : "Company Beta");
+ if (!filled) expect(lines).toContain("• Delivered useful work");
+});
+
+it("recognizes tight uppercase section labels that share the body style when no heading style is anchored", () => {
+ const data = parsePdfResume(
+ document([
+ { text: "Fictional Reviewer", x: 40, y: 20 },
+ { text: "[email protected]", x: 40, y: 40 },
+ { text: "EXPERIENCE", x: 40, y: 55 },
+ { text: "Company Alpha", x: 40, y: 70, font: "strong" },
+ { text: "Engineer", x: 40, y: 85 },
+ { text: "2020 – 2021", x: 450, y: 85 },
+ { text: "•", x: 40, y: 100 },
+ { text: "Built useful", x: 50, y: 100 },
+ { text: "EXPERIENCE", x: 50, y: 115 },
+ { text: "EDUCATION", x: 40, y: 130 },
+ ...first.map((cell) => ({ ...cell, y: cell.y + 35 })),
+ ]),
+ );
+ expect(data.sections.experience.items).toHaveLength(1);
+ expect(data.sections.experience.items[0]?.description).toContain("Built useful EXPERIENCE");
+ expect(data.sections.education.items).toHaveLength(1);
+ expect(data.sections.education.items[0]).toMatchObject({ school: "School Alpha", degree: "Degree Alpha" });
+});
+
+it("keeps body-style uppercase sub-labels in a role when a distinct heading style is anchored", () => {
+ const data = parsePdfResume(
+ document([
+ { text: "Fictional Reviewer", x: 40, y: 20 },
+ { text: "[email protected]", x: 40, y: 40 },
+ { text: "EXPERIENCE", x: 40, y: 80, font: "heading" },
+ { text: "Company Alpha", x: 40, y: 100, font: "strong" },
+ { text: "Engineer", x: 40, y: 120 },
+ { text: "2020 – 2021", x: 450, y: 120 },
+ { text: "PROJECTS", x: 40, y: 135 },
+ { text: "• Built Atlas tooling.", x: 40, y: 150 },
+ { text: "SKILLS", x: 40, y: 165 },
+ { text: "• Led platform reviews.", x: 40, y: 180 },
+ { text: "EDUCATION", x: 40, y: 210, font: "heading" },
+ ...first.map((cell) => ({ ...cell, y: cell.y + 120 })),
+ ]),
+ );
+ expect(data.sections.experience.items).toHaveLength(1);
+ const description = data.sections.experience.items[0]?.description ?? "";
+ for (const text of ["PROJECTS", "Built Atlas tooling.", "SKILLS", "Led platform reviews."])
+ expect(description).toContain(text);
+ expect(data.sections.projects.items).toEqual([]);
+ expect(data.sections.skills.items).toEqual([]);
+ expect(data.sections.education.items).toHaveLength(1);
+ expect(data.sections.education.items[0]).toMatchObject({ school: "School Alpha", degree: "Degree Alpha" });
+});
+
+it("keeps labelled email and phone contacts after Summary without borrowing a body URL", () => {
+ const data = parsePdfResume(
+ document(
+ [
+ { text: "Fictional Reviewer", x: 40, y: 20 },
+ { text: "Summary", x: 40, y: 60, font: "heading" },
+ { text: "Builds useful products.", x: 40, y: 80 },
+ { text: "Email", x: 40, y: 120 },
+ { text: "Phone", x: 140, y: 120 },
+ { text: "Portfolio", x: 240, y: 120 },
+ { text: "Education", x: 40, y: 160, font: "heading" },
+ ...first.map((cell) => ({ ...cell, y: cell.y + 60 })),
+ { text: "https://school.example/", x: 40, y: 220 },
+ ],
+ [
+ { page: 1, rect: [40, 712, 65, 722], url: "mailto:[email protected]" },
+ { page: 1, rect: [140, 712, 165, 722], url: "tel:+12025550199" },
+ { page: 1, rect: [240, 712, 285, 722], url: "https://portfolio.example/" },
+ ],
+ ),
+ );
+ expect(data.basics).toMatchObject({
+ email: "[email protected]",
+ phone: "+12025550199",
+ website: { url: "https://portfolio.example/", label: "Portfolio" },
+ customFields: [],
+ });
+});
+
+it("keeps a dense run of body-style aliases and contact rows on the geometry path within the default budget", () => {
+ const aliases = ["SKILLS", "PROJECTS", "AWARDS", "EXPERIENCE", "EDUCATION", "LANGUAGES", "INTERESTS", "REFERENCES"];
+ const rows = Array.from({ length: 320 }, (_, i) => ({
+ text:
+ i % 2
+ ? (aliases[((i - 1) / 2) % 8] ?? "")
+ : `pat${i}@example.invalid +1 202 555 01${String(i % 100).padStart(2, "0")}`,
+ x: 40,
+ y: 60 + (i % 36) * 20,
+ page: 1 + Math.floor(i / 36),
+ }));
+ const page = 2 + Math.floor(319 / 36);
+ const doc = document([
+ { text: "Fictional Reviewer", x: 40, y: 10, size: 16 },
+ { text: "Summary", x: 40, y: 34, size: 14 },
+ ...rows,
+ { text: "Education", x: 40, y: 60, size: 14, page },
+ ...first.map((cell) => ({ ...cell, page })),
+ ]);
+ // Geometry joins separate fields with two spaces; the flat fallback keeps the extractor's single space.
+ expect(documentToLines(doc)).toContain("Area Alpha Place Alpha • 2010 – 2014");
+ const data = parsePdfResume(doc);
+ expect(data.sections.education.items.map((item) => item.school)).toEqual(["School Alpha"]);
+ for (const key of ["experience", "skills", "projects", "awards", "languages", "interests", "references"] as const)
+ expect(data.sections[key].items).toEqual([]);
+ const text = JSON.stringify(data);
+ for (let i = 0; i < 320; i += 2) expect(text).toContain(`pat${i}@example.invalid`);
+});
+
+it("keeps every body line and the geometry contacts when no section heading is found", () => {
+ // Full prose lines: a short first line could legitimately open a custom section instead.
+ const body = [
+ "Built accessible scheduling tools for regional clinics and their many partners.",
+ "Led four engineers through a calm migration without losing a single appointment.",
+ ];
+ const data = parsePdfResume(
+ document(
+ [
+ { text: "Fictional Reviewer", x: 40, y: 10, size: 16 },
+ { text: "[email protected]", x: 40, y: 40 },
+ { text: "Portfolio", x: 40, y: 60 },
+ ...body.map((text, index) => ({ text, x: 40, y: 100 + index * 20 })),
+ ],
+ [{ page: 1, rect: [40, 772, 85, 782], url: "https://portfolio.example/" }],
+ ),
+ );
+ expect(data.basics).toMatchObject({
+ email: "[email protected]",
+ website: { url: "https://portfolio.example/", label: "Portfolio" },
+ });
+ for (const text of body) expect(data.summary.content).toContain(text);
+});
+
+it("keeps a header-only PDF as identity without copying it into Summary", () => {
+ const data = parsePdfResume(
+ document([
+ { text: "Fictional Reviewer", x: 40, y: 10, size: 16 },
+ { text: "[email protected]", x: 40, y: 40 },
+ { text: "+1 202 555 0199", x: 240, y: 40 },
+ ]),
+ );
+ expect(data.basics).toMatchObject({
+ name: "Fictional Reviewer",
+ email: "[email protected]",
+ phone: "+1 202 555 0199",
+ });
+ expect(data.summary.content).toBe("");
+ expect(Object.values(data.sections).reduce((count, section) => count + section.items.length, 0)).toBe(0);
+});
+
+const shortResume = (labels: Cell[]) => [
+ { text: "Fictional Reviewer", x: 40, y: 10, size: 16 },
+ { text: "[email protected]", x: 40, y: 40 },
+ { text: "Summary", x: 40, y: 70, font: "heading" },
+ { text: "Builds useful products for careful teams.", x: 40, y: 88 },
+ { text: "Education", x: 40, y: 120, font: "heading" },
+ ...first.map((cell) => ({ ...cell, y: cell.y + 25 })),
+ { text: "Experience", x: 40, y: 190, font: "heading" },
+ { text: "Company Alpha", x: 40, y: 210, font: "strong" },
+ { text: "Engineer", x: 40, y: 225 },
+ { text: "2020 – 2021", x: 450, y: 225 },
+ ...labels,
+];
+
+it.each([
+ ["isolated by a blank line", "body", 30, false],
+ ["repeated in their own bold style", "strong", 15, true],
+ ["used once each in their own bold style after blank lines", "strong", 30, false],
+])("keeps role sub-labels as role text when they are %s", (_, font, gap, repeat) => {
+ // Three real headings in a distinct style; four sub-labels outnumber them, all inside the Experience section.
+ const labels = ["ACHIEVEMENTS", "PROJECTS", "SKILLS", "LANGUAGES", ...(repeat ? ["PROJECTS"] : [])];
+ const cells = labels.flatMap((text, index) => {
+ const y = 250 + index * (gap + 15);
+ return [
+ { text, x: 40, y, font },
+ { text: `• Outcome ${index + 1} for the team.`, x: 40, y: y + 15 },
+ ];
+ });
+ const data = parsePdfResume(document(shortResume(cells)));
+ expect(data.summary.content).toBe("<p>Builds useful products for careful teams.</p>");
+ expect(data.sections.education.items.map((item) => item.school)).toEqual(["School Alpha"]);
+ expect(data.sections.experience.items).toHaveLength(1);
+ expect(data.sections.experience.items[0]).toMatchObject({ company: "Company Alpha", position: "Engineer" });
+ for (const text of labels) expect(data.sections.experience.items[0]?.description).toContain(text);
+ for (const key of ["projects", "skills", "awards", "languages"] as const)
+ expect(data.sections[key].items).toEqual([]);
+});
+
+it("treats one heading style rendered a tenth of a point apart as one style", () => {
+ // Sub-labels in the body style outnumber headings split by rounding at 9.45pt.
+ const sizes = { Summary: 9.4, Education: 9.5, Experience: 9.4 } as Record<string, number>;
+ const cells = shortResume(
+ ["ACHIEVEMENTS", "PROJECTS", "SKILLS", "LANGUAGES"].flatMap((text, index) => [
+ { text, x: 40, y: 240 + index * 30 },
+ { text: `• Outcome ${index + 1} for the team.`, x: 40, y: 255 + index * 30 },
+ ]),
+ ).map((cell) => (cell.text in sizes ? { ...cell, size: sizes[cell.text] ?? 10 } : cell));
+ const data = parsePdfResume(document(cells));
+ expect(data.sections.education.items.map((item) => item.school)).toEqual(["School Alpha"]);
+ expect(data.sections.experience.items.map((item) => item.company)).toEqual(["Company Alpha"]);
+ expect(data.summary.content).toBe("<p>Builds useful products for careful teams.</p>");
+});
+
+it("keeps a header band with linked contacts out of the zero-heading fallback", () => {
+ const data = parsePdfResume(
+ document(
+ [
+ { text: "Fictional Reviewer", x: 40, y: 10, size: 16 },
+ { text: "[email protected]", x: 40, y: 40 },
+ { text: "Selected work", x: 300, y: 40 },
+ { text: "github.com/reviewer", x: 400, y: 40 },
+ ],
+ // Custom fields render as links, like the website.
+ [
+ { page: 1, rect: [300, 792, 365, 802], url: "https://work.example/" },
+ { page: 1, rect: [400, 792, 495, 802], url: "https://github.com/reviewer" },
+ ],
+ ),
+ );
+ expect(data.summary.content).toBe("");
+ expect(data.basics.email).toBe("[email protected]");
+});
+
+it.each([
+ ["a duplicated section title", "Qualifications", "heading", 9],
+ ["headings in the body style", "", "body", 10],
+ ["a larger label inside a section", "", "heading", 9],
+])("keeps the real headings beside one isolated bold label with %s", (_, extra, font, size) => {
+ // One bold "Projects" label inside a role must not outrank the section headings that contain it.
+ const heading = (text: string, y: number) => ({ text, x: 40, y, font, size });
+ const data = parsePdfResume(
+ document([
+ { text: "Fictional Reviewer", x: 40, y: 10, size: 16 },
+ { text: "[email protected]", x: 40, y: 40 },
+ heading("Summary", 70),
+ { text: "Builds useful products for careful teams.", x: 40, y: 88 },
+ heading("Education", 120),
+ ...first.map((cell) => ({ ...cell, y: cell.y + 25 })),
+ heading("Experience", 190),
+ { text: "Company Alpha", x: 40, y: 210, font: "strong" },
+ { text: "Engineer", x: 40, y: 225 },
+ { text: "2020 – 2021", x: 450, y: 225 },
+ { text: "• Delivered careful platform work for the team.", x: 40, y: 245 },
+ {
+ text: "Projects",
+ x: 40,
+ y: 280,
+ font: "strong",
+ },
+ { text: "• Built Atlas tooling.", x: 40, y: 295 },
+ heading("Projects", 330),
+ { text: "Atlas", x: 40, y: 350, font: "strong" },
+ { text: "Open-source scheduling toolkit for regional teams.", x: 40, y: 365 },
+ ...(extra
+ ? [heading(extra, 400), { text: "Certified first aider with current credentials.", x: 40, y: 420 }]
+ : []),
+ ]),
+ );
+ expect(data.summary.content).toBe("<p>Builds useful products for careful teams.</p>");
+ expect(data.sections.experience.items).toHaveLength(1);
+ expect(data.sections.experience.items[0]).toMatchObject({ company: "Company Alpha", position: "Engineer" });
+ expect(data.sections.experience.items[0]?.description).toContain("Built Atlas tooling.");
+ expect(data.sections.education.items[0]?.school).toBe("School Alpha");
+ expect(data.sections.projects.items.map((item) => item.name)).toEqual(["Atlas"]);
+ if (extra) expect(JSON.stringify(data)).toContain("Certified first aider with current credentials.");
+});
+
+it("does not let one differently styled title swallow the section headings below it", () => {
+ // A single label in its own style opens one section at most; it cannot contain the document's other headings.
+ const data = parsePdfResume(
+ document([
+ { text: "Fictional Reviewer", x: 40, y: 10, size: 16 },
+ { text: "[email protected]", x: 40, y: 40 },
+ { text: "Summary", x: 40, y: 70, font: "title" },
+ { text: "Builds useful products for careful teams.", x: 40, y: 88 },
+ { text: "Education", x: 40, y: 120, font: "heading" },
+ ...first.map((cell) => ({ ...cell, y: cell.y + 25 })),
+ { text: "Experience", x: 40, y: 190, font: "heading" },
+ { text: "Company Alpha", x: 40, y: 210, font: "strong" },
+ { text: "Engineer", x: 40, y: 225 },
+ { text: "2020 – 2021", x: 450, y: 225 },
+ { text: "• Delivered careful platform work for the team.", x: 40, y: 245 },
+ ]),
+ );
+ // The lone title has no consistent heading evidence of its own and stays Summary text (as before this change).
+ expect(data.summary.content).toContain("Builds useful products for careful teams.");
+ expect(data.sections.education.items.map((item) => item.school)).toEqual(["School Alpha"]);
+ expect(data.sections.experience.items.map((item) => item.company)).toEqual(["Company Alpha"]);
+});
diff --git a/packages/import/src/pdf-lines.ts b/packages/import/src/pdf-lines.ts
index 394f9b703..5ddd87f58 100644
--- a/packages/import/src/pdf-lines.ts
+++ b/packages/import/src/pdf-lines.ts
@@ -3,7 +3,7 @@ import type { ResumeData } from "@reactive-resume/schema/resume/data";
import { columnSegments } from "@reactive-resume/resume/ats-pdf";
import { parseResumeData } from "@reactive-resume/schema/resume/data";
import { readLegacyDates } from "@reactive-resume/schema/resume/dates";
-import { generateId } from "@reactive-resume/utils/string";
+import { escapeHtml, generateId } from "@reactive-resume/utils/string";
import { BULLET_PATTERN, toHtmlBlocks } from "./html";
import { allowsPdfGeometry, GeometryIndex, GeometryLimit } from "./pdf-geometry";
import {
@@ -113,11 +113,15 @@ function annotationTarget(doc: ExtractedDocument, span: TextSpan): string | unde
}
for (const page of doc.pages)
for (const cell of page.lines.flatMap((line) => line.spans)) {
- const x = cell.x + cell.width / 2;
- const y = page.height - cell.y - cell.height / 2;
const link = links
.get(page.pageNumber)
- ?.find((link) => x >= link.rect[0] && x <= link.rect[2] && y >= link.rect[1] && y <= link.rect[3]);
+ ?.find(
+ (link) =>
+ cell.x < Math.max(link.rect[0], link.rect[2]) &&
+ cell.x + cell.width > Math.min(link.rect[0], link.rect[2]) &&
+ cell.y < page.height - Math.min(link.rect[1], link.rect[3]) &&
+ cell.y + cell.height > page.height - Math.max(link.rect[1], link.rect[3]),
+ );
if (link?.url) targets.set(cell, link.url);
}
annotationCache.set(doc, targets);
@@ -205,6 +209,7 @@ function headingTest(doc: ExtractedDocument) {
};
const fields = doc.lines.flatMap(fieldsOf);
const index = new GeometryIndex(fields);
+ const rowIndex = new GeometryIndex(doc.lines, index.budget);
const spanIndex = new GeometryIndex(
doc.lines.flatMap((line) => line.spans.map((span) => lineWithSpans(line, [span]))),
index.budget,
@@ -310,7 +315,10 @@ function headingTest(doc: ExtractedDocument) {
Math.abs(line.fontSize - name.fontSize) < 1,
);
+ const contactAnnotation = (row: TextLine) =>
+ row.spans.some((span) => /^(?:mailto:|tel:)/.test(annotationTarget(doc, span) ?? ""));
const owned = new Set<TextSpan>();
+ const confirmedContacts = new Set<TextSpan>();
let identityColumns: { x: number; top: number } | null = null;
const page = doc.pages[0];
if (page) {
@@ -333,16 +341,24 @@ function headingTest(doc: ExtractedDocument) {
}
for (const group of groups.values()) {
const blocks: TextLine[][] = [];
+ // The first block under a section heading is that section's content, even when it carries a phone.
+ const headed = new Set<TextLine[]>();
let block: TextLine[] = [];
let bottom = -Infinity;
+ let afterHeading = false;
const flush = () => {
- if (block.length) blocks.push(block);
+ if (block.length) {
+ blocks.push(block);
+ if (afterHeading) headed.add(block);
+ afterHeading = false;
+ }
block = [];
bottom = -Infinity;
};
for (const line of group.sort((a, b) => a.y - b.y || a.x - b.x)) {
if (known(line)) {
flush();
+ afterHeading = true;
continue;
}
const height = Math.max(line.height, block.at(-1)?.height ?? 0);
@@ -362,19 +378,12 @@ function headingTest(doc: ExtractedDocument) {
.reduce((y, line) => Math.min(y, line.y), Infinity);
const contact = blocks.find(
(rows) =>
+ !headed.has(rows) &&
rows.every((row) => row.y < limit) &&
- rows.some(
- (row) =>
- isContactLine(row.text) ||
- row.spans.some((span) => /^(?:mailto:|tel:)/.test(annotationTarget(doc, span) ?? "")),
- ),
+ rows.some((row) => isContactLine(row.text) || contactAnnotation(row)),
);
if (contact) {
- const seed = contact.find(
- (row) =>
- isContactLine(row.text) ||
- row.spans.some((span) => /^(?:mailto:|tel:)/.test(annotationTarget(doc, span) ?? "")),
- );
+ const seed = contact.find((row) => isContactLine(row.text) || contactAnnotation(row));
const last = contact.at(-1);
if (seed && last) {
let bottom = last.y;
@@ -391,6 +400,15 @@ function headingTest(doc: ExtractedDocument) {
}
}
}
+ if (contact) {
+ const text = contact.map((line) => line.text).join("\n");
+ index.charge(text.length);
+ const annotated = contact.some(contactAnnotation);
+ const basics = annotated ? undefined : parseResumeText(text).basics;
+ // Contacts may follow Summary; email/phone evidence separates that block from body URLs.
+ if (annotated || basics?.email || basics?.phone)
+ for (const row of contact) for (const span of row.spans) confirmedContacts.add(span);
+ }
for (const rows of blocks)
if (
rows === contact ||
@@ -400,22 +418,23 @@ function headingTest(doc: ExtractedDocument) {
for (const row of rows) for (const span of row.spans) owned.add(span);
}
}
- const sectionBefore = (line: TextLine) =>
+ const sectionBefore = (line: TextLine): boolean =>
index
.page(line.page)
.some(
(label) =>
headingKey(label.text) &&
- (label.fontSize > (doc.modalFontSize ?? label.fontSize) * 1.08 || isolated(label)) &&
+ cachedTest(label) &&
label.y < line.y - 2 &&
- overlaps(label, line),
+ (!identityColumns || label.x < identityColumns.x === line.x < identityColumns.x),
);
- const identityRaw = (line: TextLine) =>
- !headingKey(line.text) &&
- !standaloneDate(line.text) &&
- (line.spans.every((span) => owned.has(span)) ||
- (!sectionBefore(line) &&
- legacyIdentity(line) &&
+ const identityRaw = (line: TextLine) => {
+ if (headingKey(line.text) || standaloneDate(line.text)) return false;
+ if (line.spans.every((span) => confirmedContacts.has(span))) return true;
+ if (sectionBefore(line)) return false;
+ return (
+ line.spans.every((span) => owned.has(span)) ||
+ (legacyIdentity(line) &&
(!identityColumns ||
contacts.some(
(contact) =>
@@ -423,7 +442,9 @@ function headingTest(doc: ExtractedDocument) {
line.y < contact.y &&
overlaps(line, contact) &&
line.fontSize > contact.fontSize + 0.1,
- ))));
+ )))
+ );
+ };
const identityCache = new Map<string, boolean>();
const identity = (line: TextLine) => {
const key = cacheKey(line);
@@ -515,7 +536,33 @@ function headingTest(doc: ExtractedDocument) {
});
};
const styles = new Map<string, Set<string>>();
- const styleOf = (line: PageGeometry["lines"][number]) => `${line.fontRef}:${Math.round(line.fontSize)}`;
+ // One heading style can render a tenth of a point apart (8.9 and 9.0), so sizes within 3% of a neighbour in the
+ // same font form one style; fixed rounding would split such a style at an arbitrary boundary.
+ const sizesByFont = new Map<string, number[]>();
+ for (const line of [
+ ...fields.filter((field) => headingKey(field.text)),
+ { fontRef: doc.modalFontRef, fontSize: doc.modalFontSize ?? 0 },
+ ]) {
+ const sizes = sizesByFont.get(String(line.fontRef)) ?? [];
+ sizes.push(line.fontSize);
+ sizesByFont.set(String(line.fontRef), sizes);
+ }
+ const clusters = new Map<string, { from: number; to: number }[]>();
+ for (const [font, sizes] of sizesByFont) {
+ const runs: { from: number; to: number }[] = [];
+ for (const size of sizes.sort((a, b) => a - b)) {
+ const run = runs.at(-1);
+ if (run && size - run.to <= run.to * 0.03) run.to = size;
+ else runs.push({ from: size, to: size });
+ }
+ clusters.set(font, runs);
+ }
+ const sizeKey = (font: string | null, size: number) => {
+ const run = clusters.get(String(font))?.find((run) => size >= run.from * 0.97 && size <= run.to * 1.03);
+ return run ? run.from : Math.round(size * 10) / 10;
+ };
+ const styleOf = (line: { fontRef: string | null; fontSize: number }) =>
+ `${line.fontRef}:${sizeKey(line.fontRef, line.fontSize)}`;
for (const line of fields) {
const key = headingKey(line.text);
if (!key) continue;
@@ -551,46 +598,77 @@ function headingTest(doc: ExtractedDocument) {
const cut = streamColumns.get(a.page);
return !cut || a.y < cut.top || b.y < cut.top || a.x < cut.x === b.x < cut.x;
};
- const mostKeys = Array.from(styles.values()).reduce((most, keys) => Math.max(most, keys.size), 0);
+ // Isolation is evidence a body paragraph can also produce (a blank line, a page top), so an anchored style can be a
+ // run of labels inside sections' content. Such a style is nested: every label of it lies inside a section opened by
+ // another anchored style with several labels. Nested labels stay content and do not set the alias bar, however many
+ // keys they carry.
+ const labelsByStyle = new Map<string, TextLine[]>();
+ for (const line of fields) {
+ if (!headingKey(line.text) || !anchored.has(styleOf(line))) continue;
+ const labels = labelsByStyle.get(styleOf(line)) ?? [];
+ labels.push(line);
+ labelsByStyle.set(styleOf(line), labels);
+ }
+ // A section runs on across pages and down its column.
+ const below = (label: TextLine, line: TextLine) =>
+ label.page < line.page || (label.page === line.page && label.y < line.y - 2 && sameStream(line, label));
+ const within = (inner: TextLine[], outer: TextLine[]) => {
+ index.charge(inner.length * outer.length);
+ return inner.every((line) => outer.some((label) => below(label, line)));
+ };
+ const nested = new Set(
+ [...labelsByStyle].flatMap(([style, labels]) =>
+ [...labelsByStyle].some(([other, sections]) => other !== style && sections.length > 1 && within(labels, sections))
+ ? [style]
+ : [],
+ ),
+ );
+ const established = new Set([...anchored].filter((style) => !nested.has(style)));
+ const mostKeys = Array.from(
+ established.size ? established : styles.keys(),
+ (style) => styles.get(style)?.size ?? 0,
+ ).reduce((most, keys) => Math.max(most, keys), 0);
const test = (line: PageGeometry["lines"][number]) => {
if (isContactLine(line.text) || identity(line) || BULLET_PATTERN.test(line.text)) return false;
const consistent = (styles.get(styleOf(line))?.size ?? 0) >= Math.max(1, mostKeys);
const larger =
line.fontSize > (doc.modalFontSize ?? line.fontSize) * 1.08 ||
- doc.lines.some(
- (row) =>
- row.page === line.page &&
- row.y > line.y &&
- row.y - line.y < line.fontSize * 6 &&
- row.x <= line.x &&
- row.x + row.width >= line.x + line.width &&
- dateSpans(row).length &&
- line.fontSize > row.fontSize * 1.08,
- );
+ rowIndex
+ .near(line, 0, line.fontSize * 6)
+ .some(
+ (row) =>
+ row.y > line.y &&
+ row.y - line.y < line.fontSize * 6 &&
+ row.x <= line.x &&
+ row.x + row.width >= line.x + line.width &&
+ dateSpans(row).length &&
+ line.fontSize > row.fontSize * 1.08,
+ );
if (
headingKey(line.text) &&
- index
- .all()
- .some(
- (other) =>
- headingKey(other.text) === headingKey(line.text) &&
- other.fontSize > line.fontSize * 1.08 &&
- isolated(other),
- )
+ index.all().some(
+ (other) =>
+ headingKey(other.text) === headingKey(line.text) &&
+ other.fontSize > line.fontSize * 1.08 &&
+ isolated(other) &&
+ // A larger label nested in a section's content is not a competing heading.
+ !nested.has(styleOf(other)),
+ )
)
return false;
const distinct =
line.fontRef !== doc.modalFontRef || Math.abs(line.fontSize - (doc.modalFontSize ?? line.fontSize)) > 1;
+ if (headingKey(line.text) && nested.has(styleOf(line))) return larger;
if (headingKey(line.text))
return (
larger ||
- (consistent && anchored.has(styleOf(line)) && (distinct || isolated(line))) ||
- (/^[A-Z][A-Z\s]+$/.test(line.text) && isolated(line))
+ (consistent && established.has(styleOf(line)) && (distinct || isolated(line))) ||
+ (/^[A-Z][A-Z\s]+$/.test(line.text) && (isolated(line) || (consistent && !anchored.size)))
);
- if (line.spans.some((span) => annotationTarget(doc, span)) && !anchored.has(styleOf(line))) return false;
+ if (line.spans.some((span) => annotationTarget(doc, span)) && !established.has(styleOf(line))) return false;
if (
- !anchored.has(styleOf(line)) &&
+ !established.has(styleOf(line)) &&
!larger &&
index
.all()
@@ -672,13 +750,13 @@ function headingTest(doc: ExtractedDocument) {
),
);
const independent =
- (capitalized || startsBody || (consistent && anchored.has(styleOf(line)) && isolated(line, true))) &&
+ (capitalized || startsBody || (consistent && established.has(styleOf(line)) && isolated(line, true))) &&
followingBody &&
(startsBody || isolated(line, true)) &&
!labelledRow;
if (/[.!?;,]$/.test(line.text.trim()) && !independent) return false;
return (
- ((consistent && anchored.has(styleOf(line))) || independent) &&
+ ((consistent && established.has(styleOf(line))) || independent) &&
(independent || distinct || (capitalized && isolated(line))) &&
(capitalized ? line.text.replace(/\s/g, "").length : line.text.length) <= 48 &&
(line.text.split(/\s+/).length <= 6 || capitalized) &&
@@ -1278,6 +1356,7 @@ function importLines(source: ExtractedDocument): ImportLine[] {
stream: ImportLine["stream"];
leading?: number;
line: ImportLine;
+ right: number;
} | null = null;
const prefix: ImportLine[] = [];
const sidebar: ImportLine[] = [];
@@ -1301,8 +1380,9 @@ function importLines(source: ExtractedDocument): ImportLine[] {
),
);
const baseline = (span: TextSpan) => span.y + span.height;
- const wrapsInto = (previous: ImportLine, next: TextSpan) => {
- const right = previous.right ?? doc.pages.find((page) => page.pageNumber === previous.page)?.width ?? 0;
+ const wrapsInto = (previous: ImportLine, next: TextSpan, observedRight?: number) => {
+ const right =
+ observedRight ?? previous.right ?? doc.pages.find((page) => page.pageNumber === previous.page)?.width ?? 0;
const edge = previous.spans.reduce((x, span) => Math.max(x, span.x + span.width), previous.x);
const word = next.text.trim().split(/\s+/)[0] ?? "";
const wordWidth = (next.width * word.length) / Math.max(1, next.text.length);
@@ -1345,11 +1425,14 @@ function importLines(source: ExtractedDocument): ImportLine[] {
font: content?.fontRef ?? first.fontRef,
last: content ?? first,
line,
+ right: Math.max(...line.spans.map((span) => span.x + span.width)),
page: line.page,
stream: line.stream,
};
} else if (
bullet &&
+ !line.record &&
+ !line.recordDate &&
line.stream === bullet.stream &&
(!line.heading || (first.fontRef === bullet.font && Math.abs(first.x - bullet.x) < bullet.size * 0.2)) &&
Math.abs(first.fontSize - bullet.size) < 1 &&
@@ -1361,6 +1444,7 @@ function importLines(source: ExtractedDocument): ImportLine[] {
Math.abs(first.x - bullet.x) <= bullet.size * 0.9 &&
credible) ||
(line.page > bullet.page &&
+ wrapsInto(bullet.line, first, bullet.leading === undefined ? undefined : bullet.right) &&
first.x > bullet.markerX &&
Math.abs(first.x - bullet.x) <= bullet.size * 0.9 &&
fieldsOf(line).length === 1))
@@ -1371,6 +1455,8 @@ function importLines(source: ExtractedDocument): ImportLine[] {
bullet.x = first.x;
if (line.page === bullet.page) bullet.leading ??= gap;
bullet.last = first;
+ const edge = Math.max(...line.spans.map((span) => span.x + span.width));
+ bullet.right = line.page === bullet.page ? Math.max(bullet.right, edge) : edge;
bullet.line = line;
bullet.page = line.page;
continue;
@@ -1494,7 +1580,6 @@ function readIdentity(lines: ImportLine[], doc: ExtractedDocument) {
let email = contact.email;
let phone = contact.phone;
let website = contact.website;
- let seenWebsite = false;
const customFields: { id: string; icon: string; text: string; link: string }[] = [];
for (const [url, spans] of linked) {
if (url.startsWith("mailto:")) email = url.slice(7).split("?")[0] ?? email;
@@ -1502,9 +1587,10 @@ function readIdentity(lines: ImportLine[], doc: ExtractedDocument) {
else if (/^https?:\/\//i.test(url)) {
const label = joinSpans(spans);
const displayed = /^https?:\/\//i.test(label) && URL.canParse(label) && new URL(label).href === url;
- if (!seenWebsite) {
+ const sameWebsite =
+ URL.canParse(website.url) && URL.canParse(url) && new URL(website.url).href === new URL(url).href;
+ if (!website.url || sameWebsite) {
website = { url: displayed ? label : url, label: displayed ? "" : label };
- seenWebsite = true;
} else customFields.push({ id: generateId(), icon: "", text: label, link: url });
}
}
@@ -1653,6 +1739,8 @@ function educationRecords(
/** Match records within their section stream, so links and split header cells cannot escape into prose. */
function projectSectionFields(data: ResumeData, lines: ImportLine[], doc: ExtractedDocument): ResumeData {
const work = new GeometryIndex(lines);
+ const education: ResumeData["sections"]["education"]["items"] = [];
+ let hasEducation = false;
for (let start = 0; start < lines.length; start++) {
const heading = lines[start];
if (!heading?.heading) continue;
@@ -1661,10 +1749,20 @@ function projectSectionFields(data: ResumeData, lines: ImportLine[], doc: Extrac
let end = start + 1;
while (end < lines.length && !lines[end]?.heading) end++;
const run = lines.slice(start + 1, end);
- const section = data.sections[key];
+ const section =
+ key === "education"
+ ? {
+ ...data.sections.education,
+ items:
+ educationRecords(run, work, data.metadata.page.locale) ??
+ parseResumeText([heading.text, ...run.map((line) => line.text)].join("\n"), new Set([0])).sections
+ .education.items,
+ }
+ : data.sections[key];
if (key === "education") {
- const records = educationRecords(run, work, data.metadata.page.locale);
- if (records) data.sections.education.items = records;
+ // Parse and project this run before merging: repeated or mentioned schools cannot claim another run's items.
+ hasEducation = true;
+ education.push(...(section.items as ResumeData["sections"]["education"]["items"]));
}
let cursor = 0;
const items = section.items as unknown as Record<string, unknown>[];
@@ -1696,13 +1794,53 @@ function projectSectionFields(data: ResumeData, lines: ImportLine[], doc: Extrac
const finish = offset >= 0 ? begin + 1 + offset : run.length;
cursor = finish;
const chunk = run.slice(begin, finish);
- const linked = chunk.filter(
- (line) =>
- line.spans.length &&
- line.spans.every((span) => /^https?:\/\//i.test(annotationTarget(doc, span) ?? "")) &&
- new Set(line.spans.map((span) => annotationTarget(doc, span))).size === 1,
+ const headerFields = Object.entries(item)
+ .flatMap(([field, value]) =>
+ field !== "id" && field !== "description" && typeof value === "string" && value ? [value] : [],
+ )
+ .sort((a, b) => b.length - a.length);
+ const bodyStart = chunk.findIndex((line) => {
+ work.charge(line.text.length * headerFields.length);
+ const rest = headerFields.reduce((text, field) => text.replaceAll(field, ""), line.text);
+ return Boolean(rest.replace(/[\s•·|,;:()–—-]/g, ""));
+ });
+ const header = chunk.slice(0, bodyStart < 0 ? chunk.length : bodyStart);
+ const linked = chunk
+ .flatMap(fieldsOf)
+ .filter(
+ (line) =>
+ line.spans.length &&
+ line.spans.every((span) => /^https?:\/\//i.test(annotationTarget(doc, span) ?? "")) &&
+ new Set(line.spans.map((span) => annotationTarget(doc, span))).size === 1,
+ )
+ .map((line) => {
+ work.charge(line.spans.length);
+ return lineWithSpans(line, line.spans);
+ });
+ const headerLinks = linked.filter((field) =>
+ header.some((line) => field.spans.some((span) => line.spans.includes(span))),
);
- const slot = linked.at(-1);
+ const right = Math.max(...chunk.flatMap((line) => line.spans.map((span) => span.x + span.width)));
+ // A block link box spans its column; ordinary prose links only cover their printed text.
+ const footer = linked.find((line) => {
+ const span = line.spans[0];
+ if (!span) return false;
+ const links = doc.links ?? [];
+ const height = doc.pages.find((page) => page.pageNumber === line.page)?.height ?? 0;
+ work.charge(links.length + doc.pages.length);
+ return links.some(
+ (link) =>
+ link.page === line.page &&
+ link.url === annotationTarget(doc, span) &&
+ line.y < height - Math.min(link.rect[1], link.rect[3]) &&
+ line.y + line.height > height - Math.max(link.rect[1], link.rect[3]) &&
+ Math.max(link.rect[0], link.rect[2]) >= right - line.fontSize &&
+ Math.abs(link.rect[2] - link.rect[0]) > line.width + line.fontSize * 2,
+ );
+ });
+ // shortcut: an untagged full-column prose link can resemble a footer field; tagged PDFs would remove this ambiguity.
+ // Other body links, including a leading linked paragraph, stay description prose.
+ const slot = headerLinks.find((line) => line.text === title) ?? footer ?? headerLinks.at(-1);
const linkedSpan = slot?.spans[0];
if (slot && linkedSpan && "website" in item) {
const url = annotationTarget(doc, linkedSpan) ?? "";
@@ -1710,13 +1848,25 @@ function projectSectionFields(data: ResumeData, lines: ImportLine[], doc: Extrac
const displayed = URL.canParse(label) && new URL(label).href === url;
item.website = { url: displayed ? label : url, label: displayed ? "" : label, inlineLink: false };
if (typeof item.description === "string") {
- const suffix = toHtmlBlocks([slot.text]);
- if (item.description.endsWith(suffix)) item.description = item.description.slice(0, -suffix.length);
+ const block = toHtmlBlocks([slot.text]);
+ if (slot === footer) {
+ // A reordered website block can precede the description.
+ if (chunk[bodyStart]?.spans.some((span) => slot.spans.includes(span)) && item.description.startsWith(block))
+ item.description = item.description.slice(block.length);
+ else if (item.description.endsWith(block)) item.description = item.description.slice(0, -block.length);
+ else {
+ // A wrapped last paragraph can share its logical line with the footer link.
+ const suffix = ` ${escapeHtml(label)}</p>`;
+ if (item.description.endsWith(suffix))
+ item.description = item.description.slice(0, -suffix.length) + "</p>";
+ }
+ }
}
}
}
start = end - 1;
}
+ if (hasEducation) data.sections.education.items = education;
return data;
}
@@ -1739,6 +1889,29 @@ export function parsePdfResume(doc: ExtractedDocument) {
function parseGeometryResume(doc: ExtractedDocument) {
const lines = boundedLines(doc);
if (!lines) return flatPdfResume(doc);
+ // Without any geometry heading every line would be filed as header, keeping only contacts. Keep the prose instead:
+ // lines outside the identity block with a field that is neither a contact item nor a link.
+ const prose = lines.filter(
+ (line) =>
+ !line.identity &&
+ fieldsOf(line).some(
+ (field) => !isContactLine(field.text) && !field.spans.every((span) => annotationTarget(doc, span)),
+ ),
+ );
+ if (!lines.some((line) => line.heading) && prose.length) {
+ const flat = flatPdfResume(doc);
+ flat.summary.content = toHtmlBlocks(prose.map((line) => line.text));
+ // Geometry identity is the owner; the text parse only fills fields it left empty.
+ const basics: Record<string, unknown> = { ...flat.basics };
+ for (const [key, value] of Object.entries(readIdentity(lines, doc) ?? {})) {
+ const empty =
+ !value ||
+ (Array.isArray(value) && !value.length) ||
+ (typeof value === "object" && "url" in value && !value.url);
+ if (!empty) basics[key] = value;
+ }
+ return parseResumeData({ ...flat, basics });
+ }
const parsed = parseResumeText(
lines.map((line) => line.text).join("\n"),
@@ -1749,12 +1922,7 @@ function parseGeometryResume(doc: ExtractedDocument) {
(line) => line.identity && !isContactLine(line.text) && line.fontSize > (doc.modalFontSize ?? line.fontSize),
);
if (name && firstSection > 0) {
- const introduction = lines
- .slice(0, firstSection)
- .filter(
- (line) =>
- !line.identity && !isContactLine(line.text) && line.y > name.y + name.height && line.page === name.page,
- );
+ const introduction = lines.slice(0, firstSection).filter((line) => !line.identity && !isContactLine(line.text));
if (introduction.length)
parsed.summary.content = toHtmlBlocks(introduction.map((line) => line.text)) + parsed.summary.content;
}