diff options
-rw-r--r-- | html/en/drv/pdf.html | 6 | ||||
-rw-r--r-- | html/en/history.html | 3 | ||||
-rw-r--r-- | src/drv/cdpdf.c | 74 |
3 files changed, 79 insertions, 4 deletions
diff --git a/html/en/drv/pdf.html b/html/en/drv/pdf.html index 22e0a44..fd5ae23 100644 --- a/html/en/drv/pdf.html +++ b/html/en/drv/pdf.html @@ -222,6 +222,12 @@ the vertex where there is a hole in a of the PDFLib.</li> </ul> +<ul> + <li><b><font face="Courier">"SUBJECT","TITLE","CREATOR","AUTHOR","KEYWORDS"</font></b>: write + only attributes that allows to set a description string for the respective + document information field.</li> +</ul> + </body> </html> diff --git a/html/en/history.html b/html/en/history.html index 9d82f3b..322bcdb 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -28,6 +28,9 @@ wdCanvasSetTransform</strong>, <strong>wdCanvasGetTransform</strong>, <strong>wdCanvasTranslate</strong> and <strong>wdCanvasScale</strong>, to better control the WD transformation.</li> + <li><span style="color: #0000FF">New:</span> + "SUBJECT","TITLE","CREATOR","AUTHOR","KEYWORDS" attributes for the PDF + driver.</li> <li><span class="style1">Changed</span><span class="hist_changed">:</span> Freetype updated to version 2.3.11.</li> <li><span class="style1">Changed</span><span class="hist_changed">:</span> diff --git a/src/drv/cdpdf.c b/src/drv/cdpdf.c index 79ce28f..ffad84b 100644 --- a/src/drv/cdpdf.c +++ b/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; @@ -1367,6 +1432,11 @@ 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); setpdfdefaultvalues(ctxcanvas); @@ -1485,7 +1555,3 @@ cdContext* cdContextPDF(void) { return &cdPDFContext; } - -/* -p.set_info("Creator", "PDFlib Cookbook") -*/ |