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) { |