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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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?--> | 57 <!--?prettify lang=cc?--> |
58 | 58 |
| 59 SkPDFCanon canon; |
59 SkAutoUnref<SkPDFDevice> pdfDevice( | 60 SkAutoUnref<SkPDFDevice> pdfDevice( |
60 new SkPDFDevice(width, height, initial_transform)); | 61 SkPDFDevice::Create(SkISize::Make(width, height), 72.0f, &canon)); |
61 | 62 |
62 SkCanvas canvas(pdfDevice); | 63 SkCanvas canvas(pdfDevice); |
63 draw_content(&canvas); | 64 draw_content(&canvas); |
64 | 65 |
65 SkPDFDocument doc; | 66 SkPDFDocument doc; |
66 doc.appendPage(dev); | 67 doc.appendPage(dev); |
67 doc.emitPDF(&pdf_stream); | 68 doc.emitPDF(&pdf_stream); |
68 | 69 |
69 <a name="PDF_Objects_and_Document_Structure"></a> | 70 <a name="PDF_Objects_and_Document_Structure"></a> |
70 PDF Objects and Document Structure | 71 PDF Objects and Document Structure |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 * [issue 244](http://skbug.com/244) | 589 * [issue 244](http://skbug.com/244) |
589 Mostly, only TTF fonts are directly supported. (User metrics | 590 Mostly, only TTF fonts are directly supported. (User metrics |
590 show that almost all fonts are truetype. | 591 show that almost all fonts are truetype. |
591 * [issue 260](http://skbug.com/260) | 592 * [issue 260](http://skbug.com/260) |
592 Page rotation is accomplished by specifying a different | 593 Page rotation is accomplished by specifying a different |
593 size page instead of including the appropriate rotation | 594 size page instead of including the appropriate rotation |
594 annotation. | 595 annotation. |
595 | 596 |
596 * * * | 597 * * * |
597 | 598 |
OLD | NEW |