Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example: C interop for HTML to PDF conversion using libwkhtmltox #7751

Merged
merged 4 commits into from
Jan 3, 2021

Conversation

leandrosilva
Copy link
Contributor

I wrote yet another example of C interop (I know there is that interesting one with SQLite) for the handy task of convert HTML to PDF using libwkhtmltox .

In the process, it shows how to deal with pointers and write bytes to a file, in order to save the PDF, step by step.

Thanks.

@clubby789
Copy link
Contributor

Looks like the dependencies will need to be updated for the CI actions.

@leandrosilva
Copy link
Contributor Author

Is it possible for me to do that or will it require maintainer of the repo do that?
I apologize.
First time I'm caught on this situation.

@JalonSolov
Copy link
Contributor

Probably better to do a separate PR to fix the dependencies, and have this PR wait for that one. Only a couple of people can merge commits.

@spytheman
Copy link
Member

This is a good C interoperation example, that does an useful task.
I could compile it on Ubuntu 20.04, by downloading a .deb file from , then doing:

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
sudo apt-get install xfonts-75dpi
sudo dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb

These instructions can be added to .github/workflows/ci.yml, in one of the ubuntu- jobs, so we can be sure that it is tested and does not regress.
However I am not sure, that the installation will be as straightforward on other platforms like macos and windows, and the .deb package is ~15MB.

@medvednikov what is your opinion, should we add examples like these, and should they be in the main examples/ folder?

@spytheman spytheman closed this Jan 2, 2021
@spytheman spytheman reopened this Jan 2, 2021
@medvednikov
Copy link
Member

The dependencies are on the heavy side, but it's a useful example, and the deps are only installed on one CI instance.

@medvednikov medvednikov merged commit 86df5cd into vlang:master Jan 3, 2021
@leandrosilva leandrosilva deleted the example_htmltopdf_converter branch January 3, 2021 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants