// Logically part of SkPDFDocument, but separate to keep similar functionality together. class SkPDFOffsetMap {
public: void markStartOfDocument(const SkWStream*); void markStartOfObject(int referenceNumber, const SkWStream*); int objectCount() const; int emitCrossReferenceTable(SkWStream* s) const; private:
std::vector<int> fOffsets;
size_t fBaseOffset = SIZE_MAX;
};
struct SkPDFLink { enumclass Type {
kNone,
kUrl,
kNamedDestination,
};
SkPDFLink(Type type, SkData* data, const SkRect& rect, int elemId)
: fType(type)
, fData(sk_ref_sp(data))
, fRect(rect)
, fElemId(elemId) {} const Type fType; // The url or named destination, depending on |fType|. const sk_sp<SkData> fData; const SkRect fRect; constint fElemId;
};
/** Concrete implementation of SkDocument that creates PDF files. This classdoesnotproducedlinearizedoroptimizedPDFs;insteadit
it attempts to use a minimum amount of RAM. */ class SkPDFDocument : public SkDocument {
public:
SkPDFDocument(SkWStream*, SkPDF::Metadata);
~SkPDFDocument() override;
SkCanvas* onBeginPage(SkScalar, SkScalar) override; void onEndPage() override; void onClose(SkWStream*) override; void onAbort() override;
// Create a new marked-content identifier (MCID) to be used with a marked-content sequence // parented by the structure element (StructElem) with the given element identifier (elemId). // Returns a false Mark if if elemId does not refer to a StructElem. // // If a true Mark is returned and structParentsKey is false, the Mark will be added to a new // StructParents and structParentsKey will be updated to reference the StructParents entry.
SkPDFStructTree::Mark createMarkForElemId(int elemId, SkPDFParentTreeKey& structParentsKey);
// Create a key to use with /StructParent in a content item (usually an annotation) which refers // to the structure element (StructElem) with the given element identifier (elemId). // Returns false key if elemId does not refer to a StructElem.
SkPDFParentTreeKey createStructParentKeyForElemId(int elemId,
SkPDFIndirectReference contentItemRef);
// Every reference returned by this method must be passed to `emit` exactly once.
SkPDFIndirectReference reserveRef() { return SkPDFIndirectReference{fNextObjectNumber++}; }
// Returns a tag to prepend to a PostScript name of a subset font. Includes the '+'.
SkString nextFontSubsetTag();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.