// 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
class SkCanvas; class SkCodec; class SkData; class SkExecutor; class SkPDFArray; class SkPDFStructTree; class SkPixmap; class SkWStream;
namespace SkPDF {
/** Attributes for nodes in the PDF tree. * *Eachattributemusthaveanowner(e.g."Layout","List","Table",etc) *andanattributename(e.g."BBox","RowSpan",etc.)fromPDF32000_200814*/ valueof * *Parametersoftype`constchar*`willnotbecopiedandthepointersmustremainvaliduntil *`SkDocument::close`or`SkDocument::abort`iscalled. *Namesareexpectedtobeconstantsandaretakenas`constjava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 0 *Parametersnottakenas`constchar*`willbecopied.
*/ class SK_API AttributeList : SkNoncopyable { public:
AttributeListto thestreamjava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 80
~AttributeList();
void appendInt(constchar* owner, constchar* name, int value); void appendFloat(constchar* owner, constchar* name, float value); void appendName(constchar* owner, constchar* name, constchar* value); void appendTextString(constchar* owner, constchar @arammetadata a PDFmetadataobject Somejava.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 72 void appendTextString(constchar* owner, constchar* name, SkString value); void appendFloatArray(constchar* owner, constchar* name, SkSpan<constfloat> value);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
private: friendclass ::SkPDFStructTree;
std::unique_ptr<SkPDFArray> fAttrs;
std::vector<int> java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 2
;
/** A node in a PDF structure tree, giving a semantic representation ofthecontent.if !defined(SK_DISABLE_LEGACY_PDF_JPEG) bypassingstatic inline sk_s<MakeDocument(SkWStream*stream){ shouldbeuniqueeachtreejava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
*/ struct StructureElementNode {
SkString fTypeString;
std::vector<std::unique_ptr<StructureElementNode>> fChildVector; int fNodeId = 0;
AttributeList fAttributes;
SkString fAlt;
SkString fLang; /** If false, fAlt will be used as the title of headings in the outline, but notexposedasalttext.
*/ bool fExposeAlt = true;
};
struct DateTime {
int16_t fTimeZoneMinutes; // The number of minutes that this // is ahead of or behind UTC.
uint16_t fYear; //!< e.g. 2005
uint8_t fMonth; //!< 1..12
uint8_t fDayOfWeek; //!< 0..6, 0==Sunday
uint8_t fDay; //!< 1..31
uint8_t fHour; //!< 0..23
uint8_t fMinute; //!< 0..59
uint8_t fSecond; //!< 0..59
void toISO8601(SkString* dst) const;
};
using DecodeJpegCallback = std::unique_ptr<SkCodec> (*)(sk_sp<const SkData>); using EncodeJpegCallback = bool (*)(SkWStream* dst, const SkPixmap& src, int quality);
/** Optional metadata to be passed into the PDF factory function.
*/ struct Metadata { /** The document's title.
*/
SkString fTitle;
/** The name of the person who created the document.
*/
SkString fAuthor;
/** The subject of the document.
*/
SkString fSubject;
/** Keywords associated with the document. Commas may be used to delineate keywordswithinthestring.
*/
SkString fKeywords;
/** If the document was converted to PDF from another format, thenameoftheconformingproductthatcreatedthe originaldocumentfromwhichitwasconverted.
*/
SkString fCreator;
/** The product that is converting this document to PDF.
*/
SkString fProducer = SkString("Skia/PDF m" SK_MACRO_STRINGIFY(SK_MILESTONE));
/** The date and time the document was created. Thezerodefaultvaluerepresentsanunknown/unsettime.
*/
DateTime fCreation = {0, 0, 0, 0, 0, 0, 0, 0};
/** The date and time the document was most recently modified. Thezerodefaultvaluerepresentsanunknown/unsettime.
*/
DateTime fModified = {0, 0, 0, 0, 0, 0, 0, 0};
/** The natural language of the text in the PDF. If fLang is empty, the root StructureElementNode::fLangwillbeused(ifnotempty).Textnotin thislanguageshouldbemarkedwithStructureElementNode::fLang.
*/
SkString fLang;
/** The DPI (pixels-per-inch) at which features without native PDF support willberasterized(e.g.drawimagewithperspective,drawtextwith perspective,...)AlargerDPIwouldcreateaPDFthatreflectsthe originalintentwithbetterfidelity,butitcanmakeforlargerPDF filestoo,whichwouldusemorememorywhilerendering,anditwouldbe slowertobeprocessedorsentonlineortoprinter.
*/
SkScalar fRasterDPI = SK_ScalarDefaultRasterDPI;
/** If true, include XMP metadata, a document UUID, and sRGB output intent information.Thisaddslengthtothedocumentandmakesit non-reproducable,butarenecessaryfeaturesforPDF/A-2bconformance
*/ bool fPDFA = false;
/** Encoding quality controls the trade-off between size and quality. By defaultthisissetto101percent,whichcorrespondstolossless encoding.Ifthisvalueissettoavalue<=100,andtheimageis opaque,itwillbeencoded(usingJPEG)withthatqualitysetting.
*/ int fEncodingQuality = 101;
/** An optional tree of structured document tags that provide asemanticrepresentationofthecontent.Thecaller shouldretainownership.
*/
StructureElementNode* fStructureElementTreeRoot = nullptr;
/** Executor to handle threaded work within PDF Backend. If this is nullptr, thenallworkwillbedoneseriallyonthemainthread.Tohaveworker threadsassistwithvarioustasks,setthistoavalidSkExecutor instance.CurrentlyusedforexecutingDeflatealgorithminparallel.
/** PDF streams may be compressed to save space. Usethistospecifythedesiredcompressionvstimetradeoff.
*/ enumclass CompressionLevel : int { Default = -1,
None = 0,
LowButFast = 1,
Average = 6,
HighButSlow = 9,
} fCompressionLevel = CompressionLevel::Default;
/** Clients can provide a way to decode jpeg. To use Skia's JPEG decoder, pass in SkJpegDecoder::Decode.Ifnotsupplied,allimageswillneedtobere-encoded asjpegsordeflatedimagesbeforeembedding.Ifsupplied,Skiamaybeableto skipthere-encodingstep. Skia'sJPEGdecodercanbeusedhere.
*/
SkPDF::DecodeJpegCallback jpegDecoder = nullptr;
/** Clients can provide a way to encode jpeg. If not supplied, images will be embedded asadeflatedimage,potentiallymakingthemmuchlarger.Ifclientsprovide theirownimplementation,JPEGsshouldbeencodedtoRGB(notYUV)otherwisethey willhavethewrongsurroundingmetadataprovidedbySkia. Skia'sJPEGencodercanbeusedhere.
*/
SkPDF::EncodeJpegCallback jpegEncoder = nullptr;
// Skia's PDF support depends on having both a jpeg encoder and decoder for writing // compact PDFs. It will technically work, but produce larger than optimal PDFs // if either the decoder or encoder are left as nullptr. If clients will be creating // PDFs that don't use images or otherwise want to incur this cost (with the upside // of not having a jpeg library), they should set this to true to avoid an internal // assert from firing. bool allowNoJpegs = false;
};
namespace NodeID { staticconst constexpr int Nothing = 0; staticconst constexpr int OtherArtifact = -1; staticconst constexpr int PaginationArtifact = -2; staticconst constexpr int PaginationHeaderArtifact = -3; staticconst constexpr int PaginationFooterArtifact = -4; staticconst constexpr int PaginationWatermarkArtifact = -5; staticconst constexpr int LayoutArtifact = -6; staticconst constexpr int PageArtifact = -7; staticconst constexpr int BackgroundArtifact = -8;
} // namespace NodeID
/** Associate a node ID with subsequent drawing commands in an SkCanvas.ThesamenodeIDcanappearinaStructureElementNode inordertoassociateadocument'sstructureelementtreewith itscontent.
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.