1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PDF_DOCUMENT_METADATA_H_
6 #define PDF_DOCUMENT_METADATA_H_
10 #include "base/time/time.h"
12 namespace chrome_pdf {
14 // These values are persisted to logs. Entries should not be renumbered and
15 // numeric values should never be reused.
16 enum class PdfVersion {
26 k1_8 = 9, // Not an actual version. Kept for metrics purposes.
31 // These values are persisted to logs. Entries should not be renumbered and
32 // numeric values should never be reused.
38 kMaxValue = kXFAForeground
41 // Document properties, including those specified in the document information
42 // dictionary (see section 14.3.3 "Document Information Dictionary" of the ISO
43 // 32000-1:2008 spec).
44 struct DocumentMetadata {
46 DocumentMetadata(const DocumentMetadata&) = delete;
47 DocumentMetadata& operator=(const DocumentMetadata&) = delete;
50 // Version of the document.
51 PdfVersion version = PdfVersion::kUnknown;
53 // The size of the document in bytes.
54 size_t size_bytes = 0;
56 // Number of pages in the document.
57 size_t page_count = 0;
59 // Whether the document is optimized by linearization (see annex F "Linearized
60 // PDF" of the ISO 32000-1:2008 spec).
61 bool linearized = false;
63 // Whether the document contains file attachments (see section 12.5.6.15 "File
64 // Attachment Annotations" of the ISO 32000-1:2008 spec).
65 bool has_attachments = false;
67 // The type of form contained in the document.
68 FormType form_type = FormType::kNone;
70 // The document's title.
73 // The name of the document's creator.
76 // The document's subject.
79 // The document's keywords.
82 // The name of the application that created the original document.
85 // If the document's format was not originally PDF, the name of the
86 // application that converted the document to PDF.
89 // The date and time the document was created.
90 base::Time creation_date;
92 // The date and time the document was most recently modified.
96 } // namespace chrome_pdf
98 #endif // PDF_DOCUMENT_METADATA_H_