PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Merge PR #1960: Attachments: attach a file and delete one (panel, edit, tools); duplicate names numbered as text
aionggf053da3d9356
diff --cc crates/automation/src/lib.rsindex 47a325210,57a38a32f..0846207ac--- a/crates/automation/src/lib.rs+++ b/crates/automation/src/lib.rs@@@ -835,8 -835,26 +835,27 @@@ impl Automation"page_add_image" => self.page_add_image(&a)?,"content_update" => self.content_update(&a)?,"content_delete" => self.content_delete(&a)?,+ "content_copy" => self.content_copy(&a)?,"doc_print" => self.doc_print(&a)?,+ "attachment_add" => {+ let path = self.resolve(a.str("path")?, false)?;+ let bytes = std::fs::read(&path).map_err(|e| failed(format!("{}: {e}", path.display())))?;+ let name = match a.opt_str("name")? {+ Some(n) => n.to_string(),+ None => path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(),+ };+ let mime = pdfcraft_engine::mime_for_name(&name).map(str::to_string);+ let description = a.opt_str("description")?.map(str::to_string);+ // Only the document-level keys: an annotation attachment of the same name is not the new one.+ let before = document_attachment_keys(self.doc(&a)?);+ let out = self.apply(&a, Edit::AddAttachment { name, bytes, description, mime })?;+ let key = document_attachment_keys(self.doc(&a)?).into_iter().find(|n| !before.contains(n)).unwrap_or_default();+ json!({ "name": key, "document": out })+ }+ "attachment_delete" => {+ let edit = Edit::DeleteAttachment { key: a.str("name")?.into() };+ self.apply(&a, edit)?+ }"doc_remove_hidden" => self.doc_remove_hidden(&a)?,"doc_audit_redactions" => self.doc_audit_redactions(&a)?,"fill_sign_add" => self.fill_sign_add(&a)?,diff --cc crates/ui-egui/src/i18n/ca.tsvindex 2675eb826,cb1c52f2f..2778dd381--- a/crates/ui-egui/src/i18n/ca.tsv+++ b/crates/ui-egui/src/i18n/ca.tsv@@@ -2781,9 -2774,8 +2781,14 @@@ theme Appearance Aspectfield names can't contain a period: {name} els noms dels camps no poden contenir cap punt: {name}two cells would both be named {name} dues cel·les es dirien {name}a field named {name} already exists ja existeix un camp anomenat {name}++# Date picker: Today button (#4274) (AI-assisted, not separately native-reviewed)+ Today Avui++# AI-assisted additions for restoring the last view (#1767) (2026-10-22); not reviewed by a native speaker.+ Restore the last view (page, zoom and page display) when a document is opened again Restaura l'última vista (pàgina, zoom i visualització de pàgina) quan es torna a obrir un document+ Attach a file… Adjunta un fitxer…+ Attach {name} Adjunta {name}+ Attaching files is not available on the web yet Encara no es poden adjuntar fitxers al web+ Delete attachment Elimina l'adjunt+ Delete attachment {key} Elimina l'adjunt {key}diff --cc crates/ui-egui/src/i18n/fi.tsvindex dcf2ecad2,7c550f2d8..cdda3c89f--- a/crates/ui-egui/src/i18n/fi.tsv+++ b/crates/ui-egui/src/i18n/fi.tsv@@@ -2790,9 -2783,8 +2790,14 @@@ theme Appearance Teemfield names can't contain a period: {name} kenttien nimissä ei voi olla pistettä: {name}two cells would both be named {name} kahdella solulla olisi sama nimi {name}a field named {name} already exists kenttä nimeltä {name} on jo olemassa++# Date picker: Today button (#4274) (AI-assisted, not separately native-reviewed)+ Today Tänään++# AI-assisted additions for restoring the last view (#1767) (2026-10-22); not reviewed by a native speaker.+ Restore the last view (page, zoom and page display) when a document is opened again Palauta viimeisin näkymä (sivu, zoomaus ja sivunäyttö), kun asiakirja avataan uudelleen+ Attach a file… Liitä tiedosto…+ Attach {name} Liitä {name}+ Attaching files is not available on the web yet Tiedostojen liittäminen ei ole vielä käytettävissä verkossa+ Delete attachment Poista liite+ Delete attachment {key} Poista liite {key}diff --cc crates/ui-egui/src/i18n/hi.tsvindex 4740cbac3,3ba979d2d..d33655bcd--- a/crates/ui-egui/src/i18n/hi.tsv+++ b/crates/ui-egui/src/i18n/hi.tsv@@@ -2757,9 -2750,8 +2757,14 @@@ theme Appearance स्वरू�field names can't contain a period: {name} फ़ील्ड के नामों में पूर्ण विराम (.) नहीं हो सकता: {name}two cells would both be named {name} दो सेल का नाम {name} हो जाएगाa field named {name} already exists {name} नाम का फ़ील्ड पहले से मौजूद है++# Date picker: Today button (#4274) (AI-assisted, not separately native-reviewed)+ Today आज++# AI-assisted additions for restoring the last view (#1767) (2026-10-22); not reviewed by a native speaker.+ Restore the last view (page, zoom and page display) when a document is opened again दस्तावेज़ फिर से खोलने पर पिछला दृश्य (पृष्ठ, ज़ूम और पृष्ठ प्रदर्शन) पुनर्स्थापित करें+ Attach a file… फ़ाइल संलग्न करें…+ Attach {name} {name} संलग्न करें+ Attaching files is not available on the web yet वेब पर अभी फ़ाइलें संलग्न करना उपलब्ध नहीं है+ Delete attachment अनुलग्नक हटाएँ+ Delete attachment {key} अनुलग्नक {key} हटाएँdiff --cc crates/ui-egui/src/i18n/id.tsvindex 2610c125a,620315ba4..e6542e4ca--- a/crates/ui-egui/src/i18n/id.tsv+++ b/crates/ui-egui/src/i18n/id.tsv@@@ -2758,9 -2751,8 +2758,14 @@@ theme Appearance Tampilafield names can't contain a period: {name} nama kolom tidak boleh berisi titik: {name}two cells would both be named {name} dua sel akan sama-sama bernama {name}a field named {name} already exists kolom bernama {name} sudah ada++# Date picker: Today button (#4274) (AI-assisted, not separately native-reviewed)+ Today Hari ini++# AI-assisted additions for restoring the last view (#1767) (2026-10-22); not reviewed by a native speaker.+ Restore the last view (page, zoom and page display) when a document is opened again Pulihkan tampilan terakhir (halaman, zoom, dan tampilan halaman) saat dokumen dibuka lagi+ Attach a file… Lampirkan file…+ Attach {name} Lampirkan {name}+ Attaching files is not available on the web yet Melampirkan file belum tersedia di web+ Delete attachment Hapus lampiran+ Delete attachment {key} Hapus lampiran {key}diff --cc crates/ui-egui/src/i18n/ko.tsvindex e9ec77c8b,ba0359ee4..ba4821101--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@@ -2757,9 -2750,8 +2757,14 @@@ theme Appearance 모�field names can't contain a period: {name} 필드 이름에는 마침표를 쓸 수 없습니다: {name}two cells would both be named {name} 두 셀의 이름이 모두 {name}이(가) 됩니다a field named {name} already exists {name}(이)라는 필드가 이미 있습니다++# Date picker: Today button (#4274) (AI-assisted, not separately native-reviewed)+ Today 오늘++# AI-assisted additions for restoring the last view (#1767) (2026-10-22); not reviewed by a native speaker.+ Restore the last view (page, zoom and page display) when a document is opened again 문서를 다시 열 때 마지막 보기(페이지, 확대/축소, 페이지 표시) 복원+ Attach a file… 파일 첨부…+ Attach {name} {name} 첨부+ Attaching files is not available on the web yet 웹에서는 아직 파일을 첨부할 수 없습니다+ Delete attachment 첨부 파일 삭제+ Delete attachment {key} 첨부 파일 {key} 삭제diff --cc crates/ui-egui/src/i18n/ro.tsvindex 50d05a134,80f31766b..85ac9e861--- a/crates/ui-egui/src/i18n/ro.tsv+++ b/crates/ui-egui/src/i18n/ro.tsv@@@ -2781,9 -2774,8 +2781,14 @@@ theme Appearance Aspecfield names can't contain a period: {name} numele câmpurilor nu pot conține punct: {name}two cells would both be named {name} două celule s-ar numi amândouă {name}a field named {name} already exists există deja un câmp numit {name}++# Date picker: Today button (#4274) (AI-assisted, not separately native-reviewed)+ Today Astăzi++# AI-assisted additions for restoring the last view (#1767) (2026-10-22); not reviewed by a native speaker.+ Restore the last view (page, zoom and page display) when a document is opened again Restabilește ultima vizualizare (pagina, zoomul și afișarea paginilor) când un document este redeschis+ Attach a file… Atașare fișier…+ Attach {name} Atașare {name}+ Attaching files is not available on the web yet Atașarea fișierelor nu este încă disponibilă pe web+ Delete attachment Ștergere atașament+ Delete attachment {key} Ștergere atașament {key}diff --cc crates/ui-egui/src/i18n/sq.tsvindex c2a792cd7,df40b1427..6e8de9f68--- a/crates/ui-egui/src/i18n/sq.tsv+++ b/crates/ui-egui/src/i18n/sq.tsv@@@ -2507,9 -2500,8 +2507,14 @@@ animation effects Off Joaktifield names can't contain a period: {name} emrat e fushave nuk mund të përmbajnë pikë: {name}two cells would both be named {name} dy qeliza do të kishin të dyja emrin {name}a field named {name} already exists ekziston tashmë një fushë me emrin {name}++# Date picker: Today button (#4274) (AI-assisted, not separately native-reviewed)+ Today Sot++# AI-assisted additions for restoring the last view (#1767) (2026-10-22); not reviewed by a native speaker.+ Restore the last view (page, zoom and page display) when a document is opened again Rikthe pamjen e fundit (faqen, zmadhimin dhe shfaqjen e faqeve) kur një dokument hapet përsëri+ Attach a file… Bashkëngjit një skedar…+ Attach {name} Bashkëngjit {name}+ Attaching files is not available on the web yet Bashkëngjitja e skedarëve nuk është ende e disponueshme në ueb+ Delete attachment Fshi bashkëngjitjen+ Delete attachment {key} Fshi bashkëngjitjen {key}