mirror of
https://github.com/typst/typst
synced 2025-06-29 00:32:53 +08:00
Derive PDF instance id from content hash (#2552)
This commit is contained in:
parent
51d9fe2d02
commit
b716700b61
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1750,9 +1750,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pdf-writer"
|
name = "pdf-writer"
|
||||||
version = "0.9.1"
|
version = "0.9.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "690874e8cf95d36ddffbdbdaad6ef8714c88bf8085996b673559389a04e38a02"
|
checksum = "644b654f2de28457bf1e25a4905a76a563d1128a33ce60cf042f721f6818feaf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"itoa",
|
"itoa",
|
||||||
|
@ -31,7 +31,7 @@ kurbo = "0.9"
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
miniz_oxide = "0.7"
|
miniz_oxide = "0.7"
|
||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
pdf-writer = "0.9.1"
|
pdf-writer = "0.9.2"
|
||||||
pixglyph = "0.2"
|
pixglyph = "0.2"
|
||||||
palette = { version = "0.7.3", default-features = false, features = ["approx", "libm"] }
|
palette = { version = "0.7.3", default-features = false, features = ["approx", "libm"] }
|
||||||
regex = "1"
|
regex = "1"
|
||||||
|
@ -207,8 +207,7 @@ fn write_catalog(ctx: &mut PdfContext, ident: Option<&str>, timestamp: Option<Da
|
|||||||
|
|
||||||
// A unique ID for this instance of the document. Changes if anything
|
// A unique ID for this instance of the document. Changes if anything
|
||||||
// changes in the frames.
|
// changes in the frames.
|
||||||
let instance_id =
|
let instance_id = hash_base64(&ctx.pdf.as_bytes());
|
||||||
hash_base64(&(&ctx.document, ctx.document.date.unwrap_or(timestamp)));
|
|
||||||
|
|
||||||
if let Some(ident) = ident {
|
if let Some(ident) = ident {
|
||||||
// A unique ID for the document that stays stable across compilations.
|
// A unique ID for the document that stays stable across compilations.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user