OLD | NEW |
1 PDF Theory of Operation | 1 PDF Theory of Operation |
2 ======================= | 2 ======================= |
3 | 3 |
4 <!-- | 4 <!-- |
5 PRE-GIT DOCUMENT VERSION HISTORY | 5 PRE-GIT DOCUMENT VERSION HISTORY |
6 2012-06-25 Steve VanDeBogart | 6 2012-06-25 Steve VanDeBogart |
7 * Original version | 7 * Original version |
8 2015-01-14 Hal Canary. | 8 2015-01-14 Hal Canary. |
9 * Add section "Using the PDF backend" | 9 * Add section "Using the PDF backend" |
10 * Markdown formatting | 10 * Markdown formatting |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 care and feeding than SkDevice. Once drawing is complete, the device | 47 care and feeding than SkDevice. Once drawing is complete, the device |
48 should be added to an SkPDFDocument as a page of the desired PDF. A | 48 should be added to an SkPDFDocument as a page of the desired PDF. A |
49 new SkPDFDevice should be created for each page desired in the | 49 new SkPDFDevice should be created for each page desired in the |
50 document. After all the pages have been added to the document, | 50 document. After all the pages have been added to the document, |
51 `SkPDFDocument::emitPDF()` can be called to get a PDF file. One of the | 51 `SkPDFDocument::emitPDF()` can be called to get a PDF file. One of the |
52 special features of the PDF backend is that the same device can be | 52 special features of the PDF backend is that the same device can be |
53 added to multiple documents. This for example, would let you generate | 53 added to multiple documents. This for example, would let you generate |
54 a PDF with the single page you just drew as well as adding it to a | 54 a PDF with the single page you just drew as well as adding it to a |
55 longer document with a bunch of other pages. | 55 longer document with a bunch of other pages. |
56 | 56 |
| 57 <!--?prettify lang=cc?--> |
| 58 |
57 SkAutoUnref<SkPDFDevice> pdfDevice( | 59 SkAutoUnref<SkPDFDevice> pdfDevice( |
58 new SkPDFDevice(width, height, initial_transform)); | 60 new SkPDFDevice(width, height, initial_transform)); |
59 | 61 |
60 SkCanvas canvas(pdfDevice); | 62 SkCanvas canvas(pdfDevice); |
61 draw_content(&canvas); | 63 draw_content(&canvas); |
62 | 64 |
63 SkPDFDocument doc; | 65 SkPDFDocument doc; |
64 doc.appendPage(dev); | 66 doc.appendPage(dev); |
65 doc.emitPDF(&pdf_stream); | 67 doc.emitPDF(&pdf_stream); |
66 | 68 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 * [issue 244](http://skbug.com/244) | 588 * [issue 244](http://skbug.com/244) |
587 Mostly, only TTF fonts are directly supported. (User metrics | 589 Mostly, only TTF fonts are directly supported. (User metrics |
588 show that almost all fonts are truetype. | 590 show that almost all fonts are truetype. |
589 * [issue 260](http://skbug.com/260) | 591 * [issue 260](http://skbug.com/260) |
590 Page rotation is accomplished by specifying a different | 592 Page rotation is accomplished by specifying a different |
591 size page instead of including the appropriate rotation | 593 size page instead of including the appropriate rotation |
592 annotation. | 594 annotation. |
593 | 595 |
594 * * * | 596 * * * |
595 | 597 |
OLD | NEW |