konik-io/konik

[Feature request] Setting the author in the PDF file via properties file

oova opened this issue · 5 comments

oova commented

When I append a ZUGFeRD invoice to an existing PDF, the author in the PDF is set to my system user name. I can change the author name by calling

System.setProperty("io.konik.carriage.pdf.author", "My Author Name")

in my code. In addition to that, I would like to be able to set the author name in Konik's property file as follows:

io.konik.carriage.pdf.author=My Author Name

Yes this would be possible. But pull requests are also welcome :)

There is a Configuration.java class in konik the can be used equally for pdfbox carriage.

oova commented

OK, I would like to make a pull request (finally). Before I do that, though, I would like to make sure to not bother you with useless changes, so let me summarize what I think needs to be done after a first code inspection:

  1. Copy the Configuration class from the konik project to the pdfbox-carriage project.
  2. Change the "io.konik" string in the overwriteWithSystemProperties method to "io.konik.carriage.pdf".
  3. Change the getAuthor() method in the PDFBoxInvoiceAppender class to return Configuration.INSTANCE.getProperty("io.konik.carriage.pdf.author", defaultAuthor); where defaultAuthor is computed using the existing code, i.e., use the corresponding system property if not null, otherwise use the user name.

Is that it? Anything I got wrong or overlooked?

Exactly that is correct. You can make your contribution and we look together at it and correct it if needed.

oova commented

Now that the changes have been merged to the pdfbox-carriage project, would it be a good idea to update the docs in the website project as well? The new property could be included in the 3.Configuration.adoc document.

an update would be a good idea but IMHO not mandatory at the moment.