diff options
author | halcanary <halcanary@google.com> | 2015-10-09 13:09:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-09 13:09:58 -0700 |
commit | 939c0fe51f157104758bcb268643c8b6d317a530 (patch) | |
tree | 1c2fb3639dd1ae608ae00fc99130d09a427bf5cd /src/pdf/SkPDFMetadata.h | |
parent | e361781bf7ce8acd4af00c426b34596804d45d77 (diff) |
SkPDF: Optionally output PDF/A-2b archive format.
Note: this format does not yet pass validation tests.
Add skia_pdf_generate_pdfa GYP flag. Default to off for now.
PDF/A files are not reproducable, so they make correctness
testing harder.
Turn the Metadata struct into te SkPDFMetadata struct. This
splits out a lot of functionality around both kinds of metadata.
When PDF/A is used, add an ID entry to the trailer.
Add SkPDFObjNumMap::addObjectRecursively.
Test with
GYP_DEFINES=skia_pdf_generate_pdfa=1 bin/sync-and-gyp
ninja -C out/Release dm
out/Release/dm --config pdf --src skp gm -w /tmp/dm
With skia_pdf_generate_pdfa=0, all PDFs generated from GMs and
SKPs are identical. With skia_pdf_generate_pdfa=1, all PDFs
generated from GMs and SKPs render identically in Pdfium.
BUG=skia:3110
Review URL: https://codereview.chromium.org/1394263003
Diffstat (limited to 'src/pdf/SkPDFMetadata.h')
-rw-r--r-- | src/pdf/SkPDFMetadata.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/pdf/SkPDFMetadata.h b/src/pdf/SkPDFMetadata.h new file mode 100644 index 0000000000..3475ac2500 --- /dev/null +++ b/src/pdf/SkPDFMetadata.h @@ -0,0 +1,34 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkPDFMetadata_DEFINED +#define SkPDFMetadata_DEFINED + +#include "SkDocument.h" +#include "SkTime.h" + +class SkPDFObject; + +struct SkPDFMetadata { + SkTArray<SkDocument::Attribute> fInfo; + SkAutoTDelete<const SkTime::DateTime> fCreation; + SkAutoTDelete<const SkTime::DateTime> fModified; + + SkPDFObject* createDocumentInformationDict() const; + + struct UUID { + uint8_t fData[16]; + }; + UUID uuid() const; + static SkPDFObject* CreatePdfId(const UUID& doc, const UUID& instance); + +#ifdef SK_PDF_GENERATE_PDFA + SkPDFObject* createXMPObject(const UUID& doc, const UUID& instance) const; +#endif // SK_PDF_GENERATE_PDFA +}; + +#endif // SkPDFMetadata_DEFINED |