Java/PDF RTF/PDF Version
Версия от 18:01, 31 мая 2010; (обсуждение)
Setting Pdf version: 1.2
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class PdfVersion1_2 {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PDFversion1_2.pdf"));
writer.setPdfVersion(PdfWriter.VERSION_1_2);
document.open();
document.add(new Paragraph("This is a PDF-1.2 document"));
} catch (Exception ioe) {
System.err.println(ioe.getMessage());
}
document.close();
}
}
Setting Pdf version: 1.3, 1.4, 1.5 and 1.6
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class PdfVersion1_3 {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PDFversion1_3.pdf"));
writer.setPdfVersion(PdfWriter.VERSION_1_3);
//writer.setPdfVersion(PdfWriter.VERSION_1_4);
//writer.setPdfVersion(PdfWriter.VERSION_1_5);
//writer.setPdfVersion(PdfWriter.VERSION_1_6);
document.open();
document.add(new Paragraph("This is a PDF-1.3 document"));
} catch (Exception ioe) {
System.err.println(ioe.getMessage());
}
document.close();
}
}