Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PDF/UA methods #3

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading