Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1962)

Delta Between Two Patch Sets: include/pdf/SkPDFDocument.h

Issue 4633050: Refactor SkPDFFont to enable font/cmap subsetting (Closed) Base URL: http://skia.googlecode.com/svn/trunk
Left Patch Set: Update per feedback Created 13 years, 5 months ago
Right Patch Set: Fix corrupted xref table Created 13 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « include/pdf/SkPDFDevice.h ('k') | include/pdf/SkPDFFont.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * Copyright (C) 2010 The Android Open Source Project 2 * Copyright (C) 2010 The Android Open Source Project
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at 6 * You may obtain a copy of the License at
7 * 7 *
8 * http://www.apache.org/licenses/LICENSE-2.0 8 * http://www.apache.org/licenses/LICENSE-2.0
9 * 9 *
10 * Unless required by applicable law or agreed to in writing, software 10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, 11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 #ifndef SkPDFDocument_DEFINED 17 #ifndef SkPDFDocument_DEFINED
18 #define SkPDFDocument_DEFINED 18 #define SkPDFDocument_DEFINED
19 19
20 #include "SkPDFCatalog.h"
21 #include "SkPDFTypes.h" 20 #include "SkPDFTypes.h"
22 #include "SkRefCnt.h" 21 #include "SkRefCnt.h"
23 #include "SkTDArray.h" 22 #include "SkTDArray.h"
23 #include "SkTScopedPtr.h"
24 24
25 class SkPDFCatalog;
25 class SkPDFDevice; 26 class SkPDFDevice;
26 class SkPDFPage; 27 class SkPDFPage;
27 class SkWSteam; 28 class SkWSteam;
28 29
29 /** \class SkPDFDocument 30 /** \class SkPDFDocument
30 31
31 A SkPDFDocument assembles pages together and generates the final PDF file. 32 A SkPDFDocument assembles pages together and generates the final PDF file.
32 */ 33 */
33 class SkPDFDocument { 34 class SkPDFDocument {
34 public: 35 public:
36 enum Flags {
37 kNoCompression_Flag = 0x01, //!< mask disable stream compression.
38 kNoEmbedding_Flag = 0x02, //!< mask do not embed fonts.
39
40 kDraftMode_Flags = 0x03,
41 };
35 /** Create a PDF document. 42 /** Create a PDF document.
36 */ 43 */
37 SK_API SkPDFDocument(); 44 explicit SK_API SkPDFDocument(Flags flags = (Flags)0);
38 SK_API ~SkPDFDocument(); 45 SK_API ~SkPDFDocument();
39 46
40 /** Output the PDF to the passed stream. 47 /** Output the PDF to the passed stream. It is an error to call this (it
48 * will return false and not modify stream) if no pages have been added
49 * or there are pages missing (i.e. page 1 and 3 have been added, but not
50 * page 2).
51 *
41 * @param stream The writable output stream to send the PDF to. 52 * @param stream The writable output stream to send the PDF to.
42 */ 53 */
43 SK_API bool emitPDF(SkWStream* stream); 54 SK_API bool emitPDF(SkWStream* stream);
55
56 /** Sets the specific page to the passed PDF device. If the specified
57 * page is already set, this overrides it. Returns true if successful.
58 * Will fail if the document has already been emitted.
59 *
60 * @param pageNumber The position to add the passed device (1 based).
61 * @param pdfDevice The page to add to this document.
62 */
63 SK_API bool setPage(int pageNumber, SkPDFDevice* pdfDevice);
44 64
45 /** Append the passed pdf device to the document as a new page. Returns 65 /** Append the passed pdf device to the document as a new page. Returns
46 * true if successful. Will fail if the document has already been emitted. 66 * true if successful. Will fail if the document has already been emitted.
47 * 67 *
48 * @param pdfDevice The page to add to this document. 68 * @param pdfDevice The page to add to this document.
49 */ 69 */
50 SK_API bool appendPage(const SkRefPtr<SkPDFDevice>& pdfDevice); 70 SK_API bool appendPage(SkPDFDevice* pdfDevice);
51 71
52 /** Get the list of pages in this document. 72 /** Get the list of pages in this document.
53 */ 73 */
54 SK_API const SkTDArray<SkPDFPage*>& getPages(); 74 SK_API const SkTDArray<SkPDFPage*>& getPages();
55 75
56 private: 76 private:
57 SkPDFCatalog fCatalog; 77 SkTScopedPtr<SkPDFCatalog> fCatalog;
58 int64_t fXRefFileOffset; 78 int64_t fXRefFileOffset;
59 79
60 SkTDArray<SkPDFPage*> fPages; 80 SkTDArray<SkPDFPage*> fPages;
61 SkTDArray<SkPDFDict*> fPageTree; 81 SkTDArray<SkPDFDict*> fPageTree;
62 SkRefPtr<SkPDFDict> fDocCatalog; 82 SkRefPtr<SkPDFDict> fDocCatalog;
63 SkTDArray<SkPDFObject*> fPageResources; 83 SkTDArray<SkPDFObject*> fPageResources;
84 SkTDArray<SkPDFObject*> fSubstitutes;
64 int fSecondPageFirstResourceIndex; 85 int fSecondPageFirstResourceIndex;
65 bool fForPreview;
66 86
67 SkRefPtr<SkPDFDict> fTrailerDict; 87 SkRefPtr<SkPDFDict> fTrailerDict;
68 88
69 /** Output the PDF header to the passed stream. 89 /** Output the PDF header to the passed stream.
70 * @param stream The writable output stream to send the header to. 90 * @param stream The writable output stream to send the header to.
71 */ 91 */
72 void emitHeader(SkWStream* stream); 92 void emitHeader(SkWStream* stream);
73 93
74 /** Get the size of the header. 94 /** Get the size of the header.
75 */ 95 */
76 size_t headerSize(); 96 size_t headerSize();
77 97
78 /** Output the PDF footer to the passed stream. 98 /** Output the PDF footer to the passed stream.
79 * @param stream The writable output stream to send the footer to. 99 * @param stream The writable output stream to send the footer to.
80 * @param objCount The number of objects in the PDF. 100 * @param objCount The number of objects in the PDF.
81 */ 101 */
82 void emitFooter(SkWStream* stream, int64_t objCount); 102 void emitFooter(SkWStream* stream, int64_t objCount);
83 }; 103 };
84 104
85 #endif 105 #endif
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b