Index: site/user/sample/pdf.md |
diff --git a/site/user/sample/pdf.md b/site/user/sample/pdf.md |
new file mode 100644 |
index 0000000000000000000000000000000000000000..efadd5b42a7d219479c3249b0ee779af3e3d72fc |
--- /dev/null |
+++ b/site/user/sample/pdf.md |
@@ -0,0 +1,29 @@ |
+Using Skia's PDF Backend |
+======================== |
+ |
+Here is an example of using Skia's PDF backend in the recommended way: |
+via the SkDocument and SkCanvas APIs. |
+ |
+<!--?prettify?--> |
+ |
+ #include "SkDocument.h" |
+ |
+ bool WritePDF() { |
+ SkWStream* output = ....; |
+ |
+ SkAutoTUnref<SkDocument> pdfDocument( |
+ SkDocument::CreatePDF(outputStream)); |
+ |
+ int numberOfPages = ....; |
+ for (int page = 0; page < numberOfPages; ++page) { |
+ SkScalar pageWidth = ....; |
+ SkScalar pageHeight = ....; |
+ SkCanvas* pageCanvas = |
+ pdfDocument->beginPage(pageWidth, pageHeight); |
+ |
+ // ....insert canvas draw commands here.... |
+ |
+ pdfDocument->endPage(); |
+ } |
+ return pdfDocument->close(); |
+ } |