From 93543d4821372683c33bac9f94728c05f9995ff7 Mon Sep 17 00:00:00 2001 From: Laurenz Stampfl <47084093+LaurenzV@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:05:31 +0100 Subject: [PATCH] Add PDF/UA (#3) --- src/lib.rs | 28 +++++++++++++++++++++++++++- src/types.rs | 4 ++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f0d4f3b..dc30acc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -675,7 +675,7 @@ impl XmpWriter<'_> { } } -/// PDF/A and PDF/X. +/// PDF/A , PDF/UA and PDF/X. impl<'n> XmpWriter<'n> { /// Write the `pdfaid:part` property. /// @@ -734,6 +734,32 @@ impl<'n> XmpWriter<'n> { self.element("GTS_PDFXVersion", Namespace::PdfXId).value(version); self } + + /// Write the `pdfuaid:part` property. + /// + /// The part of the PDF/UA standard to which the document conforms (e.g. + /// `1`) + pub fn pdfua_part(&mut self, part: i32) -> &mut Self { + self.element("part", Namespace::PdfUAId).value(part); + self + } + + /// Write the `pdfuaid:amd` property. + /// + /// The amendment specifier this file conforms to, if any. + pub fn pdfua_amd(&mut self, amd: &str) -> &mut Self { + self.element("amd", Namespace::PdfUAId).value(amd); + self + } + + /// Write the `pdfuaid:corr` property. + /// + /// The corrigendum specifier this file conforms to, if any. + #[cfg(feature = "pdfa")] + pub fn pdfua_corr(&mut self, corr: &str) -> &mut Self { + self.element("corr", Namespace::PdfUAId).value(corr); + self + } } /// A self-contained thumbnail image. diff --git a/src/types.rs b/src/types.rs index 5ede0de..aba18ff 100644 --- a/src/types.rs +++ b/src/types.rs @@ -30,6 +30,7 @@ pub enum Namespace<'a> { AdobePdf, #[cfg(feature = "pdfa")] PdfAId, + PdfUAId, PdfXId, #[cfg(feature = "pdfa")] PdfAExtension, @@ -76,6 +77,7 @@ impl<'a> Namespace<'a> { Self::XmpIdq => "XMP Identifier Qualifier", #[cfg(feature = "pdfa")] Self::PdfAId => "PDF/A Identification", + Self::PdfUAId => "PDF/UA Identification", Self::PdfXId => "PDF/X Identification", #[cfg(feature = "pdfa")] Self::PdfAExtension => "PDF/A Extension schema container", @@ -114,6 +116,7 @@ impl<'a> Namespace<'a> { Self::XmpIdq => "http://ns.adobe.com/xmp/Identifier/qual/1.0/", #[cfg(feature = "pdfa")] Self::PdfAId => "http://www.aiim.org/pdfa/ns/id/", + Self::PdfUAId => "http://www.aiim.org/pdfua/ns/id/", Self::PdfXId => "http://www.npes.org/pdfx/ns/id/", #[cfg(feature = "pdfa")] Self::PdfAExtension => "http://www.aiim.org/pdfa/ns/extension/", @@ -152,6 +155,7 @@ impl<'a> Namespace<'a> { Self::XmpIdq => "xmpidq", #[cfg(feature = "pdfa")] Self::PdfAId => "pdfaid", + Self::PdfUAId => "pdfuaid", Self::PdfXId => "pdfxid", #[cfg(feature = "pdfa")] Self::PdfAExtension => "pdfaExtension",