Ghostscript.NET icon indicating copy to clipboard operation
Ghostscript.NET copied to clipboard

Issues/122 facturx

Open jstaerk opened this issue 1 year ago • 2 comments

This adds the functionality to create Factur-X invoices, create their XML, and add the XML with ghostscript.net into a PDF file to become a valid PDF/A-3 Factur-X/ZUGFeRD file. Some .net files have been converted from mustangproject.org with a Java to c# converter.

This is basically mustang.net https://www.mustangproject.org/net/ Legally, in germany as of 01.01.2028 all domestic sales will have to be invoiced using UBL-XML, CII-XML, or Factur-X (https://www.recht.bund.de/bgbl/1/2024/108/regelungstext.pdf?__blob=publicationFile&v=2 pg 23 art 23 in conjunction with https://web.archive.org/web/20240407134819/https://www.dstv.de/wp-content/uploads/2023/10/BMF_2023-0922192-R.pdf, plain PDF without XML or paper will no longer be allowed).

jstaerk avatar Sep 09 '24 17:09 jstaerk

Hi @jstaerk , thanks for this pull request. This is a huge step forward to create electronic invoices. I'd like to propose to remove the FacturX functionality from Postscript.net and keep it separately and only to add the PDF/A-3 generation functionality to Ghostscript.net (if the folks at Artifex are willing to accept this of course).

Two feedbacks concerning the actual implementation:

  • There are a lot of German comments in the code which imho should be English
  • Instead of throwing a Exception("file not found"), you should rather throw a FileNotFoundException

stephanstapel avatar Sep 10 '24 18:09 stephanstapel

very cool, please proceed

jstaerk avatar Sep 16 '24 10:09 jstaerk

Thanks for this PR - great to see support for electronic invoices! Hopefully will get someone to review soon. :)

jamie-lemon avatar Sep 20 '24 14:09 jamie-lemon

any opinion from anybody on that topic? e.g. @jhabjan ?

jstaerk avatar Oct 03 '24 09:10 jstaerk

I'm happy to clean up the code asap, I just can't start refactoring because of #127 and have no idea how to find the solution. @jamie-lemon can you help?

stephanstapel avatar Oct 03 '24 09:10 stephanstapel

@stephanstapel I'm not actually a .NET guy, but will see if I can get someone on the Artifex team who knows .NET to look into this. I also just asked for a bit more description about the bug on #127 as it wasn't 100% clear to me.

jamie-lemon avatar Oct 03 '24 12:10 jamie-lemon

any opinion from anybody on that topic? e.g. @jhabjan ?

@jstaerk - Looks good. There are few minor bugs and fixes I mentioned here https://github.com/ArtifexSoftware/Ghostscript.NET/issues/127#issuecomment-2392059723

The only addition I would suggest is implementing a check to see if AdobeRGB1998.icc and pdfconvert.ps already exist, so they are not written to disk for every PDF conversion. This could help avoid issues in a multithreaded environment when running multiple instances in parallel. You might also want to append the Ghostscript.NET release version to the filenames, such as pdfconvert.gs.net.1.2.3.ps, to account for any changes in future releases.

I would agree with @stephanstapel, everything that's on German should be either removed or translated to English

jhabjan avatar Oct 04 '24 08:10 jhabjan

I ripped out LKVM dependency already, just have no idea where to push the changes :) Next step is to rip out the postscript template from the code and make this a resource. I also propose to remove the ZUGFeRD generation/ parsing as this will not have a chance zu survive there in the long run with invoicing code buried deep in a ps/pdf library.

Could we move the code into dedicated assembly, called e.g. Ghostscript.Net.PDFConverter? What do you think, @jhabjan ?

stephanstapel avatar Oct 04 '24 08:10 stephanstapel

@stephanstapel Please let us know when you consider this PR "Ready for review". Thanks!

jamie-lemon avatar Oct 04 '24 14:10 jamie-lemon

@stephanstapel If you put @green0317 and myself as reviewers that would be great.

jamie-lemon avatar Oct 04 '24 14:10 jamie-lemon

Hi @jamie-lemon , Hi @green0317,

I guess I am ready, see here: https://github.com/stephanstapel/Ghostscript.NET

Before sending the PR, I'd like to ask if the structure is how you liked it to be.

stephanstapel avatar Oct 04 '24 15:10 stephanstapel

@stephanstapel I guess we need another PR setup then , this one is about merging jstaerk:issues/122-facturx - I think we need another one which wants to merge in your https://github.com/stephanstapel/Ghostscript.NET

jamie-lemon avatar Oct 04 '24 16:10 jamie-lemon

@jamie-lemon , yes that is certainly right. I have quite restructued the code from @jstaerk . Before issuing the PR, I just wanted to ask for feedback if this looks alright for you. But I can also issue the PR, if you like

stephanstapel avatar Oct 04 '24 16:10 stephanstapel

@stephanstapel - Just a recommendation, rather then naming it Ghostscript.NET.PDFConverter, I would name it Ghostscript.NET.PDFA3Converter because it's specific to PDF/A-3 (as well as main class from PDFConverter to PDFA3Converter).

jhabjan avatar Oct 04 '24 16:10 jhabjan

@stephanstapel Please go ahead and issue the PR and then we can continue the discussion from there!

jamie-lemon avatar Oct 04 '24 16:10 jamie-lemon

See #128

jamie-lemon avatar Jan 29 '25 21:01 jamie-lemon