Upgrade auf iTextPDF 6, Spotify Playlists, Bugfixes, Refactoring
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>se.michaelthelin.spotify</groupId>
|
||||
<artifactId>spotify-web-api-java</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>6.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -220,12 +220,19 @@ public class CardCreator {
|
||||
Table table = new Table(colWidths);
|
||||
table.useAllAvailableWidth();
|
||||
|
||||
Table table2 = new Table(colWidths);
|
||||
table2.useAllAvailableWidth();
|
||||
|
||||
for (Card card : line) {
|
||||
|
||||
Cell cell = new Cell();
|
||||
cell.setBorder(new SolidBorder(ColorConstants.GRAY, borderWidth, 0.5f));
|
||||
cell.setPadding(0);
|
||||
|
||||
Cell cell2 = new Cell();
|
||||
cell2.setBorder(new SolidBorder(ColorConstants.GRAY, borderWidth, 0.5f));
|
||||
cell2.setPadding(0);
|
||||
|
||||
if (card != null) {
|
||||
|
||||
Paragraph p = new Paragraph();
|
||||
@@ -238,6 +245,7 @@ public class CardCreator {
|
||||
logoBox.setMargin(3 * mmUnit);
|
||||
logoBox.setPaddingBottom(-12 * mmUnit);
|
||||
cell.add(logoBox);
|
||||
cell2.add(logoBox);
|
||||
}
|
||||
|
||||
Image qrcode = new Image(card.qrcode.createFormXObject(pdfDoc));
|
||||
@@ -245,6 +253,7 @@ public class CardCreator {
|
||||
p.setPaddingTop(22 * mmUnit - qrcode.getWidth().getValue() / 2); // mid point of QR code is 22 mm from top border
|
||||
p.add(qrcode);
|
||||
cell.add(p);
|
||||
cell2.add(p);
|
||||
|
||||
p = new Paragraph();
|
||||
p.setTextAlignment(TextAlignment.CENTER);
|
||||
@@ -258,6 +267,7 @@ public class CardCreator {
|
||||
p.setPaddingBottom(30 * mmUnit);
|
||||
}
|
||||
cell.add(p);
|
||||
cell2.add(p);
|
||||
|
||||
p = new Paragraph();
|
||||
p.setTextAlignment(TextAlignment.CENTER);
|
||||
@@ -265,6 +275,7 @@ public class CardCreator {
|
||||
p.setFontSize(8f);
|
||||
p.add(card.artist);
|
||||
cell.add(p);
|
||||
cell2.add(p);
|
||||
|
||||
p = new Paragraph();
|
||||
p.setTextAlignment(TextAlignment.CENTER);
|
||||
@@ -272,81 +283,23 @@ public class CardCreator {
|
||||
p.setFontSize(9f);
|
||||
p.setBold();
|
||||
p.add(card.title);
|
||||
p.setMaxHeight(22 * mmUnit);
|
||||
cell.add(p);
|
||||
cell2.add(p);
|
||||
}
|
||||
|
||||
cell.setWidth((cardWidth * mmUnit) - borderWidth);
|
||||
table.addCell(cell.setRotationAngle(Math.PI));
|
||||
table2.addCell(cell2);
|
||||
}
|
||||
|
||||
table.setMinHeight(105 * mmUnit);
|
||||
table.setMaxHeight(105 * mmUnit);
|
||||
doc.add(table);
|
||||
|
||||
table = new Table(colWidths);
|
||||
table.useAllAvailableWidth();
|
||||
|
||||
for (Card card : line) {
|
||||
|
||||
Cell cell = new Cell();
|
||||
cell.setBorder(new SolidBorder(ColorConstants.GRAY, 0.5f, 0.5f));
|
||||
cell.setPadding(0);
|
||||
|
||||
if (card != null) {
|
||||
|
||||
Paragraph p = new Paragraph();
|
||||
p.setTextAlignment(TextAlignment.CENTER);
|
||||
|
||||
if (card.link.startsWith("spotify:")) {
|
||||
Paragraph logoBox = new Paragraph();
|
||||
logoBox.setTextAlignment(TextAlignment.CENTER);
|
||||
logoBox.add(spotifyLogo);
|
||||
logoBox.setMargin(3 * mmUnit);
|
||||
logoBox.setPaddingBottom(-12 * mmUnit);
|
||||
cell.add(logoBox);
|
||||
}
|
||||
|
||||
Image qrcode = new Image(card.qrcode.createFormXObject(pdfDoc));
|
||||
qrcode.setWidth(22 * mmUnit); // Cannot set margin to 0 on QR codes and they grow with the length of the content. This is an approximation.
|
||||
p.setPaddingTop(22 * mmUnit - qrcode.getWidth().getValue() / 2); // mid point of QR code is 22 mm from top border
|
||||
p.add(qrcode);
|
||||
cell.add(p);
|
||||
|
||||
p = new Paragraph();
|
||||
p.setTextAlignment(TextAlignment.CENTER);
|
||||
p.setPaddingTop(5 / 25.4f * 72);
|
||||
if (card.cover != null) {
|
||||
Image cover = card.cover;
|
||||
cover.setWidth(30 / 25.4f * 72);
|
||||
p.add(cover);
|
||||
}
|
||||
else {
|
||||
p.setPaddingBottom(30 / 25.4f * 72);
|
||||
}
|
||||
cell.add(p);
|
||||
|
||||
p = new Paragraph();
|
||||
p.setTextAlignment(TextAlignment.CENTER);
|
||||
p.setPaddingTop(5 / 25.4f * 72);
|
||||
p.setFontSize(8f);
|
||||
p.add(card.artist);
|
||||
cell.add(p);
|
||||
|
||||
p = new Paragraph();
|
||||
p.setTextAlignment(TextAlignment.CENTER);
|
||||
p.setPaddingTop(3 / 25.4f * 72);
|
||||
p.setFontSize(9f);
|
||||
p.setBold();
|
||||
p.add(card.title);
|
||||
cell.add(p);
|
||||
}
|
||||
|
||||
table.addCell(cell);
|
||||
}
|
||||
|
||||
table.setMinHeight(105 * mmUnit);
|
||||
table.setMaxHeight(105 * mmUnit);
|
||||
doc.add(table);
|
||||
table2.setMinHeight(105 * mmUnit);
|
||||
table2.setMaxHeight(105 * mmUnit);
|
||||
doc.add(table2);
|
||||
}
|
||||
|
||||
doc.close();
|
||||
@@ -528,32 +481,16 @@ public class CardCreator {
|
||||
"NAS/share/Das große Abenteuer Musik",
|
||||
"spotify:album:7tfjSYq5aWFwKlYWRzmPMc", // Das kleine Gespenst
|
||||
"spotify:album:4kGTkO7CP063Bk0j14829K", // Der Räuber Hotzenplotz und die Mondrakete
|
||||
*//* "spotify:album:4tzPsEeFw4kR42NE4NqJvX", // Immer lustig in Bullerbü
|
||||
*/ "spotify:album:4tzPsEeFw4kR42NE4NqJvX", // Immer lustig in Bullerbü
|
||||
"spotify:album:1zuWVjkOPIK5OHFnlgDQcf", // Die Häschenschule
|
||||
"spotify:album:71a7CDdtrILqGPtF5YfNGr", // Conni auf dem Bauernhof
|
||||
// "spotify:album:2bOk55WwZUaXEz6PJpGiMa", // Conni tanzt
|
||||
// "spotify:album:0VfB018ZTsA9Ai8OWAyUzS", // Conni zieht um
|
||||
"spotify:album:2bOk55WwZUaXEz6PJpGiMa", // Conni tanzt
|
||||
"spotify:album:0VfB018ZTsA9Ai8OWAyUzS", // Conni zieht um
|
||||
"spotify:album:4I5pPWLv63Fz955uoO7qYA", // Conni hat Geburtstag
|
||||
// "spotify:album:48VfZGz16VLLpdayUedbOq", // Conni übernachtet bei Julia
|
||||
"spotify:album:48VfZGz16VLLpdayUedbOq", // Conni übernachtet bei Julia
|
||||
|
||||
//"spotify:playlist:6cdT1UHxAPOfQv4bVSnn00", // Peppa Wutz Playlist
|
||||
//"spotify:playlist:3aZMwVy8suXz2FI0nI1XBM", // Paw Patrol Playlist
|
||||
|
||||
|
||||
|
||||
//temp
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/4b/Radio_Teddy_Logo.svg/1200px-Radio_Teddy_Logo.svg.png|Radio Teddy|http://streamtdy.ir-media-tec.com/live/mp3-128/web/play.mp3",
|
||||
"NAS/share/Astrid Lindgren - Wir Kinder aus Büllerbü",
|
||||
"NAS/share/Benjamin Blümchen/Benjamin Blümchen - 122 - Benjamin Blümchen als Polizist",
|
||||
"NAS/share/Das Grüffelokind - Hörspiel zum Film",
|
||||
"NAS/share/Der Grüffelo und Das Grüffelokind",
|
||||
*/ "NAS/share/Der kleine Drache Kokosnuss kommt in die Schule",
|
||||
"NAS/share/Giraffenaffen/Giraffenaffen 5",
|
||||
"NAS/share/Kikaninchen - Dibedibedab!",
|
||||
/* "spotify:album:1FAupt6dQ7w849zXeJd5JB", // Reisemaus in Dänemark
|
||||
"NAS/share/Karlchen-Geschichten",
|
||||
"NAS/share/Sing mit mir Kinderlieder/Sing mit mir Kinderlieder",
|
||||
*/ "NAS/share/In der Weihnachtsbäckerei - Das Musical-Hörspiel"
|
||||
"spotify:playlist:6cdT1UHxAPOfQv4bVSnn00", // Peppa Wutz Playlist
|
||||
"spotify:playlist:3aZMwVy8suXz2FI0nI1XBM" // Paw Patrol Playlist
|
||||
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user