OLD | NEW |
(Empty) | |
| 1 Using Skia's PDF Backend |
| 2 ======================== |
| 3 |
| 4 Here is an example of using Skia's PDF backend in the recommended way: |
| 5 via the SkDocument and SkCanvas APIs. |
| 6 |
| 7 <!--?prettify?--> |
| 8 |
| 9 #include "SkDocument.h" |
| 10 |
| 11 bool WritePDF() { |
| 12 SkWStream* output = ....; |
| 13 |
| 14 SkAutoTUnref<SkDocument> pdfDocument( |
| 15 SkDocument::CreatePDF(outputStream)); |
| 16 |
| 17 int numberOfPages = ....; |
| 18 for (int page = 0; page < numberOfPages; ++page) { |
| 19 SkScalar pageWidth = ....; |
| 20 SkScalar pageHeight = ....; |
| 21 SkCanvas* pageCanvas = |
| 22 pdfDocument->beginPage(pageWidth, pageHeight); |
| 23 |
| 24 // ....insert canvas draw commands here.... |
| 25 |
| 26 pdfDocument->endPage(); |
| 27 } |
| 28 return pdfDocument->close(); |
| 29 } |
OLD | NEW |