Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: site/user/sample/pdf.md

Issue 1936283003: documentation: SkDocument::MakePDF() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-05-02 (Monday) 17:27:37 EDT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « site/user/api/canvas.md ('k') | src/utils/SkLua.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: site/user/sample/pdf.md
diff --git a/site/user/sample/pdf.md b/site/user/sample/pdf.md
index 360fb4d02372b5a741107d12fe24adeb7e049a32..1668f3939a05358d724ad2983cdf586b1cde569d 100644
--- a/site/user/sample/pdf.md
+++ b/site/user/sample/pdf.md
@@ -9,19 +9,22 @@ via the SkDocument and SkCanvas APIs.
#include "SkDocument.h"
bool WritePDF(SkWStream* outputStream) {
- sk_sp<SkDocument> pdfDocument(SkDocument::CreatePDF(outputStream));
- typedef SkDocument::Attribute Attr;
- Attr info[] = {
- Attr(SkString("Title"), SkString("....")),
- Attr(SkString("Author"), SkString("....")),
- Attr(SkString("Subject"), SkString("....")),
- Attr(SkString("Keywords"), SkString("....")),
- Attr(SkString("Creator"), SkString("....")),
- };
- int infoCount = sizeof(info) / sizeof(info[0]);
- SkTime::DateTime now;
- SkTime::GetDateTime(&now);
- pdfDocument->setMetadata(info, infoCount, &now, &now);
+ SkDocument::PDFMetadata metadata;
+ metadata.fCreator = "creator....";
+ metadata.fTitle = "title...";
+ metadata.fAuthor = "author...";
+ metadata.fSubject = "subject...";
+ metadata.fKeywords = "keywords...";
+ metadata.fCreator = "creator...";
+ SkTime::DateTime now = get_current_date_and_time();
+ metadata.fCreation.fEnabled = true;
+ metadata.fCreation.fDateTime = now;
+ metadata.fModified.fEnabled = true;
+ metadata.fModified.fDateTime = now;
+ sk_sp<SkDocument> pdfDocument(SkDocument::MakePDF(
+ outputStream, SK_ScalarDefaultRasterDPI, metadata,
+ nullptr, true);
+ assert(pdfDocument);
int numberOfPages = ....;
for (int page = 0; page < numberOfPages; ++page) {
« no previous file with comments | « site/user/api/canvas.md ('k') | src/utils/SkLua.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698