Code

completet some more metainfo (title, creator, producer, date) for pdf
authortheadib <theadib@users.sourceforge.net>
Sun, 21 May 2006 00:42:12 +0000 (00:42 +0000)
committertheadib <theadib@users.sourceforge.net>
Sun, 21 May 2006 00:42:12 +0000 (00:42 +0000)
src/extension/internal/pdf.cpp

index 0a4969a26fb6f67e133eb203a43dbb30fb5a938b..cd9ec7685a2c1be51e2e5df1df1d2801c42c9995 100644 (file)
@@ -303,13 +303,26 @@ PrintPDF::begin(Inkscape::Extension::Print *mod, SPDocument *doc)
 \r
     pdf_file = new PdfFile(_stream);\r
     doc_info = pdf_file->begin_document(1.4);\r
-//    *doc_info << "  /Title(" << "?" << ")\n";\r
+    *doc_info << "  /Title(" << doc->name << ")\n";\r
 //    *doc_info << "  /Author(" << "?" << ")\n";\r
 //    *doc_info << "  /Subject(" << "?" << ")\n";\r
 //    *doc_info << "  /Keywords(" << "?" << ")\n";\r
-//    *doc_info << "  /Creator(" << "?" << ")\n";\r
-    *doc_info << "  /Producer(" << PACKAGE_STRING << ")\n";\r
-//    *doc_info << "  /CreationDate(D:YYYYMMDDHHmmSSOHH'mm')\n";\r
+    *doc_info << "  /Creator(" << "www.inkscape.org" << ")\n";\r
+    *doc_info << "  /Producer(" << "Inkscape " << PACKAGE_STRING << ")\n";\r
+       //the date should be in ISO/IEC 8824\r
+       GDate date;\r
+       GTimeVal ltime;\r
+       glong time_hh, time_mm, time_ss;\r
+       g_date_set_time_t (&date, time (NULL));\r
+       gchar date_str[100], time_str[100];\r
+       g_date_strftime(date_str, 99, "%Y%m%d", &date);\r
+       g_get_current_time(&ltime);\r
+       time_hh=(ltime.tv_sec/3600)%24;\r
+       time_mm=(ltime.tv_sec/60)%60;\r
+       time_ss=(ltime.tv_sec)%60;\r
+       g_snprintf(time_str, 99, "%02ld%02ld%02ld", time_hh, time_mm, time_ss); \r
+       *doc_info << "  /CreationDate(D:" << date_str << time_str << "Z)\n";\r
+//     *doc_info << "  /CreationDate(D:" << date_str << time_str << "OHH'mm')\n";\r
 \r
     /* flush this to test output stream as early as possible */\r
     if (fflush(_stream)) {\r