Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/34j/hexo-renderer-pdf
Hexo Renderer which treats PDF files as posts. Based on pdf2htmlEX.
https://github.com/34j/hexo-renderer-pdf
hexo hexo-plugin hexo-renderer latex pdf pdf2html pdf2htmlex tex typst
Last synced: 8 days ago
JSON representation
Hexo Renderer which treats PDF files as posts. Based on pdf2htmlEX.
- Host: GitHub
- URL: https://github.com/34j/hexo-renderer-pdf
- Owner: 34j
- License: mit
- Created: 2024-03-24T06:50:16.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-25T07:01:19.000Z (8 months ago)
- Last Synced: 2024-10-06T16:23:30.030Z (about 1 month ago)
- Topics: hexo, hexo-plugin, hexo-renderer, latex, pdf, pdf2html, pdf2htmlex, tex, typst
- Language: TypeScript
- Homepage:
- Size: 1.14 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hexo-renderer-pdf
[![npm package][npm-img]][npm-url]
[![Build Status][build-img]][build-url]
[![Downloads][downloads-img]][downloads-url]
[![Issues][issues-img]][issues-url]
[![Code Coverage][codecov-img]][codecov-url]
[![Commitizen Friendly][commitizen-img]][commitizen-url]
[![Semantic Release][semantic-release-img]][semantic-release-url]> Hexo renderer based on pdf2htmlEX.
## Installation
Note that WSL can be used (for Windows users).
```bash
wget -N https://github.com/pdf2htmlEX/pdf2htmlEX/releases/download/v0.18.8.rc1/pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb -O pdf2htmlEX.deb
sudo apt install ./pdf2htmlEX.deb
npm install hexo-renderer-pdf --save
```Just place pdf files in `source/_posts` (and run `hexo s`).
## Configuration (Optional)
```yaml
render_pdf:
args: ['--process-outline', '0', '--zoom', '1.25'] # pdf2htmlEX additional arguments
wrapWithIframe: true # Whether to wrap the pdf with an iframe
wrapHtml: |
body{margin:0;overflow:hidden;}
::-webkit-scrollbar{display:none;}
%s
```## Customizing CSS (Optional)
- Copy the assets to the root of your hexo project
```shell
cp -r $(wsl -e wslpath -m /usr/local/share/pdf2htmlEX) .
rm -r pdf2htmlEX/poppler
rm -r pdf2htmlEX/pkgconfig
git add pdf2htmlEX
git commit -m "chore: copy pdf2htmlEX assets"
```- Specify data-dir in the pdf2htmlEX options
```yaml
render_pdf:
args: ['--data-dir', 'pdf2htmlEX']
```- Edit `fancy.min.css` as you like
```css
#page-container {
background-color: transparent;
background-image: none;
}
#sidebar{
background-color: transparent;
}
.pf{
box-shadow: none;
}
img {
mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) {
img {
filter: invert(1);
mix-blend-mode: lighten;
}
}
```## Limitations
- Somehow, using a non-specific fonts for math expressions results in `Cannot flatten a non-CID font` warning and the characters garbled. Using Cambria Math was a workaround.
- `Warning: encoding confliction detected in font: 3` is still displayed but it seems to be harmless.
- You can open a PDF document in a text editor and write [Front-matter](https://hexo.io/docs/front-matter.html) in the same way as you would in markdown. It would be possible to generate this automatically from the PDF metadata, but this feature is not implemented.[build-img]:https://github.com/34j/hexo-renderer-pdf/actions/workflows/release.yml/badge.svg
[build-url]:https://github.com/34j/hexo-renderer-pdf/actions/workflows/release.yml
[downloads-img]:https://img.shields.io/npm/dt/hexo-renderer-pdf
[downloads-url]:https://www.npmtrends.com/hexo-renderer-pdf
[npm-img]:https://img.shields.io/npm/v/hexo-renderer-pdf
[npm-url]:https://www.npmjs.com/package/hexo-renderer-pdf
[issues-img]:https://img.shields.io/github/issues/34j/hexo-renderer-pdf
[issues-url]:https://github.com/34j/hexo-renderer-pdf/issues
[codecov-img]:https://codecov.io/gh/34j/hexo-renderer-pdf/branch/main/graph/badge.svg
[codecov-url]:https://codecov.io/gh/34j/hexo-renderer-pdf
[semantic-release-img]:https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[semantic-release-url]:https://github.com/semantic-release/semantic-release
[commitizen-img]:https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
[commitizen-url]:http://commitizen.github.io/cz-cli/