boxable icon indicating copy to clipboard operation
boxable copied to clipboard

Replacement / Alternative to dhorions?

Open gmseed opened this issue 1 year ago • 5 comments

I see others have posted that this project is now effectively dead and won't integrate with PdfBox v3.x.

Does anyone know of a replacement that is both maintained and can be used with PdfBox?

Thanks Graham

gmseed avatar Dec 09 '24 20:12 gmseed

I am personally no longer able to spend the needed time on it. @gmseed would you like to take over the development?

dhorions avatar Dec 19 '24 13:12 dhorions

@dhorions @gmseed I would like to help.

new-piedpiper avatar Dec 24 '24 18:12 new-piedpiper

I was able to build this project with pdfbox 3.0.3. I hope you can publish one more build.

Here are the changes I made:

README.md

@@ -75,7 +75,7 @@ BaseTable table = new BaseTable(yStart, yStartNewPage, bottomMargin, tableWidth,
 //Create Header row
 Row<PDPage> headerRow = table.createRow(15f);
 Cell<PDPage> cell = headerRow.createCell(100, "Awesome Facts About Belgium");
-cell.setFont(PDType1Font.HELVETICA_BOLD);
+cell.setFont(new PDType1Font(Standard14Fonts.FontName.HELVETICA_BOLD));
 cell.setFillColor(Color.BLACK);
 table.addHeaderRow(headerRow);
 List<String[]> facts = getFacts();

pom.xml

@@ -29,7 +29,7 @@
         <dependency>
             <groupId>org.apache.pdfbox</groupId>
             <artifactId>pdfbox</artifactId>
-            <version>3.0.0</version>
+            <version>3.0.3</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
@@ -90,8 +90,8 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>3.1</version>
                 <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target>
+                    <source>21</source>
+                    <target>21</target>
                     <compilerArguments>
                         <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
                     </compilerArguments>

/src/test/java/be/quodlibet/boxable/DataTableTest.java

@@ -2,7 +2,7 @@ package be.quodlibet.boxable;

 import be.quodlibet.boxable.datatable.DataTable;
 import be.quodlibet.boxable.datatable.UpdateCellProperty;
-import com.google.common.io.Files;
+//import com.google.common.io.Files;
 import java.awt.Color;
 import java.io.File;
 import java.io.IOException;

/src/test/java/be/quodlibet/boxable/TableTest.java

@@ -114,7 +114,7 @@ public class TableTest {
                                        }
                                } else if(fact[i].equalsIgnoreCase("Google")) {
                                        cell = row.createCell((100 / 9f), fact[i]);
-                                       cell.setFont(PDType1Font.HELVETICA_OBLIQUE);
+                                       cell.setFont(new PDType1Font(Standard14Fonts.FontName.HELVETICA_OBLIQUE));
                                        cell.setFontSize(6);
                                        cell.setUrl(new URL("https://www.google.de"));
                                } else {
@@ -1209,11 +1209,11 @@ public class TableTest {

                // draw page title
                PageContentStreamOptimized cos = new PageContentStreamOptimized(new PDPageContentStream(doc, page));
-               PDStreamUtils.write(cos, "Welcome to your first borderless table", PDType1Font.HELVETICA_BOLD, 14, 15, yStart,
+               PDStreamUtils.write(cos, "Welcome to your first borderless table", new PDType1Font(Standard14Fonts.FontName.HELVETICA_BOLD), 14, 15, yStart,
                                Color.BLACK);
                cos.close();

-               yStart -= FontUtils.getHeight(PDType1Font.HELVETICA_BOLD, 14) + 15;
+               yStart -= FontUtils.getHeight(new PDType1Font(Standard14Fonts.FontName.HELVETICA_BOLD), 14) + 15;

                BaseTable table = new BaseTable(yStart, yStartNewPage, bottomMargin, tableWidth, margin, doc, page, drawLines,
                                drawContent);

mdemerat-umich avatar Apr 15 '25 21:04 mdemerat-umich

I would be willing to pick up the project, if you are still looking for someone @dhorions

niklaj avatar May 05 '25 08:05 niklaj

Hey I have started a Project for building tables in PDF documents. Please do have a look at it here : GitHub . Maven Repository link

new-piedpiper avatar Sep 12 '25 04:09 new-piedpiper