From a56f222b009c3c716ba99127e952547a454d86f3 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Mon, 3 Jun 2024 14:31:59 +0100 Subject: [PATCH] Delete XML declaration from XMP --- cpdfmetadata.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpdfmetadata.ml b/cpdfmetadata.ml index 80a68e0..fcd6940 100644 --- a/cpdfmetadata.ml +++ b/cpdfmetadata.ml @@ -314,7 +314,9 @@ let bytes_of_xmltree t = | D d -> `Data d in Cpdfxmlm.output_doc_tree frag o t; - bytes_of_string (Buffer.contents buf) + (* Delete the ?xml declaration, per XMP spec. *) + let s = Buffer.contents buf in + bytes_of_string (String.sub s 39 (String.length s - 39)) let rec string_of_xmltree = function D d ->