bartneck / swiML

A project to formalise swimming programs using XML
MIT License
2 stars 2 forks source link

PDF Conversion #8

Open bartneck opened 1 year ago

bartneck commented 1 year ago

At this point there is no direct way to produce a PDF from the XML files using XSLT. The only option right now is to translate the XML to HTML and then use a web browser to create the PDF manually. Alternatively, the XSL-FO language or Oxygen’s PDF Chemistry can be used to directly generate a PDF file.

bartneck commented 5 months ago

Html => PDF using web browser print function Html => PDF using https://pandoc.org/ XML => PDF using XSLFO HTML => PDF using Javascript XML => PDF using https://www.oxygenxml.com/chemistry-html-to-pdf-converter.html adapting our CSS to work with the constraints it has HTML => PDF using https://wkhtmltopdf.org/ has some constraints on CSS vocabulary

bartneck commented 4 months ago
  1. It is possible to not use display: flex; it is cumbersome and might add complexities for line breaks, but it is possible.
  2. We do not have a license for Oxygen Chemistry. It is a separate product. And expensive at that. It does not support flex boxes. It uses Apache FOP XSL-FO
  3. In order for wkhtmltopdf to work, display: flex has to be replaced with display: -webkit-flex;
  4. I got 3. to work in a web browser, but could not make work for the translation to PDF
  5. Pandoc uses LaTeX or wkhtmltopdf to transfrom html to pdf. We run into the same problems.
  6. There are a number of commercial and free tools. I tried Weasyprint and got promising results.

I did some experimentation in the folder test/flexBoxTest

bartneck commented 4 months ago

I tried jsPDF and got it to work, except for the fonts. The files are in jsPDFTest