Skip to content

Commit

Permalink
Add PDF/UA (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV authored Oct 30, 2024
1 parent 4da0fb9 commit 93543d4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub enum Namespace<'a> {
AdobePdf,
#[cfg(feature = "pdfa")]
PdfAId,
PdfUAId,
PdfXId,
#[cfg(feature = "pdfa")]
PdfAExtension,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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/",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 93543d4

Please sign in to comment.