Code Monkey home page Code Monkey logo

ph-pdf-layout's Introduction

ph-pdf-layout

javadoc Maven Central

Java library for creating fluid page layouts with Apache PDFBox.

Please check the test files to see how to create PDFs with the different elements.

The basic elements provided are:

  • PageLayoutPDF - the entry class, having a list of page sets
  • PLPageSet - a set of pages that share the same size and orientation and contain a set of elements. The assignments to pages happens dynamically.
  • PL elements - basic or complex layout elements ("PL" is short for "PDF Layout")
    • Basic (inline) elements are
      • plain text in class PLText (Unicode of course)
        • For custom Open Source fonts to be used see the https://github.com/phax/ph-fonts project
        • Note: the available characters heavily depend on the used font. So if you get a "?" character, try loading a different font
      • and image in classes PLImage and PLStreamImage (whatever ImageIO can load).
    • Basic (block) element is box (class PLBox)
    • Layout elements are
      • horizontal box or h-box in class PLHBox - like a row of a table
      • vertical box or v-box in class PLVBox - like a column of a table
      • spacer-x in class PLSpacerX - a horizontal spacer - just in case you need explicit distance to a certain element
      • spacer-y in class PLSpacerY - a vertical spacer - just in case you need explicit distance to a certain element
      • page break in class PLPageBreak - an explicit page break that starts a new page
    • The most complex element is a table, which consists of a number of "h-boxes" (rows) which itself consist of a number of "v-boxes" (columns) plus comes with repeating headlines etc.
      • See classes PLTable, PLTableRow and PLTableCell for details
    • Elements can have the following properties - if you know CSS you should be familiar with it:
      • "min-size" - the minimum element size
      • "max-size" - the maximum element size
      • "margin" - a transparent outer border (outside of the border)
      • "border" - a visible border with different styles (between padding and margin)
      • "padding" - a transparent inner border (inside of the border)
      • "fill-color" - the background or fill color of an element

A set of example files as created from the unit test can be found in folder example-files. The source code for these examples is https://github.com/phax/ph-pdf-layout/tree/master/src/test/java/com/helger/pdflayout

Similar libraries in this context:

Maven usage

Add the following to your pom.xml to use this artifact, replacing x.y.z with the real version number:

<dependency>
  <groupId>com.helger</groupId>
  <artifactId>ph-pdf-layout4</artifactId>
  <version>x.y.z</version>
</dependency>

Between v4.0.0 and v5.2.2 the artifactId was called ph-pdf-layout4

News and Noteworthy

  • v7.3.3 - work in progress
    • Updated to PDFBox 3.0.2
  • v7.3.2 - 2024-03-27
    • Updated to ph-commons 11.1.5
    • Created Java 21 compatibility
    • Extracted a parent POM and prepared a submodule structure
    • Using https://github.com/red6/pdfcompare to test created PDFs against the stored ones. See issue #35 - thx @Lolf1010
  • v7.3.1 - 2024-01-24
    • Updated to PDFBox 3.0.1
    • Added support for clipping content of block elements via .setClipContent(boolean). See issue #34 - thx @terrason
  • v7.3.0 - 2023-10-30
    • Completely removed usage of java.awt.Color. Backwards incompatible change. This finalizes issue #32.
  • v7.2.0 - 2023-10-30
    • Added new class PLColor and deprecated all methods using java.awt.Color. Backwards incompatible change. See issue #32 - thx @AndroidDeveloperLB
  • v7.1.0 - 2023-08-20
    • Updated to PDFBox 3.0.0
  • v7.0.1 - 2023-07-31
    • Updated to PDFBox 2.0.29
    • Updated to ph-commons 11.1.0
    • Improved API to create an empty cell. See issue #29 - thx @fheldt
  • v7.0.0 - 2022-09-14
    • Using Java 11 as the baseline
    • Updated to ph-commons 11
  • v6.0.3 - 2022-08-17
    • Added support for PDF/A creation in PageLayoutPDF - thx @robertholfeld for publishing this in his branch
  • v6.0.2 - 2022-05-25
    • Extended PDPageContentStreamWithCache API. See issue #23 - thx @schneidh
  • v6.0.1 - 2022-05-07
    • Updated to jbig2-imageio 3.0.4
    • Updated to PDFBox 2.0.26
    • Added support for creating external links via new class PLExternalLink. See issue #14 - thx @rgarg-atheer and @martin19
  • v6.0.0 - 2022-01-05
    • Changed artifactId from ph-pdf-layout4 to ph-pdf-layout
    • Changed Java namespaces com.helger.pdflayout4.* to com.helger.pdflayout.*
  • v5.2.2 - 2021-12-29
    • Updated to PDFBox 2.0.25
    • Extended IPLHasMargin with (set|add)Margin(X|Y) to set or add to vertical or horizontal margin at once
    • Extended IPLHasPadding with (set|add)Padding(X|Y) to set or add to vertical or horizontal padding at once
  • v5.2.1 - 2021-03-22
    • Updated to PDFBox 2.0.23
  • v5.2.0 - 2021-03-21
    • Updated to ph-commons 10
    • Updated to PDFBox 2.0.22
    • Add syntactic sugar method PLTableCell.createEmptyCell()
  • v5.1.2 - 2020-06-15
    • Updated to PDFBox 2.0.20
    • Allow different page content height if the first page header and footer have different heights. See issue #14.
  • v5.1.1 - 2020-05-29
    • Updated to ph-fonts 4.1.0 (changed Maven groupId)
  • v5.1.0 - 2020-03-29
    • Updated to PDFBox 2.0.19
    • Updated to jbig2-imageio 3.0.3
    • Fixed line spacing on page break (see issue #10)
    • Allow table columns with different WidthSpec types, as long as colspan is 1.
    • Added another generic parameter to IPLSplittableObject
    • Made PageLayoutPDF API more chainable
    • New class PLBulletPointList can be used to create regular bullet point lists (see issue #9)
    • Updated to ph-commons 9.4.0
  • v5.0.9 - 2019-04-29
    • Updated to PDFBox 2.0.15 (security update)
  • v5.0.8 - 2018-11-22
    • Updated to PDFBox 2.0.12
    • Updated to ph-commons 9.2.0
  • v5.0.7 - 2018-07-10
    • Updated to PDFBox 2.0.11
  • v5.0.6 - 2018-06-21
    • Updated to org.apache.pdfbox:jbig2-imageio for JPEG handling
    • Fixed OSGI ServiceProvider configuration
    • Updated to ph-commons 9.1.2
  • v5.0.5 - 2018-04-16
    • Something went wrong when publishing to Maven Central - next try
  • v5.0.4 - 2018-04-16
    • Do not justify the last line of multiline text
  • v5.0.3 - 2018-04-16
    • Added ph-collection dependency for issue #4
    • Updated to PDFBox 2.0.9
    • Added possibility to justify text
  • v5.0.2 - 2018-02-21
    • Added possibility to use special page header and footer on the first page of a PLPageSet
  • v5.0.1 - 2018-02-12
    • Added image type support (issue #3)
    • Updated to BouncyCastle 1.59
    • Added new table grid types
  • v5.0.0 - 2017-11-09
    • Updated to PDFBox 2.0.8
    • Updated to ph-commons 9.0.0
    • Updated to BouncyCastle 1.58
  • v4.0.1 - 2017-05-16
    • Updated to PDFBox 2.0.6
    • Slight API extensions
  • v4.0.0 - 2017-02-22
    • No change compared to 4.0.0 Beta 5
  • v4.0.0 Beta 5 - 2017-01-19
    • Improved XML serialization slightly
    • Fixed an NPE with PLBox without a contained element
  • v4.0.0 Beta 4 - 2017-01-10
    • Block elements use full width now by default
    • Improved placeholder handling in text preparation
  • v4.0.0 Beta 3 - 2017-01-10
    • Binds to ph-commons 8.6.x
    • Fixed a height problem with vertical split HBoxes
    • Simplified class hierarchy for table rows
    • Made font fallback code point more flexible
    • Changed font rendering to use descent from font instead of heuristics
    • Fixed different border color rendering
    • Made debug rendering customizable
    • Added support for line spacing in PLText
  • v4.0.0 Beta 2 - 2017-01-03
    • The Maven artifact name was changed to 'ph-pdf-layout4' so that it can be used side-by-side with version 3.
    • The global package name was changed from com.helger.pdflayout to com.helger.pdflayout4 so that both 3.x and 4.x can run side-by-side
    • This is major rewrite to be closer to the CSS box model
    • VBox and HBox have no more layout information assigned to them
    • Added a new element "Box" that allows for easy alignment etc.
    • Separation between renderable objects, block element (box) and inline elements (text and image)
    • New class design for tables, so that each table cell is automatically represented by a box, each table row is a separate object
    • Added a simple grid system for tables to build the default grids easily
    • Added new "auto" width/height for columns/rows
    • Updated to PDFBox 2.0.4
  • v3.5.3 - 2017-11-07
    • Binds to ph-commons 9.0.0
    • Updated to PDFBox 2.0.8
    • Updated to BouncyCastle 1.58
  • v3.5.2 - 2017-01-10
    • Binds to ph-commons 8.6.x
    • Updated to PDFBox 2.0.4
  • v3.5.1 - 2016-10-07
    • Fixed a rendering flaw with borders
  • v3.5.0 - 2016-09-21
    • Changed internal class hierarchy to prepare for future changes
    • Changed package assignments for better grouping
  • v3.0.3 - 2016-09-19
    • Updated to PDFBox 2.0.3
    • Performance improvement by using optimized writer
    • Included optional MicroTypeConverters
  • v3.0.2 - 2016-09-06
    • API extensions for the classes in the "spec" package
  • v3.0.1 - never released because of issues with the release script :(
  • v3.0.0 - 2016-08-21
    • Requires JDK 8
    • Still on PDFBox 2.0.0 because of problems with 2.0.1 and 2.0.2

Version starting with 2.1.0 uses PDFBox 2.x, previous versions (up to and including 2.0.0) use PDFBox 1.8.x. Note: version 4.0.0 has troubles building with JDK 1.8.0_92 - updating to 1.8.0_112 or later should work.


My personal Coding Styleguide | It is appreciated if you star the GitHub project if you like it.

ph-pdf-layout's People

Contributors

dashaekchen avatar phax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ph-pdf-layout's Issues

How to embed the image/icon in the Table while creating PDF

Hi,

Can we embed the image/icon in the table that we create using PLTable?

image

I know PLImage API is there to create image in the PDF. My specific requirement is to embed the image as an icon in the table cell. Please let me know whether it is supported. If yes, what is the API for the same? A code snippet will be helpful. Thanks.

Regards,
Pankaj

UnsupportedOperationException in PLImage

@trautvetter - Copy from phax/ph-commons#9

Hi Philip, I'm getting an UnsupportedOperationException in PLImage using certain images.
The exception message is:

Caused by: java.lang.UnsupportedOperationException: BITMASK Transparency JPEG compression is not useful, use LosslessImageFactory instead

My BufferedImage is obtained by from a URL however I'm sorry but I can't give that to you so instead I have attached the image itself.

nrl-manly16

I've been able to implement my own AbstractPLImage which uses LosslessFactory.createFromImage() to return a PDImageXObject and use this class in place of your PLImage. However I was wondering if you were aware of this problem and decided to raise this issue.

Thank you.

Issue with Centering Text in Single Line

Hello,

I've been using your PH-PDF Layout library for a project and have run into an issue I was hoping you could provide some insight on.

Specifically, I've been having trouble with centering text within a single line. I've been using the .setHorzAlign(EHorzAlignment.CENTER) method on a PLText object, but it seems to only center the text if there's enough text to fill the line, like a long string or multiple strings separated by newline characters.

PLText textField = new PLText(
    "Some Text\n" +
    "-----------------------------------------------------------------------------------------------",
    new FontSpec (PreloadFont.REGULAR, 10)
).setHorzAlign(EHorzAlignment.CENTER);

In this case, the text is properly centered. But when I have a single line of text without the long string of dashes, the text is not centered.

Is there a workaround or method that I may have overlooked to get single line text to center properly within the bounding box?

Thank you in advance for your help and for the effort you've put into developing this library. It's been very useful for my project outside of this issue.

Best regards,
Max

PLTableCell.createEmptyCell() with column span?

PLTableCell.createEmptyCell() is quite handy but it is currently not possible to define a column span.

How about a variant like PLTableCell.createEmptyCell(int colspan)?

So instead of writing

plTable.addRow(PLTableCell.createEmptyCell(), PLTableCell.createEmptyCell(), PLTableCell.createEmptyCell(), ...)

just

plTable.addRow(PLTableCell.createEmptyCell(3), ...)

How to add Hyperlink ?

Hi,

Thanks for the library, works like charm.
is there a way i can add hyperlink ?

Thanks,
Raghvendra

Cut Text like "overflow:hidden" in css

Hello,
I need my table cell hide overflow text, like set "overflow:hidden" style in css
Is there any way to do this?

I am now figuring the max words in a cell by:

        // my cell's width is WidthSpec.perc(30)
        double area=0.3*pages.getAvailableWidth() * this.tableCellHeight-(2*Constants.POINTS_PER_MM*Constants.POINTS_PER_MM);
        double areaPerFont=(fontSize + LINE_SPACING*Constants.POINTS_PER_MM)*fontSize;
        this.tableCellWordsLimit=(int)(area / areaPerFont);

Unfortunately this is not work, the result tableCellWordsLimit is higher than seen.

Expose PDPageContentStreamExt in PDPageContentStreamWithCache?

Would it be possible to provide a getter for PDPageContentStreamExt within PDPageContentStreamWithCache? There are some methods on PDPageContentStreamExt that I need that are not available on PDPageContentStreamWithCache. (e.g. clip() and drawForm()) I'm currently using reflection to work around this, but would love to have a proper getter method.

padding in nested tables

Hi @phax,

I might have found a bug with nested tables.

The outer table has two columns and n rows. The table spans multiple pages (this might not be relevant though)
Each row is set up like this:

  • in the first column there is a cell with a few mm padding (new PLCell(new PLText).setPadding(x)
  • in the second column there is a nested table with n rows, two columns and no padding.

It seems the first cells paddings are not respected in the second columns cell height computation - the cells in each row do not align vertically, the first column is higher in total (I assume by 2*padding).
When I remove the first cell's padding the cells are aligned vertically.

I'll provide a test case if that is required.

image

Integrating PDFBox and XChart with ph-pdf-layout

Hi,

I am trying to integrate two tables created in ph-pdf-layout with PDFBox. I am not able to add it to PDFBox PDDocument(main document where we add all elements like content, tables, etc).

How can we integrate -

  1. PDFs created using PDFBox(with their elements like tables, images) with ph-pdf-layout
    and/or
  2. PDF created using ph-pdf-layout(with their elements like tables, images) with PDFBox

I have created a Donut chart using XChart library, which can be integrated with PDFBox, but finally, when I try to integrate with ph-pdf-layout, I have the same problem of not being able to integrate.

Hence, I need help in integrating the PDFBox and XChart with ph-pdf-layout or vice-versa. Thanks.

I have attached the source file for your reference. Thanks.

PhaxPDFBox.DOCX

Regards,
Pankaj

Empty space when adding headers with different height

When we add a header to the first page with 173.78516 height and add another header to other pages with 40.0 height, it reserves 173.78516 for all the headers and in the pages, we see empty space under the smaller header.

This is the message:
PageSet margin top was changed from 40.0 to 173.78516 so that firstPageHeader fits!

How do you right justify a short piece of text?

I can see from testTextHorzAlignment test in the PLTextTest class how you should right justify a piece of text, but this only seems to work if the text wraps over multiple lines. If I just have a short piece of text, i.e. "Hello world", then that text never seems to be pushed to the right hand page margin. In fact, setting the alignment to LEFT, CENTER or RIGHT makes no difference.

Is there a way to achieve this?

Cheers

Lance

Need to determine how many table rows can fit on the current page

I am trying to create the content for a book of puzzles which are like crosswords but are numeric and based on a hexagonal grid.

Each page will have:

  1. An image of the puzzle grid.
  2. A list of clues grouped by direction (In my case, the clues will have Across, Up, and Down groupings).

The layout of the clues depends on what I can fit on a single page. The pages are 6" by 9" so they are pretty tight.

Here is what I am thinking so far:

  1. Have all the clues listed in columns if they will all fit on the same page as the puzzle image.
  2. Have the clues "flow" from the first column, into the second, and then the third if they will fit on the page that way.
  3. Put all the clues on the opposite (facing) page if they don't fit on the page with the puzzle image and will fit on one page.
  4. If nothing else works, put as many clues as I can per page in three columns. Then, on subsequent pages, put whatever remaining clues I need to, but change the heading of the column to indicate it is a continuation like "Across (continued)".

The first step to coding this is to figure out the size of the table containing clues.

I created some test code which creates a table with one cell and then calls table.getPreparedHeight().
But, I get an error:
Cannot invoke "com.helger.pdflayout.spec.SizeSpec.getHeight()" because the return value of "com.helger.pdflayout.base.IPLRenderableObject.getPreparedSize()" is null

I get a similar error if I try to use table.getRenderedHeight().

I guess I need to call something to prepare the table. I see table.prepare(), but that requires a context and I don't see how to get that. I tried looking through the examples but I don't see anywhere which uses it.

It seems this should be simple, but I need someone to point me in the right direction.

Thanks in advance!

Vertically splittable table

Hello,

is it possible to create a vertically splittable table, so that in the meantime no row gets splitted? In instance, when a row has a column with multiple lines of text, it happens, that the row gets splitted on the two successive pages, which i want to avoid, that is, i'd like to keep the rows "atomic".

Thanks, Alex

How to keep a table together?

I have a PDF with multiple tables. For the page break one of these tables is torn apart. Is there a possibility to move the entire table to a new page instead of only some of its rows?

No assertions for pdfs created during tests?

Hey,
found your library a couple days ago and have been playing with it a bit. Works great.
At work we are currently looking into generating pdf-files that could include tables and came across your library.
Among the few libraries out there, yours seems to be more actively developed / maintained.

I noticed, if i understand the code correctly, that there are no "real" tests for pdf-files that are created during tests.
I only see that the pdf-files are saved but no assertions are performed on it.

If thats not the case then feel free to close this issue.
If it is the case, why and does that mean that you test the pdfs manually?

Thanks

How to correct display Chinese?

I get some "?" characters when I write a sentense in Chinese. I have tried almost all the fonts, but it didn't work. I hope to get your response as soon as possible,thank you.

Having issues importing and using

I wanted to see how to create hyperlinks, so there are these sample PDF files:

https://github.com/phax/ph-pdf-layout/tree/master/example-files/plexternallink

And also a sample code:

https://github.com/phax/ph-pdf-layout/blob/master/src/test/java/com/helger/pdflayout/element/link/PLExternalLinkTest.java

So I copied this a bit into a new Android app project, and I also tried to use this in the gradle file (kts formant):

implementation("com.helger:ph-pdf-layout4:5.2.2")}

It can't find the classes.

image

The docs say to use it this way.
Also it's mentioned here:
https://search.maven.org/artifact/com.helger/ph-pdf-layout4/5.2.2/jar?eh=

But it's weird because the latest version is also said to be 7.1.0...
Attached the problematic sample project. I can also use Java if you wish. Kotlin should be fine though, as it can handle Java easily.

I also tried to reach Jitpack as it might be able to fetch the library, but it failed:
https://jitpack.io/#phax/ph-pdf-layout

What is going on ? What should I use? Maybe the docs weren't updated?

My Application.zip

No splitting performed when nesting non-splittable within splittable PLVBox

Info: I'm using ph-pdf-layout 7.0.0.

When creating a splittable PLVBox and adding some large non-splittable PLVBoxes as rows, the calculations for vertical splitting seems to go wrong (or at least behaves in a way which I did not expect).
This culminates in a debug message Cannot split because no vertical splittable elements are contained and an error of the form The value of 'StartTop' must be >= 0! The current value is: <negative number>.

By debugging I can see that the PLVBox elements do have too many rows (in m_aRows) which do not fit on the page such that fCurY becomes negative.

I guess, the problem lies in AbstractPLVBox.splitElementVert(...) which uses containsAnyVertSplittableElement() to determine whether splitting can be performed. My expectation is that splitting should be done if each contained row fits in the available height, even if those rows' contents are not splittable.

I have found that there is also a simple workaround for this: just wrap the inner (non-splittable) PLVBox with another splittable one which only contains that inner box.

This is a simple reproduction of the error, the workaround is added as comment in the loop:

public static void main(String[] args) throws Exception {
  var font = new FontSpec(PreloadFont.REGULAR, 10);
  var pageSet = new PLPageSet(new SizeSpec(100, 700));

  var list = new PLVBox(); // splittable
  pageSet.addElement(list);

  for (var i = 0; i < 3; i++) {
    var subList = new PLVBox().setVertSplittable(false); // non-splittable
    subList.addRow(new PLText("test", font).setExactHeight(700));
    list.addRow(subList); // workaround: list.addRow(new PLVBox(subList));
  }

  var pdf = new PageLayoutPDF().addPageSet(pageSet);
  // The following throws an "Internal error" with reason
  // "The value of 'StartTop' must be >= 0! The current value is: -700.0"
  pdf.renderTo(new ByteArrayOutputStream());
}

Wrong linespacing in the end of page

Sometimes last line of page in multiline text can be rendered using wrong linespace.
Examlpe: https://ibb.co/FWNRYbD

This text was added to document using code

pagesSet.addElement(new PLText(loremRus, italicBoldFont12).setLineSpacing(1.5f));

Last line was rendened with wrong linespace for fitting it into page.
Another lines of text was rendered with correct linespace.

The result document looks strange in this case.

Including external fonts

I'm wondering how I can include external fonts. I know how it works with pdfbox directly, but I did not find any solution for ph-pdf-layout.
Normally, the preloaded fonts are good enough, but I need to write fractions like ¾, ½, ¼ etc. inside a text block. Not all of them exist in default fonts, so I need to add FreeSans.

font Weight

I m working with your dependencies, I have a table with titles etc ...
The issue is that I wanted to set the PreloadFont of the title REGULAR and the text is REGULAR.MEDIUM but after the investigation that I did I couldn't find REGULAR.MEDIUM there's only REGULAR and REGULAR_BOLD there's no medium or light.
So can we solve this problem.

How to make indent of multiline text

I need to make paragraphs and lists (bulleted and numbered).
How to make indentation of multiline text with prefix (bullet symbol or another text)?

Apply a Drop cap on PLText?

I want to add a drop cap feature on PLText,
My solution was to copy-and-paste PLText ( I renamed it as PLTextModification)
and I did modifications on methods: onPrepare() & onPerform().

It worked, but it was a horrible hack...

My question : Are there any ways to add drop cap feature on PLText ?

How to place different styled text in one string?

For example, I want to make some part of text bold styled:
This text contains bold part.

Calling pagesSet.addElement(new PLText(lorem, italicFont12)); will add string with specified font. New call of pagesSet.addElement wall add new string.

PLText don't support markups. Also there is not element what containing list of PLText.

Is it possible to solve this problem with current functional?

Still justify the last line of multiline text

I'm using ph-pdf-layout4 v5.0.9.

Next code still justify the last line of text:

String lorem = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, "
          + "sed diam nonumy eirmod tempor invidunt ut labore et dolore magna "
          + "aliquyam erat, sed diam voluptua. At vero eos et accusam et justo "
          + "duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata "
          + "sanctus est Lorem ipsum dolor sit amet.\n\n";

pagesSet.addElement(new PLText(lorem, regularFont12).setHorzAlign(EHorzAlignment.JUSTIFY));

Screen fragment: https://ibb.co/GtKNw4g

Is something wrong in my code? Or it's bug/feature?

Two tables on the same PDF

Hi,

I have created two tables using PLTable and have added them to PLPageSet aPS1 as below:
aPS1.addElement(aTable);
aPS1.addElement(aTable2);

Then, finally added them to PageLayoutPDF as below:

final PageLayoutPDF aPageLayout = new PageLayoutPDF().setCompressPDF(true);
aPageLayout.addPageSet(aPS1);

But, the two tables are created in two separate pages in PDF. I want to create both tables in the same page in PDF. Please suggest how can I achieve this.

I have attached the source file for your reference.

Thanks.

PhaxTwoTablesOnSamePage.DOCX

ClassNotFoundException: com.helger.collection.map.IntObjectMap

Since version 5, this error happens. I just included the newest version 5.0.1 in my pom.xml file.
With version 4.0.1, everything works as expected.

com.helger.pdflayout4.PDFCreationException: Internal error
at com.helger.pdflayout4.PageLayoutPDF.renderTo(PageLayoutPDF.java:321)
at com.helger.pdflayout4.PageLayoutPDF.renderTo(PageLayoutPDF.java:213)
at PHPDF2.test(PHPDF2.java:148)
at PHPDF2.main(PHPDF2.java:37)
Caused by: java.lang.NoClassDefFoundError: com/helger/collection/map/IntObjectMap
at com.helger.pdflayout4.spec.LoadedFont.(LoadedFont.java:122)
at com.helger.pdflayout4.render.PreparationContextGlobal.getLoadedFont(PreparationContextGlobal.java:75)
at com.helger.pdflayout4.element.text.AbstractPLText.onPrepare(AbstractPLText.java:382)
at com.helger.pdflayout4.base.AbstractPLRenderableObject.prepare(AbstractPLRenderableObject.java:238)
at com.helger.pdflayout4.element.vbox.AbstractPLVBox.onPrepare(AbstractPLVBox.java:518)
at com.helger.pdflayout4.base.AbstractPLRenderableObject.prepare(AbstractPLRenderableObject.java:238)
at com.helger.pdflayout4.element.vbox.AbstractPLVBox.onPrepare(AbstractPLVBox.java:645)
at com.helger.pdflayout4.base.AbstractPLRenderableObject.prepare(AbstractPLRenderableObject.java:238)
at com.helger.pdflayout4.element.hbox.AbstractPLHBox.onPrepare(AbstractPLHBox.java:295)
at com.helger.pdflayout4.base.AbstractPLRenderableObject.prepare(AbstractPLRenderableObject.java:238)
at com.helger.pdflayout4.element.vbox.AbstractPLVBox.onPrepare(AbstractPLVBox.java:474)
at com.helger.pdflayout4.base.AbstractPLRenderableObject.prepare(AbstractPLRenderableObject.java:238)
at com.helger.pdflayout4.element.hbox.AbstractPLHBox.onPrepare(AbstractPLHBox.java:437)
at com.helger.pdflayout4.base.AbstractPLRenderableObject.prepare(AbstractPLRenderableObject.java:238)
at com.helger.pdflayout4.element.hbox.AbstractPLHBox.onPrepare(AbstractPLHBox.java:295)
at com.helger.pdflayout4.base.AbstractPLRenderableObject.prepare(AbstractPLRenderableObject.java:238)
at com.helger.pdflayout4.element.vbox.AbstractPLVBox.onPrepare(AbstractPLVBox.java:474)
at com.helger.pdflayout4.base.AbstractPLRenderableObject.prepare(AbstractPLRenderableObject.java:238)
at com.helger.pdflayout4.base.PLPageSet.prepareAllPages(PLPageSet.java:426)
at com.helger.pdflayout4.PageLayoutPDF.renderTo(PageLayoutPDF.java:280)
... 3 more
Caused by: java.lang.ClassNotFoundException: com.helger.collection.map.IntObjectMap
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 23 more

Process finished with exit code 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.