Difference between revisions of "PDF"

From Creative Commons
Jump to: navigation, search
(+ description of current state of PDF tagging)
m (Implementations)
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Current status'''
+
PDF (Portable Document Format) is a format for encapsulating all types of documents for transmission and usage electronically.
  
You can already [http://creativecommons.org/technology/xmp embed a Creative Commons license in a PDF document] using [http://partners.adobe.com/public/developer/xmp/topic.html Adobe's XMP] through, for example, Adobe Photoshop CS.
+
== Current status ==
  
However, there is still no free means of embedding license data in PDFs.
+
You can [http://creativecommons.org/technology/xmp embed a Creative Commons license in a PDF document] using [[XMP]] through, for example, Adobe Photoshop CS.
  
 
The most recent PDF standard (as of May 7, 2006), [http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf version 1.6], provides two mechanisms for the storing of metadata, such as license information, in the file. In section 10.2 of the standard, the two methods described are the document information dictionary and the metadata stream.
 
The most recent PDF standard (as of May 7, 2006), [http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf version 1.6], provides two mechanisms for the storing of metadata, such as license information, in the file. In section 10.2 of the standard, the two methods described are the document information dictionary and the metadata stream.
  
'''Document information dictionary'''
+
=== Document information dictionary ===
  
 
An example of the first, the document information dictionary, is given in section 10.2.1:
 
An example of the first, the document information dictionary, is given in section 10.2.1:
Line 26: Line 26:
 
This suggests that writing a tool that added a license key to the dictionary might be a reasonable way to proceed.
 
This suggests that writing a tool that added a license key to the dictionary might be a reasonable way to proceed.
  
'''Metadata stream'''
+
=== Metadata stream ===
  
This is the second method by which metadata can be embedded in a PDF. XMP is an example of the metadata stream, in which a chunk of XML is embedded in the PDF file for parsing by agents that don't necessarily understand how to read a PDF, but can read XML.  
+
This is the second method by which metadata can be embedded in a PDF. XMP is an example of the metadata stream, in which a chunk of XML is embedded in the PDF file for parsing by agents that don't necessarily understand how to read a PDF, but can read XML.
 +
 
 +
=== Implementations ===
 +
 
 +
* [http://media.polito.it/masala/plm2_index.html Cross-platform Java App by Enrico]
 +
* [[CCInfo for Acrobat]]
 +
* [http://www.cogniview.com/cc-pdf-converter.php PDF creator with embedded CC license for Windows (GPL)]
 +
* See [[XMP]] for others.
 +
 
 +
=== Examples ===
 +
 
 +
Here's an example of using [http://www.figuiere.net/hub/blog/?Exempi Exempi] to embed license info.  This code works for all file formats that Exempi supports, including PDFs.
 +
 
 +
<pre>
 +
#include <exempi/xmp.h>
 +
#include <exempi/xmpconsts.h>
 +
...
 +
xmp_init();
 +
 
 +
XmpFilePtr f;
 +
 
 +
f = xmp_files_open_new(filename, XMP_OPEN_FORUPDATE);
 +
XmpPtr xmp = xmp_files_get_new_xmp(f);
 +
 
 +
if ( xmp == NULL ) {
 +
xmp = xmp_new_empty();
 +
}
 +
 
 +
if ( xmp_files_can_put_xmp(f, xmp) ) {
 +
xmp_register_namespace(NS_CC, "cc", NULL);
 +
xmp_set_property(xmp, NS_CC, "license", "http://creativecommons.org/licenses/by-sa/2.5/");
 +
xmp_files_put_xmp(f, xmp);
 +
} else {
 +
printf("Unable to write XMP to this file.\n");
 +
}
 +
 
 +
xmp_files_close(f, XMP_CLOSE_SAFEUPDATE);
 +
xmp_free(xmp);
 +
 
 +
xmp_terminate();
 +
...
 +
</pre>
  
 
[[Category:Developer]]
 
[[Category:Developer]]
[[Category:Developer Challenges]]
 
 
[[Category:Technology]]
 
[[Category:Technology]]
[[Category:filetype]]
+
[[Category:Filetype]]

Latest revision as of 16:58, 23 October 2009

PDF (Portable Document Format) is a format for encapsulating all types of documents for transmission and usage electronically.

Current status

You can embed a Creative Commons license in a PDF document using XMP through, for example, Adobe Photoshop CS.

The most recent PDF standard (as of May 7, 2006), version 1.6, provides two mechanisms for the storing of metadata, such as license information, in the file. In section 10.2 of the standard, the two methods described are the document information dictionary and the metadata stream.

Document information dictionary

An example of the first, the document information dictionary, is given in section 10.2.1:

1 0 obj 
<< /Title (PostScript Language Reference, Third Edition) 
/Author (Adobe Systems Incorporated) 
/Creator (Adobe® FrameMaker® 5.5.3 for Power Macintosh®) 
/Producer (Acrobat® DistillerTM 3.01 for Power Macintosh) 
/CreationDate (D:19970915110347-08'00') 
/ModDate (D:19990209153925-08'00') 
>> 
endobj

Table 10.2 in section 10.2.1 lists 9 standard keys in the dictionary. "License" is not among them, but the specification makes reference to the creation of new keys in two sentences in section 10.2.1: "New keys should be chosen with care so that they make sense to users. The value associated with any key not specifically mentioned in Table 10.2 must be a text string."

This suggests that writing a tool that added a license key to the dictionary might be a reasonable way to proceed.

Metadata stream

This is the second method by which metadata can be embedded in a PDF. XMP is an example of the metadata stream, in which a chunk of XML is embedded in the PDF file for parsing by agents that don't necessarily understand how to read a PDF, but can read XML.

Implementations

Examples

Here's an example of using Exempi to embed license info. This code works for all file formats that Exempi supports, including PDFs.

#include <exempi/xmp.h>
#include <exempi/xmpconsts.h>
...
xmp_init();

XmpFilePtr f;

f = xmp_files_open_new(filename, XMP_OPEN_FORUPDATE);
XmpPtr xmp = xmp_files_get_new_xmp(f);

if ( xmp == NULL ) {
        xmp = xmp_new_empty();
}

if ( xmp_files_can_put_xmp(f, xmp) ) {
        xmp_register_namespace(NS_CC, "cc", NULL);
        xmp_set_property(xmp, NS_CC, "license", "http://creativecommons.org/licenses/by-sa/2.5/");
        xmp_files_put_xmp(f, xmp);
} else {
        printf("Unable to write XMP to this file.\n");
}

xmp_files_close(f, XMP_CLOSE_SAFEUPDATE);
xmp_free(xmp);

xmp_terminate();
...