Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/astares/pharo-wkhtml2pdf
Convert HTML into PDF documents using wkhtmltopdf.org
https://github.com/astares/pharo-wkhtml2pdf
Last synced: 22 days ago
JSON representation
Convert HTML into PDF documents using wkhtmltopdf.org
- Host: GitHub
- URL: https://github.com/astares/pharo-wkhtml2pdf
- Owner: astares
- License: mit
- Created: 2021-09-23T22:24:59.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-24T22:32:29.000Z (over 3 years ago)
- Last Synced: 2024-10-31T06:41:50.541Z (2 months ago)
- Language: Smalltalk
- Size: 67.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WKHTML2PDF for Pharo
## Project info
The **WKHTML2PDF for Pharo** is a project to provide the possibility to use the [WKHTML2PDF project](http://wkhtmltopdf.org/) from [Pharo](http://www.pharo.org). It allows you to convert HTML into PDF documents.
With this tool you can provide easy portable printing for your Pharo based applications.
### Project location
The project is located on GitHub at [https://github.com/astares/Pharo-WKHTML2PDF/](https://github.com/astares/Pharo-WKHTML2PDF)### License
WKHTML2PDF is licensed under MIT License.## Installation
### Install WKHTML2PDF
Please check out [http://wkhtmltopdf.org](http://wkhtmltopdf.org)/ to install the necessary software on your machine. Note that the library/executable should be accessible to Pharo. Often it is enough by providing the binary files next to the Pharo VM executable.### Install Pharo
Install [Pharo](http://www.pharo.org) on your machine. Pharo 9 onwards is recommended. Either using [PharoLauncher](https://github.com/pharo-project/pharo-launcher) or [Pharo ZeroConf](http://get.pharo.org/):#### Load Pharo using ZeroConf
```
wget -O- get.pharo.org/64/90+vm | bash
./pharo-ui Pharo.image
```#### Load all in one
To install the packages manually into your Pharo image just evaluate:
```Smalltalk
Metacello new
baseline:'WKHTML2PDF';
repository: 'github://astares/Pharo-WKHTML2PDF:main/src';
load
```## Use in your own application
### Selecting the engine
Initially you have to select the engine that you want to use. Either you want to use the WKHTML2PDF library or the executable.```Smalltalk
HTML2PDFConverter useExecutable
```or
```Smalltalk
HTML2PDFConverter useLibrary.
```The executable is the default.
### Converting
Now you can convert an HTML file or an URL into a PDF document:```Smalltalk
HTML2PDFConverter
convert: 'http://www.pharo.org'
toFile: 'pharo.pdf'
```will convert the Pharo homepage to a pdf document.
# Packages- *WKHTML2PDF-Core* - the core package required to use the project
- *WKHTML2PDF-Tests-Core* - includes SUnit tests for the core project# Testing
The package comes with tests in the package ***WKHTML2PDF-Tests-Core***. Just use the SUnit TestRunner to run them.