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