WebSite2PDF


NameWebSite2PDF JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/uNickz/WebSite2PDF
SummarySimple and Fast Python framework to convert HTML files or Web Site to PDF
upload_time2023-01-07 17:32:25
maintainer
docs_urlNone
authoruNickz
requires_python>=3.7
licenseLGPLv3
keywords python file html site website pdf converter convert
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align = "center">
    <a href = "https://github.com/uNickz/WebSite2PDF">
        <img src = "https://raw.githubusercontent.com/uNickz/WebSite2PDF/main/.github/graphics/GitHub-Banner-WebSite2PDF.png" width = "500px" alt = "WebSite2PDF Logo">
    </a>
    <br />
    <a href="https://github.com/uNickz/WebSite2PDF/tree/main/Example">Examples</a>
    •
    <a href="https://github.com/uNickz/WebSite2PDF/blob/main/README.md">Documentation</a>
    •
    <a href="https://pypi.org/project/WebSite2PDF/">PyPi</a>
    •
    <a href="https://t.me/uNickzProjects">News</a>
    •
    <a href="https://github.com/uNickz/WebSite2PDF/discussions">Chat</a>
</p>

# WebSite2PDF
> Simple and Fast Python framework to convert HTML files or Web Site to PDF

### Installing with pip

``` bash
pip3 install WebSite2PDF
```
or
``` bash
pip3 install git+https://github.com/uNickz/WebSite2PDF
```

### Installing with python

``` bash
python3 -m pip install WebSite2PDF
```
or
``` bash
python3 -m pip install git+https://github.com/uNickz/WebSite2PDF
```

### Dependencies

 - [Selenium Chrome WebDriver](https://chromedriver.chromium.org/downloads) (If [Chrome](https://www.google.com/chrome/) is installed on the machine you won't need to install the chrome driver)

## Example

### Using a url

``` python
import WebSite2PDF

url = "https://pypi.org"

c = WebSite2PDF.Client()
with open("file_name.pdf", "wb+") as file:
    file.write(c.pdf(url))
```
or
``` python
import WebSite2PDF

url = "https://pypi.org"

c = WebSite2PDF.Client()
c.pdf(url, filename = "file_name.pdf")
```

### Using a file HTML

``` python
import WebSite2PDF

file_path = "C:\Users\uNickz\index.html"

c = WebSite2PDF.Client()
with open("file_name.pdf", "wb+") as file:
    file.write(c.pdf(f"file:///{file_path}"))
```
or
``` python
import WebSite2PDF

file_path = "C:\Users\uNickz\index.html"

c = WebSite2PDF.Client()
c.pdf(f"file:///{file_path}", filename = "file_name.pdf")
```

### Using multiple urls or files HTML

``` python
import WebSite2PDF

urls_or_path = ["https://pypi.org", "file:///C:\Users\uNickz\index.html", "https://github.com/"]

c = WebSite2PDF.Client()
c.pdf(urls_or_path, filename = ["pypi.pdf", "index.pdf", "github.pdf"])
```
or
``` python
import WebSite2PDF

urls_or_path = ["https://pypi.org", "file:///C:\Users\uNickz\index.html", "https://github.com/"]
file_name = ["pypi.pdf", "index.pdf", "github.pdf"]

c = WebSite2PDF.Client()
data = c.pdf(urls_or_path)
for name, data in zip(name, data):
    with open(name, "wb+") as file:
        file.write(data)
```

### Using a delay (in seconds) before create PDF

``` python
import WebSite2PDF

url = "https://pypi.org"

c = WebSite2PDF.Client()
c.pdf(url, filename = "file_name.pdf", delay = 3)
```

### Using global [PDF Options](https://github.com/uNickz/WebSite2PDF/blob/main/PDF%20Page%20Options.md)

``` python
import WebSite2PDF

url = "https://pypi.org"

c = WebSite2PDF.Client(
    pdfOptions = {
        "landscape" = True,
        "displayHeaderFooter": True,
        "printBackground": True,
        "preferCSSPageSize": True,
    }
)
c.pdf(url, filename = "file_name.pdf")
```

### Using specific [PDF Options](https://github.com/uNickz/WebSite2PDF/blob/main/PDF%20Page%20Options.md) for a PDF

``` python
import WebSite2PDF

url = "https://pypi.org"

c = WebSite2PDF.Client(
    pdfOptions = {
        "landscape" = True,
        "displayHeaderFooter": True,
        "printBackground": True,
        "preferCSSPageSize": True,
    }
)
c.pdf(url, filename = "file_name.pdf", pdfOptions = {
    "landscape" = False,
    "displayHeaderFooter": True,
})
```

### Using global [Selenium ChromeDriver Options](https://github.com/uNickz/WebSite2PDF/blob/main/Selenium%20ChromeDriver%20Options.md)

``` python
import WebSite2PDF

url = "https://pypi.org"

c = WebSite2PDF.Client(
    pdfOptions = {
        "landscape" = True,
        "displayHeaderFooter": True,
        "printBackground": True,
        "preferCSSPageSize": True,
    }, seleniumOptions = [
        "--no-sandbox",
        "--headless",
    ]
)
c.pdf(url, filename = "file_name.pdf")
```

### Using specific [Selenium ChromeDriver Options](https://github.com/uNickz/WebSite2PDF/blob/main/Selenium%20ChromeDriver%20Options.md) for a PDF

``` python
import WebSite2PDF

url = "https://pypi.org"

c = WebSite2PDF.Client(
    pdfOptions = {
        "landscape" = True,
        "displayHeaderFooter": True,
        "printBackground": True,
        "preferCSSPageSize": True,
    }, seleniumOptions = [
        "--no-sandbox",
        "--headless",
    ]
)
c.pdf(url, filename = "file_name.pdf", pdfOptions = {
        "landscape" = False,
        "displayHeaderFooter": True,
    }, seleniumOptions = [
        "--no-sandbox",
        "--disable-gpu",
])
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/uNickz/WebSite2PDF",
    "name": "WebSite2PDF",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "python file html site website pdf converter convert",
    "author": "uNickz",
    "author_email": "unickz.dev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/61/4a/0a0f04bc26f3444a6757ad768c54f724c719b40a726486a12afe3312ae57/WebSite2PDF-0.1.1.tar.gz",
    "platform": null,
    "description": "<p align = \"center\">\r\n    <a href = \"https://github.com/uNickz/WebSite2PDF\">\r\n        <img src = \"https://raw.githubusercontent.com/uNickz/WebSite2PDF/main/.github/graphics/GitHub-Banner-WebSite2PDF.png\" width = \"500px\" alt = \"WebSite2PDF Logo\">\r\n    </a>\r\n    <br />\r\n    <a href=\"https://github.com/uNickz/WebSite2PDF/tree/main/Example\">Examples</a>\r\n    \u2022\r\n    <a href=\"https://github.com/uNickz/WebSite2PDF/blob/main/README.md\">Documentation</a>\r\n    \u2022\r\n    <a href=\"https://pypi.org/project/WebSite2PDF/\">PyPi</a>\r\n    \u2022\r\n    <a href=\"https://t.me/uNickzProjects\">News</a>\r\n    \u2022\r\n    <a href=\"https://github.com/uNickz/WebSite2PDF/discussions\">Chat</a>\r\n</p>\r\n\r\n# WebSite2PDF\r\n> Simple and Fast Python framework to convert HTML files or Web Site to PDF\r\n\r\n### Installing with pip\r\n\r\n``` bash\r\npip3 install WebSite2PDF\r\n```\r\nor\r\n``` bash\r\npip3 install git+https://github.com/uNickz/WebSite2PDF\r\n```\r\n\r\n### Installing with python\r\n\r\n``` bash\r\npython3 -m pip install WebSite2PDF\r\n```\r\nor\r\n``` bash\r\npython3 -m pip install git+https://github.com/uNickz/WebSite2PDF\r\n```\r\n\r\n### Dependencies\r\n\r\n - [Selenium Chrome WebDriver](https://chromedriver.chromium.org/downloads) (If [Chrome](https://www.google.com/chrome/) is installed on the machine you won't need to install the chrome driver)\r\n\r\n## Example\r\n\r\n### Using a url\r\n\r\n``` python\r\nimport WebSite2PDF\r\n\r\nurl = \"https://pypi.org\"\r\n\r\nc = WebSite2PDF.Client()\r\nwith open(\"file_name.pdf\", \"wb+\") as file:\r\n    file.write(c.pdf(url))\r\n```\r\nor\r\n``` python\r\nimport WebSite2PDF\r\n\r\nurl = \"https://pypi.org\"\r\n\r\nc = WebSite2PDF.Client()\r\nc.pdf(url, filename = \"file_name.pdf\")\r\n```\r\n\r\n### Using a file HTML\r\n\r\n``` python\r\nimport WebSite2PDF\r\n\r\nfile_path = \"C:\\Users\\uNickz\\index.html\"\r\n\r\nc = WebSite2PDF.Client()\r\nwith open(\"file_name.pdf\", \"wb+\") as file:\r\n    file.write(c.pdf(f\"file:///{file_path}\"))\r\n```\r\nor\r\n``` python\r\nimport WebSite2PDF\r\n\r\nfile_path = \"C:\\Users\\uNickz\\index.html\"\r\n\r\nc = WebSite2PDF.Client()\r\nc.pdf(f\"file:///{file_path}\", filename = \"file_name.pdf\")\r\n```\r\n\r\n### Using multiple urls or files HTML\r\n\r\n``` python\r\nimport WebSite2PDF\r\n\r\nurls_or_path = [\"https://pypi.org\", \"file:///C:\\Users\\uNickz\\index.html\", \"https://github.com/\"]\r\n\r\nc = WebSite2PDF.Client()\r\nc.pdf(urls_or_path, filename = [\"pypi.pdf\", \"index.pdf\", \"github.pdf\"])\r\n```\r\nor\r\n``` python\r\nimport WebSite2PDF\r\n\r\nurls_or_path = [\"https://pypi.org\", \"file:///C:\\Users\\uNickz\\index.html\", \"https://github.com/\"]\r\nfile_name = [\"pypi.pdf\", \"index.pdf\", \"github.pdf\"]\r\n\r\nc = WebSite2PDF.Client()\r\ndata = c.pdf(urls_or_path)\r\nfor name, data in zip(name, data):\r\n    with open(name, \"wb+\") as file:\r\n        file.write(data)\r\n```\r\n\r\n### Using a delay (in seconds) before create PDF\r\n\r\n``` python\r\nimport WebSite2PDF\r\n\r\nurl = \"https://pypi.org\"\r\n\r\nc = WebSite2PDF.Client()\r\nc.pdf(url, filename = \"file_name.pdf\", delay = 3)\r\n```\r\n\r\n### Using global [PDF Options](https://github.com/uNickz/WebSite2PDF/blob/main/PDF%20Page%20Options.md)\r\n\r\n``` python\r\nimport WebSite2PDF\r\n\r\nurl = \"https://pypi.org\"\r\n\r\nc = WebSite2PDF.Client(\r\n    pdfOptions = {\r\n        \"landscape\" = True,\r\n        \"displayHeaderFooter\": True,\r\n        \"printBackground\": True,\r\n        \"preferCSSPageSize\": True,\r\n    }\r\n)\r\nc.pdf(url, filename = \"file_name.pdf\")\r\n```\r\n\r\n### Using specific [PDF Options](https://github.com/uNickz/WebSite2PDF/blob/main/PDF%20Page%20Options.md) for a PDF\r\n\r\n``` python\r\nimport WebSite2PDF\r\n\r\nurl = \"https://pypi.org\"\r\n\r\nc = WebSite2PDF.Client(\r\n    pdfOptions = {\r\n        \"landscape\" = True,\r\n        \"displayHeaderFooter\": True,\r\n        \"printBackground\": True,\r\n        \"preferCSSPageSize\": True,\r\n    }\r\n)\r\nc.pdf(url, filename = \"file_name.pdf\", pdfOptions = {\r\n    \"landscape\" = False,\r\n    \"displayHeaderFooter\": True,\r\n})\r\n```\r\n\r\n### Using global [Selenium ChromeDriver Options](https://github.com/uNickz/WebSite2PDF/blob/main/Selenium%20ChromeDriver%20Options.md)\r\n\r\n``` python\r\nimport WebSite2PDF\r\n\r\nurl = \"https://pypi.org\"\r\n\r\nc = WebSite2PDF.Client(\r\n    pdfOptions = {\r\n        \"landscape\" = True,\r\n        \"displayHeaderFooter\": True,\r\n        \"printBackground\": True,\r\n        \"preferCSSPageSize\": True,\r\n    }, seleniumOptions = [\r\n        \"--no-sandbox\",\r\n        \"--headless\",\r\n    ]\r\n)\r\nc.pdf(url, filename = \"file_name.pdf\")\r\n```\r\n\r\n### Using specific [Selenium ChromeDriver Options](https://github.com/uNickz/WebSite2PDF/blob/main/Selenium%20ChromeDriver%20Options.md) for a PDF\r\n\r\n``` python\r\nimport WebSite2PDF\r\n\r\nurl = \"https://pypi.org\"\r\n\r\nc = WebSite2PDF.Client(\r\n    pdfOptions = {\r\n        \"landscape\" = True,\r\n        \"displayHeaderFooter\": True,\r\n        \"printBackground\": True,\r\n        \"preferCSSPageSize\": True,\r\n    }, seleniumOptions = [\r\n        \"--no-sandbox\",\r\n        \"--headless\",\r\n    ]\r\n)\r\nc.pdf(url, filename = \"file_name.pdf\", pdfOptions = {\r\n        \"landscape\" = False,\r\n        \"displayHeaderFooter\": True,\r\n    }, seleniumOptions = [\r\n        \"--no-sandbox\",\r\n        \"--disable-gpu\",\r\n])\r\n```\r\n",
    "bugtrack_url": null,
    "license": "LGPLv3",
    "summary": "Simple and Fast Python framework to convert HTML files or Web Site to PDF",
    "version": "0.1.1",
    "split_keywords": [
        "python",
        "file",
        "html",
        "site",
        "website",
        "pdf",
        "converter",
        "convert"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd0df3f53f8365d1e20d339f1bf1e1e19c5bca9d6e3b3d746c74b12564b06008",
                "md5": "b8ad4a9fce347986b3d424bf7516924e",
                "sha256": "f402790eaff074a105bdb336a61671564074adea3538c496439043238a6be864"
            },
            "downloads": -1,
            "filename": "WebSite2PDF-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b8ad4a9fce347986b3d424bf7516924e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 18615,
            "upload_time": "2023-01-07T17:32:23",
            "upload_time_iso_8601": "2023-01-07T17:32:23.671462Z",
            "url": "https://files.pythonhosted.org/packages/dd/0d/f3f53f8365d1e20d339f1bf1e1e19c5bca9d6e3b3d746c74b12564b06008/WebSite2PDF-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "614a0a0f04bc26f3444a6757ad768c54f724c719b40a726486a12afe3312ae57",
                "md5": "9a579c2f770bed82adb6395f45287387",
                "sha256": "43ab867dbc12b4bcff86be755e960e3217e44e1a6afe9d9539446489a498536a"
            },
            "downloads": -1,
            "filename": "WebSite2PDF-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "9a579c2f770bed82adb6395f45287387",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 18779,
            "upload_time": "2023-01-07T17:32:25",
            "upload_time_iso_8601": "2023-01-07T17:32:25.152604Z",
            "url": "https://files.pythonhosted.org/packages/61/4a/0a0f04bc26f3444a6757ad768c54f724c719b40a726486a12afe3312ae57/WebSite2PDF-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-07 17:32:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "uNickz",
    "github_project": "WebSite2PDF",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "website2pdf"
}
        
Elapsed time: 0.03329s