Skip to content

Commit f1c7efd

Browse files
committed
chore: set xmp CreatorTool
1 parent 36f5255 commit f1c7efd

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

crates/pdf/src/high/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ impl Handle<'_> {
271271
conformance: 'B',
272272
},
273273
basic: xmp::XmpBasic {
274-
creator_tool: self.meta.producer.clone(),
274+
creator_tool: self
275+
.meta
276+
.creator
277+
.clone()
278+
.unwrap_or_else(|| "pdf-create".to_owned()),
275279
create_date: self.meta.creation_date,
276280
modify_date: self.meta.modify_date,
277281
metadata_date: now,

crates/pdf/src/xmp.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl XmpDescription for Pdf {
4040
const NAMESPACE_KEY: &'static str = "pdf";
4141

4242
fn write<W: io::Write>(&self, w: &mut W) -> io::Result<()> {
43-
writeln!(w, " <pdf:Producer>{}</pdf:Producer>", self.producer)?;
43+
writeln!(w, " <pdf:Producer>{}</pdf:Producer>", self.producer)?;
4444
Ok(())
4545
}
4646
}
@@ -104,10 +104,10 @@ impl XmpDescription for PdfAId {
104104
const NAMESPACE_KEY: &'static str = "pdfaid";
105105

106106
fn write<W: io::Write>(&self, w: &mut W) -> io::Result<()> {
107-
writeln!(w, " <pdfaid:part>{}</pdfaid:part>", self.part)?;
107+
writeln!(w, " <pdfaid:part>{}</pdfaid:part>", self.part)?;
108108
writeln!(
109109
w,
110-
" <pdfaid:conformance>{}</pdfaid:conformance>",
110+
" <pdfaid:conformance>{}</pdfaid:conformance>",
111111
self.conformance
112112
)?;
113113
Ok(())
@@ -133,22 +133,22 @@ impl XmpDescription for XmpBasic {
133133
fn write<W: io::Write>(&self, w: &mut W) -> io::Result<()> {
134134
writeln!(
135135
w,
136-
" <xmp:CreatorTool>{}</xmp:CreatorTool>",
136+
" <xmp:CreatorTool>{}</xmp:CreatorTool>",
137137
self.creator_tool
138138
)?;
139139
writeln!(
140140
w,
141-
" <xmp:ModifyDate>{}</xmp:ModifyDate>",
141+
" <xmp:ModifyDate>{}</xmp:ModifyDate>",
142142
self.modify_date.format("%+")
143143
)?;
144144
writeln!(
145145
w,
146-
" <xmp:CreateDate>{}</xmp:CreateDate>",
146+
" <xmp:CreateDate>{}</xmp:CreateDate>",
147147
self.create_date.format("%+")
148148
)?;
149149
writeln!(
150150
w,
151-
" <xmp:MetadataDate>{}</xmp:MetadataDate>",
151+
" <xmp:MetadataDate>{}</xmp:MetadataDate>",
152152
self.metadata_date.format("%+")
153153
)?;
154154
Ok(())
@@ -170,12 +170,12 @@ impl XmpDescription for XmpMM {
170170
fn write<W: io::Write>(&self, w: &mut W) -> io::Result<()> {
171171
writeln!(
172172
w,
173-
" <xmpMM:DocumentID>uuid:{}</xmpMM:DocumentID>",
173+
" <xmpMM:DocumentID>uuid:{}</xmpMM:DocumentID>",
174174
self.document_id
175175
)?;
176176
writeln!(
177177
w,
178-
" <xmpMM:InstanceID>uuid:{}</xmpMM:InstanceID>",
178+
" <xmpMM:InstanceID>uuid:{}</xmpMM:InstanceID>",
179179
self.instance_id
180180
)?;
181181
Ok(())
@@ -210,12 +210,12 @@ impl<W: io::Write> XmpWriter<W> {
210210
let w = &mut self.0;
211211
writeln!(
212212
w,
213-
" <rdf:Description rdf:about=\"\" xmlns:{}=\"{}\">",
213+
" <rdf:Description rdf:about=\"\" xmlns:{}=\"{}\">",
214214
X::NAMESPACE_KEY,
215215
X::NAMESPACE_URL
216216
)?;
217217
desc.write(w)?;
218-
writeln!(w, " </rdf:Description>")?;
218+
writeln!(w, " </rdf:Description>")?;
219219
Ok(())
220220
}
221221

0 commit comments

Comments
 (0)