konik-io / konik

A library to create, read and validate ZUGFeRD compliant invoices. Available for Java and .NET
https://konik.io
Other
46 stars 18 forks source link

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

Closed oova closed 8 years ago

oova commented 8 years ago

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
Vad1mo commented 8 years ago

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 8 years ago

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?

Vad1mo commented 8 years ago

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

oova commented 8 years ago

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.

Vad1mo commented 8 years ago

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