Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: src/pdf/SkPDFMetadata.cpp

Issue 2119883002: SkPDF: fix PDFA-only metadata error (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMD5.h" 8 #include "SkMD5.h"
9 #include "SkMilestone.h" 9 #include "SkMilestone.h"
10 #include "SkPDFMetadata.h" 10 #include "SkPDFMetadata.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 metadata.fSubject, 307 metadata.fSubject,
308 "<dc:description><rdf:Alt><rdf:li xml:lang=\"x-default\">", 308 "<dc:description><rdf:Alt><rdf:li xml:lang=\"x-default\">",
309 "</rdf:li></rdf:Alt></dc:description>\n"); 309 "</rdf:li></rdf:Alt></dc:description>\n");
310 SkString keywords1 = 310 SkString keywords1 =
311 escape_xml(metadata.fKeywords, "<dc:subject><rdf:Bag><rdf:li>", 311 escape_xml(metadata.fKeywords, "<dc:subject><rdf:Bag><rdf:li>",
312 "</rdf:li></rdf:Bag></dc:subject>\n"); 312 "</rdf:li></rdf:Bag></dc:subject>\n");
313 SkString keywords2 = escape_xml(metadata.fKeywords, "<pdf:Keywords>", 313 SkString keywords2 = escape_xml(metadata.fKeywords, "<pdf:Keywords>",
314 "</pdf:Keywords>\n"); 314 "</pdf:Keywords>\n");
315 // TODO: in theory, keywords can be a list too. 315 // TODO: in theory, keywords can be a list too.
316 316
317 SkString producer("<pdf:Producer>SKPDF_PRODUCER</pdf:Producer>\n"); 317 SkString producer("<pdf:Producer>" SKPDF_PRODUCER "</pdf:Producer>\n");
318 if (!metadata.fProducer.isEmpty()) { 318 if (!metadata.fProducer.isEmpty()) {
319 // TODO: register a developer prefix to make 319 // TODO: register a developer prefix to make
320 // <skia:SKPDF_CUSTOM_PRODUCER_KEY> a real XML tag. 320 // <skia:SKPDF_CUSTOM_PRODUCER_KEY> a real XML tag.
321 producer = escape_xml( 321 producer = escape_xml(
322 metadata.fProducer, "<pdf:Producer>", 322 metadata.fProducer, "<pdf:Producer>",
323 "</pdf:Producer>\n<!-- <skia:" SKPDF_CUSTOM_PRODUCER_KEY ">" 323 "</pdf:Producer>\n<!-- <skia:" SKPDF_CUSTOM_PRODUCER_KEY ">"
324 SKPDF_PRODUCER "</skia:" SKPDF_CUSTOM_PRODUCER_KEY "> -->\n"); 324 SKPDF_PRODUCER "</skia:" SKPDF_CUSTOM_PRODUCER_KEY "> -->\n");
325 } 325 }
326 326
327 SkString creator = escape_xml(metadata.fCreator, "<xmp:CreatorTool>", 327 SkString creator = escape_xml(metadata.fCreator, "<xmp:CreatorTool>",
328 "</xmp:CreatorTool>\n"); 328 "</xmp:CreatorTool>\n");
329 SkString documentID = uuid_to_string(doc); // no need to escape 329 SkString documentID = uuid_to_string(doc); // no need to escape
330 SkASSERT(0 == count_xml_escape_size(documentID)); 330 SkASSERT(0 == count_xml_escape_size(documentID));
331 SkString instanceID = uuid_to_string(instance); 331 SkString instanceID = uuid_to_string(instance);
332 SkASSERT(0 == count_xml_escape_size(instanceID)); 332 SkASSERT(0 == count_xml_escape_size(instanceID));
333 return sk_make_sp<PDFXMLObject>(SkStringPrintf( 333 return sk_make_sp<PDFXMLObject>(SkStringPrintf(
334 templateString, modificationDate.c_str(), creationDate.c_str(), 334 templateString, modificationDate.c_str(), creationDate.c_str(),
335 creator.c_str(), title.c_str(), subject.c_str(), author.c_str(), 335 creator.c_str(), title.c_str(), subject.c_str(), author.c_str(),
336 keywords1.c_str(), documentID.c_str(), instanceID.c_str(), 336 keywords1.c_str(), documentID.c_str(), instanceID.c_str(),
337 producer.c_str(), keywords2.c_str())); 337 producer.c_str(), keywords2.c_str()));
338 } 338 }
339 339
340 #undef SKPDF_CUSTOM_PRODUCER_KEY 340 #undef SKPDF_CUSTOM_PRODUCER_KEY
341 #undef SKPDF_PRODUCER 341 #undef SKPDF_PRODUCER
342 #undef SKPDF_STRING 342 #undef SKPDF_STRING
343 #undef SKPDF_STRING_IMPL 343 #undef SKPDF_STRING_IMPL
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698