skia2/site/docs/user/sample/pdf.md
Joe Gregorio 29399939c8 [docsy] Lean on Hugo to generate the ToC for each page.
Instead of manually maintaining them, which is error prone.

Change-Id: If78a564e4afe238d195b952fea276154b2e12b06
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449917
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
2021-09-17 17:47:52 +00:00

2.1 KiB

title linkTitle
Using Skia's PDF Backend Using Skia's PDF Backend

Here is an example of using Skia's PDF backend (SkPDF) via the SkDocument and SkCanvas APIs.


SkPDF Limitations

There are several corners of Skia's public API that SkPDF currently does not handle because either no known client uses the feature or there is no simple PDF-ish way to handle it.

In this document:

  • drop means to draw nothing.

  • ignore means to draw without the effect

  • expand means to implement something in a non-PDF-ish way. This may mean to rasterize vector graphics, to expand paths with path effects into many individual paths, or to convert text to paths.

Effect text images everything else
SkMaskFilter drop ignore ignore
SkPathEffect ignore n/a expand
SkColorFilter ignore expand ignore
SkImageFilter expand expand expand
unsupported SkXferModes ignore ignore ignore
non-gradient SkShader expand n/a expand

Notes:

  • SkImageFilter: When SkImageFilter is expanded, text-as-text is lost.

  • SkXferMode: The following transfer modes are not natively supported by PDF: DstOver, SrcIn, DstIn, SrcOut, DstOut, SrcATop, DstATop, and Modulate.

Other limitations:

  • drawText with VerticalText — drop. No known clients seem to make use of the VerticalText flag.

  • drawTextOnPath — expand. (Text-as-text is lost.)

  • drawVertices — drop.

  • drawPatch — drop.