Converting html to pdf

What are others planning to do when converting html to pdf with Xojo 2020r1/r2 for Apple Silicon?

  • MBS plugin should work for BS but only does a StackOverflow for me.
  • Valentina reports only does single page html
  • WKHtmlToPDF doesn’t support AS. Not sure if this is in the pipeline.
  • weasyprint is free. But I hate Python. Would need to make an AS app or do a Docker container.
  • NCReports doesn’t do AS.

Are there other options?

i used wkhtmltopdf for over 10 years or maybe more.

i just tested my application on big sur 11.0.1 on my macbook pro with M1 chip and generate my application as a universal build.

when the wkhtmltopdf is open and generate the pdf, i can see on the activity monitor showing the wkhtmltopdf as unknown instead of intel or apple on the architecture column.

and the pdf did get generate without any problem

i am using the latest wkhtmltopdf which dated june 2020.

1 Like

Like any other tool WKHtmlToPDF needs to be updated to AS. I’m not sure if there is much work done for WKHtmlToPDF anymore. See the bottom of https://wkhtmltopdf.org/status.html .

@Beatrix_Willius, what i am trying to say is the latest version work on the M1 machine, i assume under rosetta 2

I’m also using wkhtmltopdf, tested on the M1 and it works fine. Longer term, we may need to find a newer solution that is capable of running as an arm binary, but for now it’s working under Rosetta2. Likely we’ll have at least a few years of Rosetta2 being available before it’ll stop working. Hopefully another solution becomes available by then.

is there anything better than wkhtmltopdf that is cross platform and also free and using command line and does need to install separately and need to do html to pdf but supporting all the new css like css grid and flexbox etc???

See the list at the top.

I found something in Javascript called jsPDF. But there support for unicode is unclear. The best looking tool I found is called dompdf in php.

The rest of the PDF tools are > 1000 bucks. There are even some jokesters which want to be paid by document. My software does thousands of PDFs per day.

First you can use WKWebViewMBS class and ask it for PDF.

And I’ll talk with Jens what we can do for DynaPDF as this is frequently asked.

1 Like

Christian, if you’re able to sell something that has similar functionality to wkhtmltopdf but more actively supported for the Xojo developers like us who depend on it, that would go down very well indeed.

4 Likes

i assume this is for Mac only

Tom, agree with you fully. that would be brilliant. currently i create the html and passed it over to wkhtmltopdf to generate the pdf.

I think that the little demo of wkhtmltopdf that Hamish and I did several years ago means that several UK Xojo developers use that :slight_smile:

The WKWebViewMBS class can get you the PDF on macOS or iOS:

method PDFData(byref error as NSErrorMBS) as MemoryBlock

This doesn’t work:

  • It’s only for BS.
  • I seem to remember that there is no possibility to set the page size.
  • The example you made me only does a StackOverflow and no file.

Indeed! That was a great demo, I have used wk and showed it to many Xojo users all over the UK ever since. Great idea Tom.

2 Likes

For me it works in Mojave, too.
Can you provide stack trace and maybe your test project for the exception?

@Christian Schmitz: there is no stack trace and no exception. We talked about that end of September.

Yes. I’ve made an example project for next version.
Works fine here on several computers with macOS Mojave and
So we may have fixed the issue with newer plugins.

Great. Looking forward to the new version.

Resurrecting this thread.

How is everyone who was using wkhtmltopdf as a cross-platform method of creating a PDF from HTML in Xojo getting on? Has anyone found a cross-platform solution that supports the same versions of macOS and Windows that the current version of Xojo supports?