package org.hccp.pdf;
/**
*
* The first line of a PDF file is a header identifying the version of the PDF
* specification to which the file conforms. For a file conforming to PDF version 1.3,
* the header should be
*
* %PDF-1.3
*
* However, since any file conforming to an earlier version of PDF also conforms to
* version 1.3, an application that processes PDF 1.3 can also accept files with any of
* the following headers:
*
* %PDF-1.0
* %PDF-1.1
* %PDF-1.2
*
*
*
*- PDF Reference, Second Edition v1.3
**/
public class Header implements DocumentObject {
private String value;
private String version;
private static final String PREFIX = "%PDF-";
private static final String DEFAULT = "1.3";
/**
* @param version a string of the form "1.1" or "1.2"
**/
public Header(String version) {
value = PREFIX;
if(version != null) {
this.version = version;
} else {
version = DEFAULT;
}
}
/**
* default constructor, sets the version to "1.3"
**/
public Header() {
this(DEFAULT);
}
public String getValue() {
return value + version + "\n";
}
}