Update itext
This commit is contained in:
parent
959888534b
commit
980c48f84b
2 changed files with 8 additions and 20 deletions
|
@ -33,7 +33,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.itextpdf</groupId>
|
<groupId>com.itextpdf</groupId>
|
||||||
<artifactId>itextpdf</artifactId>
|
<artifactId>itextpdf</artifactId>
|
||||||
<version>5.0.6</version>
|
<version>5.5.12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
|
package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
|
||||||
|
|
||||||
import java.awt.BasicStroke;
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Stroke;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -30,15 +27,6 @@ import com.itextpdf.text.pdf.PdfPTable;
|
||||||
import com.itextpdf.text.pdf.PdfWriter;
|
import com.itextpdf.text.pdf.PdfWriter;
|
||||||
|
|
||||||
public class PDFDocument {
|
public class PDFDocument {
|
||||||
|
|
||||||
|
|
||||||
static Stroke stroke = new BasicStroke(5.f, BasicStroke.CAP_ROUND,
|
|
||||||
BasicStroke.JOIN_ROUND);
|
|
||||||
|
|
||||||
final static Color bg = Color.green;
|
|
||||||
|
|
||||||
final static Color fg = Color.black;
|
|
||||||
|
|
||||||
public PDFDocument(String authorName,
|
public PDFDocument(String authorName,
|
||||||
Map<String, Integer> yearToPublicationCount,
|
Map<String, Integer> yearToPublicationCount,
|
||||||
Document document,
|
Document document,
|
||||||
|
@ -57,7 +45,7 @@ public class PDFDocument {
|
||||||
Paragraph header = new Paragraph();
|
Paragraph header = new Paragraph();
|
||||||
|
|
||||||
Font pageHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLDITALIC | Font.UNDERLINE);
|
Font pageHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLDITALIC | Font.UNDERLINE);
|
||||||
Font featureHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, new BaseColor(Color.red));
|
Font featureHeaderStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, BaseColor.RED);
|
||||||
|
|
||||||
header.add(new Chunk("PDF Pipeline Prototype v2 using iText\n",
|
header.add(new Chunk("PDF Pipeline Prototype v2 using iText\n",
|
||||||
pageHeaderStyle));
|
pageHeaderStyle));
|
||||||
|
@ -158,8 +146,8 @@ public class PDFDocument {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void pictureBackdrop(float x, float y, PdfContentByte cb) throws Exception {
|
public void pictureBackdrop(float x, float y, PdfContentByte cb) throws Exception {
|
||||||
cb.setColorStroke(new BaseColor(Color.black));
|
cb.setColorStroke(BaseColor.BLACK);
|
||||||
cb.setColorFill(new BaseColor(Color.gray));
|
cb.setColorFill(BaseColor.GRAY);
|
||||||
cb.rectangle(x, y, 100, 200);
|
cb.rectangle(x, y, 100, 200);
|
||||||
cb.fill();
|
cb.fill();
|
||||||
cb.setLineWidth(2);
|
cb.setLineWidth(2);
|
||||||
|
@ -180,15 +168,15 @@ public class PDFDocument {
|
||||||
PdfGState gs1 = new PdfGState();
|
PdfGState gs1 = new PdfGState();
|
||||||
gs1.setFillOpacity(1.0f);
|
gs1.setFillOpacity(1.0f);
|
||||||
cb.setGState(gs1);
|
cb.setGState(gs1);
|
||||||
cb.setColorFill(new BaseColor(Color.red));
|
cb.setColorFill(BaseColor.RED);
|
||||||
cb.circle(x + 70, y + 70, 50);
|
cb.circle(x + 70, y + 70, 50);
|
||||||
cb.fill();
|
cb.fill();
|
||||||
cb.restoreState();
|
cb.restoreState();
|
||||||
|
|
||||||
cb.setColorFill(new BaseColor(Color.yellow));
|
cb.setColorFill(BaseColor.YELLOW);
|
||||||
cb.circle(x + 100, y + 130, 50);
|
cb.circle(x + 100, y + 130, 50);
|
||||||
cb.fill();
|
cb.fill();
|
||||||
cb.setColorFill(new BaseColor(Color.blue));
|
cb.setColorFill(BaseColor.BLUE);
|
||||||
cb.circle(x + 130, y + 70, 50);
|
cb.circle(x + 130, y + 70, 50);
|
||||||
cb.fill();
|
cb.fill();
|
||||||
}
|
}
|
||||||
|
@ -199,7 +187,7 @@ public class PDFDocument {
|
||||||
Font summaryContentStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, Font.BOLDITALIC);
|
Font summaryContentStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, Font.BOLDITALIC);
|
||||||
BaseColor summaryBackgroundColor = new BaseColor(0xEE, 0xEE, 0xEE);
|
BaseColor summaryBackgroundColor = new BaseColor(0xEE, 0xEE, 0xEE);
|
||||||
BaseColor headerBackgroundColor = new BaseColor(0xC3, 0xD9, 0xFF);
|
BaseColor headerBackgroundColor = new BaseColor(0xC3, 0xD9, 0xFF);
|
||||||
BaseColor bodyBackgroundColor = new BaseColor(Color.white);
|
BaseColor bodyBackgroundColor = BaseColor.WHITE;
|
||||||
|
|
||||||
PdfPTable table = new PdfPTable(2);
|
PdfPTable table = new PdfPTable(2);
|
||||||
table.setWidthPercentage(36.0f);
|
table.setWidthPercentage(36.0f);
|
||||||
|
|
Loading…
Add table
Reference in a new issue