# Chromium on FreeBSD / creating PDF from Django template



## Klewiu (Sep 4, 2022)

Hello guys,

I am using django-hardcopy to create PDF from django template.

Aplication was on heroku and i had to specifiy PATH_TO_CHROME. Everything was working on heroku with:
`PATH_TO_CHROME='/app/.apt/opt/google/chrome/chrome --headless --print-to-pdf --disable-gpu --no-sandbox'`

I had to transfer app on freeBSD on mydevi.net and the problem started.
From support i recieved info how to download chromium _(pkg install or other commands requiring root privileges are not allowed):_

`wget https://pkg.freebsd.org/FreeBSD:13:amd64/release_1/All/chromium-100.0.4896.60_1.pkg
tar -zxf chromium-100.0.4896.60_1.pkg
export LD_LIBRARY_PATH=~/usr/lib/
export LD_LIBRARY_PATH=~/usr/local/lib/
wget https://pkg.freebsd.org/FreeBSD:13:amd64/release_1/All/openh264-2.2.0,2.pkg
tar -zxf openh264-2.2.0,2.pkg
cd ~/usr/local/bin/
./chromedriver --help`

I did that above, and now i have in `~/usr/local/bin/`   two file chrome and chromedriver.
I am trying to pass in django settings 
	
	



```
CHROME_PATH='~/usr/local/bin/' or '~/usr/local/lib/chrome'
```

but it doesn't work...

The application behaves as if this chromium environment is not starting, as it could not find chrome.exe
On development on localserver i  points to the path to chorme in program files and everything works

I will add that I am a beginner when it comes to programming, so please be understanding...


----------



## Klewiu (Sep 5, 2022)

Ok i made a progress:


```
[Klewiu@s26]:<~/usr/local/bin>$ ./chromedriver
Starting ChromeDriver 100.0.4896.60 (6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896@{#875}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1662360055.820][SEVERE]: bind() failed: Operation not permitted (1)
[1662360055.820][SEVERE]: bind() failed: Operation not permitted (1)
Unable to start server with either IPv4 or IPv6. Exiting...
```

but still it doesn't work...


----------



## VladiBG (Sep 5, 2022)

I'm using htmldoc for converting static html to pdf you may want to check it.
www.msweet.org/htmldoc/htmldoc.html






						FreshPorts -- textproc/htmldoc: Converts HTML to PDF and/or PostScript
					

This is a port of HTMLDOC, which can:    Convert HTML files to PDF or PostScript       Generate a table-of-contents for books       Generate indexed HTML files       Generate files on-the-fly for web applications, from the 	command-line for batch jobs, or from a GUI for interactive work...




					www.freshports.org


----------

