bitcrowd / chromic_pdf

Convenient HTML to PDF/A rendering library for Elixir based on Chrome & Ghostscript
Apache License 2.0
408 stars 37 forks source link

Add info option to print_to_pdf/2 #200

Open maltoe opened 1 year ago

maltoe commented 1 year ago

Now that we're calling Ghostscript from print_to_pdf/2 (optionally, for multiple sources), we may as well benefit from it.

maltoe commented 1 year ago
  1. Split the postscript snippet (PDFA_def_ext.ps.eex or so)
  2. Optionally render the postscript info snippet in the GhostscriptWorker.join/2 function
  3. Render both snippets in GhostscriptWorker.convert/2
ammancilla commented 1 year ago

With the limited knowledge I have about the code base, I tried to come up with a (high level) plan about how to "smoothly" introduce a unified/smart print_to_pdf/3 that allows to print both pdf or pdfa files.

Implementation Details

Version ChromicPDF::API

Add V2

The goal of the second version is to have a unified/smart print_to_pdf/3, capable to print both pdf and pdfa files based on the given function parameters. This version is also smart enough to know when to use Ghoshscript.