summaryrefslogtreecommitdiff
path: root/cd/src/drv/cdpdf.c
diff options
context:
space:
mode:
Diffstat (limited to 'cd/src/drv/cdpdf.c')
-rwxr-xr-xcd/src/drv/cdpdf.c90
1 files changed, 85 insertions, 5 deletions
diff --git a/cd/src/drv/cdpdf.c b/cd/src/drv/cdpdf.c
index 79ce28f..a5d91d4 100755
--- a/cd/src/drv/cdpdf.c
+++ b/cd/src/drv/cdpdf.c
@@ -1278,6 +1278,71 @@ static cdAttribute pattern_attrib =
NULL
};
+static void set_subject_attrib(cdCtxCanvas *ctxcanvas, char* data)
+{
+ if (data)
+ PDF_set_info(ctxcanvas->pdf, "Subject", data);
+}
+
+static cdAttribute subject_attrib =
+{
+ "SUBJECT",
+ set_subject_attrib,
+ NULL
+};
+
+static void set_title_attrib(cdCtxCanvas *ctxcanvas, char* data)
+{
+ if (data)
+ PDF_set_info(ctxcanvas->pdf, "Title", data);
+}
+
+static cdAttribute title_attrib =
+{
+ "TITLE",
+ set_title_attrib,
+ NULL
+};
+
+static void set_creator_attrib(cdCtxCanvas *ctxcanvas, char* data)
+{
+ if (data)
+ PDF_set_info(ctxcanvas->pdf, "Creator", data);
+}
+
+static cdAttribute creator_attrib =
+{
+ "CREATOR",
+ set_creator_attrib,
+ NULL
+};
+
+static void set_author_attrib(cdCtxCanvas *ctxcanvas, char* data)
+{
+ if (data)
+ PDF_set_info(ctxcanvas->pdf, "Author", data);
+}
+
+static cdAttribute author_attrib =
+{
+ "AUTHOR",
+ set_author_attrib,
+ NULL
+};
+
+static void set_keywords_attrib(cdCtxCanvas *ctxcanvas, char* data)
+{
+ if (data)
+ PDF_set_info(ctxcanvas->pdf, "Keywords", data);
+}
+
+static cdAttribute keywords_attrib =
+{
+ "KEYWORDS",
+ set_keywords_attrib,
+ NULL
+};
+
static void set_opacity_attrib(cdCtxCanvas *ctxcanvas, char* data)
{
int state;
@@ -1331,6 +1396,19 @@ static cdAttribute pdf_attrib =
get_pdf_attrib
};
+static char* get_version_attrib(cdCtxCanvas* ctxcanvas)
+{
+ (void)ctxcanvas;
+ return (char*)PDF_get_parameter(ctxcanvas->pdf, "version", 0);
+}
+
+static cdAttribute version_attrib =
+{
+ "PDFLIBVERSION",
+ NULL,
+ get_version_attrib
+};
+
static void cdcreatecanvas(cdCanvas* canvas, void *data)
{
char *line = (char *)data;
@@ -1367,6 +1445,12 @@ static void cdcreatecanvas(cdCanvas* canvas, void *data)
cdRegisterAttribute(canvas, &opacity_attrib);
cdRegisterAttribute(canvas, &pattern_attrib);
cdRegisterAttribute(canvas, &pdf_attrib);
+ cdRegisterAttribute(canvas, &subject_attrib);
+ cdRegisterAttribute(canvas, &title_attrib);
+ cdRegisterAttribute(canvas, &creator_attrib);
+ cdRegisterAttribute(canvas, &author_attrib);
+ cdRegisterAttribute(canvas, &keywords_attrib);
+ cdRegisterAttribute(canvas, &version_attrib);
setpdfdefaultvalues(ctxcanvas);
@@ -1473,7 +1557,7 @@ static cdContext cdPDFContext =
CD_CAP_ALL & ~(CD_CAP_CLEAR | CD_CAP_PLAY | CD_CAP_PALETTE |
CD_CAP_REGION | CD_CAP_IMAGESRV | CD_CAP_TEXTSIZE |
CD_CAP_BACKGROUND | CD_CAP_BACKOPACITY | CD_CAP_WRITEMODE |
- CD_CAP_IMAGERGBA | CD_CAP_GETIMAGERGB),
+ CD_CAP_GETIMAGERGB),
0,
cdcreatecanvas,
cdinittable,
@@ -1485,7 +1569,3 @@ cdContext* cdContextPDF(void)
{
return &cdPDFContext;
}
-
-/*
-p.set_info("Creator", "PDFlib Cookbook")
-*/