**pageguard** is free software.

This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.

---

## pageguard

pageguard is a simple program for saving HTML pages
as fully self-contained files with all resources embedded.

**Official repositories**:

- [https://codeberg.org/os-18/pageguard](https://codeberg.org/os-18/pageguard)
- [https://gitlab.com/os-18/pageguard](https://gitlab.com/os-18/pageguard)

---

## Ready-made packages


You can use our packages prepared for several popular Linux distributions
(Debian, Ubuntu, OpenSUSE, Fedora, Arch Linux).

See:  
[Download Page of OS-18](https://codeberg.org/os-18/os-18-docs/src/branch/master/OS-18_Packages.md)  

The page contains installation instructions for several packages, including `pageguard`.

---

## Notice about dub

Projects on D are usually distributed using [the dub registry](https://code.dlang.org/).
This project can also be downloaded from there:

```bash
dub fetch pageguard
dub build -v pageguard --force
```

The output will show the directory containing the compiled binary, like:  
`~/.dub/packages/pageguard/<version>/pageguard/build`.

You can use `paguaguard` with `dub`:

```bash
# show help
dub run pageguard -- --help
# download page from dlang.org
dub run pageguard -- https://dlang.org/articles/const-faq.html
```

But this is quite strange,
it is better to use the classic methods described below.


---

## Build from source

Before building, you need to install a compiler for D
(this project supports compilers
[dmd](https://dlang.org/download.html#dmd),
[gdc](https://gdcproject.org/) and
[ldc2](https://github.com/ldc-developers/ldc/)).

This project can be built with either dynamic or static linking
against [the Amalthea library](https://gitlab.com/os-18/amalthea).  
Therefore, if you want to build this project from source,
you must first build and install Amalthea,
then return to these instructions.

To create the executable file:

```bash
make
```

You can also specify a compiler:

```bash
make DC=gdc
```

To install (by default, main directory is `/usr/local/`):

```bash
make install
```

After installation, the program is ready to use.

The Makefile defines the following variables:

- `DESTDIR` — specifies the root directory for installing (empty by default);
- `PREFIX` — specifies the base directory, such as `usr/local` or `usr`.

The installation directory is defined as `$(DESTDIR)/$(PREFIX)` in the Makefile.

You can install the program files in any directory.
For example, to install into `$HOME/.local`:

```bash
make install DESTDIR=$HOME PREFIX=.local
```

To uninstall:

```bash
make uninstall
```

If installed to a non-default location,
use the same paths when uninstalling:

```bash
make uninstall DESTDIR=$HOME PREFIX=.local
```

---

## Usage

```
pageguard <URL> [-o <output_path>] [--js] [--utf8]
    Downloads a web page from the specified URL.
    If the output path is not provided, the page will be saved
    in the current directory and named after the page title taken
    from its contents, with the ".html" extension.

    The '--js' flag enables embedding JavaScript.
    Without this flag, all JavaScript will be removed.

    The '--utf8' flag enables re-encoding to UTF-8.
    Without this flag, the original encoding will be preserved.
```

---

## Feedback

Questions, suggestions, comments, bugs:

**tech.vindex@gmail.com**

Also use the repository service tools.

---
