robertzhangwenjie / gitbook2pdf Goto Github PK
View Code? Open in Web Editor NEWgitbook2pdf
gitbook2pdf
应该是图片过大的问题,超出了PDF的显示范围
(venv) PS D:\coursera-dl\gitbook2pdf> python gitbook.py https://joshhug.gitbooks.io/hug61b/content/ cs61b.pdf
Traceback (most recent call last):
File "D:\coursera-dl\gitbook2pdf\gitbook.py", line 2, in
from gitbook2pdf import Gitbook2PDF
File "D:\coursera-dl\gitbook2pdf\gitbook2pdf_init_.py", line 1, in
from .gitbook2pdf import Gitbook2PDF
gobject = _dlopen(
File "D:\coursera-dl\gitbook2pdf\venv\lib\site-packages\weasyprint\text\ffi.py", line 390, in _dlopen
return ffi.dlopen(names[0]) # pragma: no cover
File "D:\coursera-dl\gitbook2pdf\venv\lib\site-packages\cffi\api.py", line 150, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "D:\coursera-dl\gitbook2pdf\venv\lib\site-packages\cffi\api.py", line 832, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "D:\coursera-dl\gitbook2pdf\venv\lib\site-packages\cffi\api.py", line 827, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library 'gobject-2.0-0': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'
(venv) PS D:\coursera-dl\gitbook2pdf> python --version
Python 3.10.7
(venv) PS D:\coursera-dl\gitbook2pdf>
在windows10 下运行
F:\Code\gitbook2pdf>docker run -it -v E:/Research:/app/output zhangwenjie/gitbook2pdf https://docs.synapseprotocol.com synapseprotocol.pdf
crawl : all done!
Generating pdf,please wait patiently
Generated
D:\Code\PythonProject\gitbook2pdf\venv\Scripts\python.exe D:\Code\PythonProject\gitbook2pdf\gitbook.py
Traceback (most recent call last):
File "D:\Code\PythonProject\gitbook2pdf\gitbook.py", line 2, in <module>
from gitbook2pdf import Gitbook2PDF
File "D:\Code\PythonProject\gitbook2pdf\gitbook2pdf\__init__.py", line 1, in <module>
from .gitbook2pdf import Gitbook2PDF
File "D:\Code\PythonProject\gitbook2pdf\gitbook2pdf\gitbook2pdf.py", line 12, in <module>
import weasyprint
File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\__init__.py", line 325, in <module>
from .css import preprocess_stylesheet # noqa isort:skip
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\css\__init__.py", line 27, in <module>
from . import computed_values, counters, media_queries
File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\css\computed_values.py", line 16, in <module>
from ..text.ffi import ffi, pango, units_to_double
File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\text\ffi.py", line 403, in <module>
gobject = _dlopen(
^^^^^^^^
File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\text\ffi.py", line 390, in _dlopen
return ffi.dlopen(names[0]) # pragma: no cover
^^^^^^^^^^^^^^^^^^^^
File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\cffi\api.py", line 150, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\cffi\api.py", line 832, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\cffi\api.py", line 827, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library 'gobject-2.0-0': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'
进程已结束,退出代码1
环境: Windows 11 + Pycharm + Python 3.11
操作:
将参数改了,运行出错
if __name__ == '__main__':
# url = sys.argv[1]
# fname = sys.argv[2]
url = 'https://aceld.gitbooks.io/libevent/'
fname = 'libevent.pdf'
Gitbook2PDF(url,fname).run()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.