// Copyright 2018 Google LLC. // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. #ifndef SkPDFDocument_DEFINED #define SkPDFDocument_DEFINED #include "include/core/SkDocument.h" #include "include/core/SkMilestone.h" #include "include/core/SkRefCnt.h" #include "include/core/SkScalar.h" #include "include/core/SkString.h" #include "include/private/base/SkAPI.h" #include "include/private/base/SkNoncopyable.h" #include <cstdint> #include <memory> #include <vector> class SkCanvas; class SkExecutor; class SkPDFArray; class SkPDFTagTree; class SkWStream; #define SKPDF_STRING … #define SKPDF_STRING_IMPL … namespace SkPDF { /** Attributes for nodes in the PDF tree. */ class SK_API AttributeList : SkNoncopyable { … }; /** A node in a PDF structure tree, giving a semantic representation of the content. Each node ID is associated with content by passing the SkCanvas and node ID to SkPDF::SetNodeId() when drawing. NodeIDs should be unique within each tree. */ struct StructureElementNode { … }; struct DateTime { … }; /** Optional metadata to be passed into the PDF factory function. */ struct Metadata { … }; /** Associate a node ID with subsequent drawing commands in an SkCanvas. The same node ID can appear in a StructureElementNode in order to associate a document's structure element tree with its content. A node ID of zero indicates no node ID. @param canvas The canvas used to draw to the PDF. @param nodeId The node ID for subsequent drawing commands. */ SK_API void SetNodeId(SkCanvas* dst, int nodeID); /** Create a PDF-backed document, writing the results into a SkWStream. PDF pages are sized in point units. 1 pt == 1/72 inch == 127/360 mm. @param stream A PDF document will be written to this stream. The document may write to the stream at anytime during its lifetime, until either close() is called or the document is deleted. @param metadata a PDFmetadata object. Any fields may be left empty. @returns NULL if there is an error, otherwise a newly created PDF-backed SkDocument. */ SK_API sk_sp<SkDocument> MakeDocument(SkWStream* stream, const Metadata& metadata); static inline sk_sp<SkDocument> MakeDocument(SkWStream* stream) { … } } // namespace SkPDF #undef SKPDF_STRING #undef SKPDF_STRING_IMPL #endif // SkPDFDocument_DEFINED