• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Using Skia's PDF Backend
2========================
3
4Here is an example of using Skia's PDF backend (SkPDF) via the
5SkDocument and SkCanvas APIs.
6
7<fiddle-embed name='@PDF'></fiddle-embed>
8<!-- https://fiddle.skia.org/c/@PDF docs/examples/PDF.cpp -->
9
10* * *
11
12<span id="limits">SkPDF Limitations</span>
13------------------------------------------
14
15There are several corners of Skia's public API that SkPDF currently
16does not handle because either no known client uses the feature or
17there is no simple PDF-ish way to handle it.
18
19In this document:
20
21  + **drop** means to draw nothing.
22
23  + **ignore** means to draw without the effect
24
25  + **expand** means to implement something in a non-PDF-ish way.
26    This may mean to rasterize vector graphics, to expand paths with
27    path effects into many individual paths, or to convert text to
28    paths.
29
30<style scoped><!--
31#pdftable {border-collapse:collapse;}
32#pdftable tr th, #pdftable tr td {border:#888888 2px solid;padding: 5px;}
33--></style>
34<table id="pdftable">
35<tr><th>Effect</th>                  <th>text</th>   <th>images</th> <th>everything
36                                                                         else</th></tr>
37<tr><th>SkMaskFilter</th>            <td>drop</td>   <td>ignore</td> <td>ignore</td></tr>
38<tr><th>SkPathEffect</th>            <td>ignore</td> <td>n/a</td>    <td>expand</td></tr>
39<tr><th>SkColorFilter</th>           <td>ignore</td> <td>expand</td> <td>ignore</td></tr>
40<tr><th>SkImageFilter</th>           <td>expand</td> <td>expand</td> <td>expand</td></tr>
41<tr><th>unsupported SkXferModes</th> <td>ignore</td> <td>ignore</td> <td>ignore</td></tr>
42<tr><th>non-gradient SkShader</th>   <td>expand</td> <td>n/a</td>    <td>expand</td></tr>
43</table>
44
45Notes:
46
47  - *SkImageFilter*: When SkImageFilter is expanded, text-as-text is lost.
48
49  - *SkXferMode*: The following transfer modes are not natively
50    supported by PDF: DstOver, SrcIn, DstIn, SrcOut, DstOut, SrcATop,
51    DstATop, and Modulate.
52
53Other limitations:
54
55  - *drawText with VerticalText* — drop. No known clients seem to make use
56    of the VerticalText flag.
57
58  - *drawTextOnPath* — expand. (Text-as-text is lost.)
59
60  - *drawVertices* — drop.
61
62  - *drawPatch* — drop.
63
64* * *
65