pdf转HTML实践之ubuntu编译

gebo-pdf2htmlex-action:依赖于 pdf2htmlEX 的 PDF 转换器 gebo-pdf2htmlex-action 依赖于 pdf2htmlEX 的 PDF 转换器 依赖关系 目前,安装主要的pdf2htmlEX依赖项并不像运行apt那样apt 。 以下说明适用于 Ubuntu 14.04。 它们改编自 [ ] ( )。 版本控制 您将需要这些来获取一些依赖项。 有可能,其中一些已经安装: sudo apt-get install git sudo apt-get install subversion sudo apt-get install cvs 各种各样的 这些都是一个或另一个包所需要的: sudo apt-get update sudo apt-get install cmake sudo apt-get install libopenjpeg-dev sudo apt-get install libpng12-dev sudo a 立即下载

官方安装说明:


Building
Kostas edited this page on 29 Nov 2018 · 59 revisions
Pages 27

Home
123
Author's Words
Auto Tests
Browser Requirements
Building

    - 欲速则不达。- Haste makes waste.
    Environment
    macOS
    Windows
    Dependencies
    Optional
    Compiling
    Troubleshooting
    Hacker's magical scripts

Command Line Options
Comparison
Customizing Output
Download
FAQ
Feature List
Font Files
How can I help?
Introduction
Clone this wiki locally

    - 欲速则不达。
    - Haste makes waste.

Environment

pdf2htmlEX can be built in a Unix-like environment:

    GNU/Linux (for Ubuntu 12.10+, Fedora)
    macOS
    Windows/Cygwin
    Windows/Mingw-w64
    Windows/MinGW, with some modifications to pdf2htmlEX. See pdf2htmlEX on TeX Wiki (in Japanese), special thanks to Haruhiko Okumura.

macOS

An easy way to install pdf2htmlEX on macOS is to use brew. After installing brew, open a terminal:

brew install pdf2htmlEX

Windows

An easy way to build pdf2htmlEX on Windows is MSYS2 + mingw-w64. Build-pdf2htmlEX-on-Windows (in Chinese)
Dependencies

Fedora

sudo yum install  cmake gcc gnu-getopt java-1.8.0-openjdk libpng-devel fontforge-devel cairo-devel poppler-devel libspiro-devel freetype-devel  poppler-data libjpeg-turbo-devel git make gcc-c++

Manual

    CMake, pkg-config
    GNU Getopt
    C++ Compiler that supports C++11, for example
        GCC >= 4.6.3
        A recent version of Clang
    libspiro
    poppler >= 0.25.0 with xpdf headers (compile with --enable-xpdf-headers)
        Install libpng (and headers) BEFORE you compile poppler if you want PNG background images generated
        Install libjpeg (and headers) BEFORE you compile poppler if you want JPG background images generated
        Install poppler-data if your want CJK support
    fontforge (with header files)
        A recent version or my fork, use the pdf2htmlEX branch, which is a modified version of the 20140101 release.
        Older versions may or may not work.

Optional

    To generate SVG background images and process Type 3 fonts
        cairo >= 1.10.0 with SVG support
        FreeType
        Add -DENABLE_SVG=OFF to cmake to disable it.
    To add hinting information for TTF fonts
        ttfautohint
        Run pdf2htmlEX with --external-hint-tool=ttfautohint
    To optimize CSS and JavaScript code with YUI Compressor and closure-compiler
        java >= 6

Compiling

git clone git://github.com/coolwanglu/pdf2htmlEX.git
cd pdf2htmlEX
cmake . && make && sudo make install

Stable releases can be found at https://github.com/coolwanglu/pdf2htmlEX/releases.

In order to create the debug version, add -DCMAKE_BUILD_TYPE=Debug to cmake.
Troubleshooting

If you installed poppler or fontforge into a place other than /usr (If you install them from source code, they are installed to /usr/local by default), you need to set up environment variables for pkg-config, and maybe also INCLUDE_PATH, LIBRARY_PATH and LD_LIBRARY_PATH because some GNU/Linux distributions do not set them up for you (e.g. Fedora). If you are not sure about this, just install those libraries to /usr by passing --prefix=/usr to configure.

If you see error messages about:

    goo/GooString.h, read the dependencies again, poppler should be compiled with --enable-xpdf-headers
    spiroentrypoints.h, install header files of libspiro
    undefined reference of Py_xxx, install header files of python-2.x
    libintl.h, install gettext and set your system include path accordingly.
    glib.h: No such file or directory, install the development header files of glib-2.0, and make sure that the location of glib.h is in INCLUDE_PATH.

Hacker's magical scripts

These scripts have been reported to be useful in various situations. They have NOT been tested by pdf2htmlEX's authors, use at your own risk! If you want to contribute, please create your own gist somewhere, and post a link and description here.

    rajeevkannav/pdf2htmlEX.sh install on Ubuntu 15.04

实操步骤:

  1. 项目拉取

git clone git://github.com/coolwanglu/pdf2htmlEX.git
cd pdf2htmlEX
# 后台执行
cmake . && make && sudo make install
  1. 执行cmake时报错,找不到poppler和libfontforge两个库。
    poppler这个好解决,直接去官网下载源码编译安装即可:

wget https://poppler.freedesktop.org/poppler-0.33.0.tar.xz
 tar -xf poppler-0.33.0.tar.xz 
 cd poppler-0.33.0/
./configure --enable-poppler-glib
sudo make install

    3. fontforge类库安装

git clone https://github.com/coolwanglu/fontforge.git fontforge.gitgit checkout pdf2htmlEX
./autogen.sh
./configuremakesudo make install

# 注意下面都是不对的。
sudo apt-get install lfontforgesudo 
apt-get install libfontforge1sudo 
apt-get install libfontforge-dev

    4.  切换到pdf2html目录,执行cmake .

图片.png

    6 然后make && sudo make install

图片.png

结果一直报错。百度半天没找到结果

不知道是版本问题还是系统问题没搞定。

最终打开源码把报错的行给注掉了。编译终于通过了。

图片.png

  7. 试水

图片.png

体验就是效果真是不错!没得说,很强大!

官方文档中提供的一键安装脚本:

HOME_PATH=$(cd ~/ && pwd)
LINUX_ARCH="$(lscpu | grep 'Architecture' | awk -F\: '{ print $2 }' | tr -d ' ')"
POPPLER_SOURCE="http://poppler.freedesktop.org/poppler-0.33.0.tar.xz"
FONTFORGE_SOURCE="https://github.com/fontforge/fontforge.git"
PDF2HTMLEX_SOURCE="https://github.com/coolwanglu/pdf2htmlEX.git"

 
  echo "Updating all Ubuntu software repository lists ..."
apt-get update
  echo "Installing basic dependencies ..."
apt-get install -qq -y cmake gcc libgetopt++-dev git
  echo "Installing Poppler ..."
apt-get install -qq -y pkg-config libopenjpeg-dev libfontconfig1-dev libfontforge-dev poppler-data poppler-utils poppler-dbg

  echo "Downloading poppler via source ..."
wget "$POPPLER_SOURCE"
tar -xvf poppler-0.33.0.tar.xz
cd poppler-0.33.0/
./configure --enable-xpdf-headers
make
make install

  echo "Installing fontforge ..."
cd "$HOME_PATH"
apt-get install -qq -y packaging-dev pkg-config python-dev libpango1.0-dev libglib2.0-dev libxml2-dev giflib-dbg
apt-get install -qq -y libjpeg-dev libtiff-dev uthash-dev libspiro-dev
  echo "cloning fontforge via source ..."
git clone --depth 1 "$FONTFORGE_SOURCE"
cd fontforge/
./bootstrap
./configure
make
sudo make install

  echo "Installing Pdf2htmlEx ..."
cd "$HOME_PATH"
git clone --depth 1 "$PDF2HTMLEX_SOURCE"
cd pdf2htmlEX/
cmake .
make
sudo make install

echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

cd "$HOME_PATH" && rm -rf "poppler-0.33.0.tar.xz"
cd "$HOME_PATH" && rm -rf "poppler-0.33.0"
cd "$HOME_PATH" && rm -rf "fontforge"
cd "$HOME_PATH" && rm -rf "pdf2htmlEX"

省心方式:docker

docker pull bwits/pdf2htmlex-alpine
alias pdf2htmlEX="docker run -ti --rm -v ~/pdf:/pdf bwits/pdf2htmlex-alpine pdf2htmlEX"

命令说明:


This page lists some common recipes of pdf2htmlEX
First thing first

    It is highly recommended that you install ttfautohint and always add --external-hint-tool=ttfautohint to each of the following recipes. This tool enhances font rendering for all browsers on Windows.
    Double check you have poppler-data installed, for CJK characters.
    Double check you have run sudo make install, or pdf2htmlEX may not be executed correctly

The simplest case

Suppose you have a PDF file pdf/test.pdf, simply running

pdf2htmlEX --zoom 1.3 pdf/test.pdf

would produce a single HTML file test.html in the current directory.
Advanced

pdf2htmlEX -f 3 -l 5 --fit-width 1024 --bg-format jpg pdf/test.pdf

would convert only the 3rd, 4th and 5th pages, and fit the page width to 1024 pixels. Background images will be generated in the JPEG format.
For publishers

pdf2htmlEX --embed cfijo --dest-dir out pdf/test.pdf

would produce a test.html and accompanying files in the out directory, in this way all the resources (fonts, images, css and javascript) are stored in separated files such that the viewer can take more advantage of browser caches.
For advanced publishers

pdf2htmlEX --embed cfijo --split-pages 1 --dest-dir out --page-filename test-%d.page pdf/test.pdf

would do something similar above, but each individual page is stored in a separated file. The files are named as test-0.page, test-1.page and so on, as specified in the command line. There is still a test.html which loads the pages dynamically through ajax. In this way the publishers are given full control, who can organize the pages as they like, for example, to implement lazy page loading.
The Ultimate Hand

pdf2htmlEX --fallback 1 pdf/test.pdf

would also produce a single test.html, which, however, consists of images and hidden text. This mode provides maximum accuracy and compatibility, at the cost of larger file size. Use this mode only when pdf2htmlEX cannot correctly process your files otherwise.
More

Just remember man pdf2htmlEX and pdf2htmlEX --help are always your best friends.

相关文档:

pdf2htmlEx学习笔记之ubuntu编译_tounicode cmap is not valid and got dropped for fo-优快云博客

Building · coolwanglu/pdf2htmlEX Wiki · GitHub

https://gist.github.com/rajeevkannav/d07f822e209a22d07176

pdf2htmlex linux 编译,关于pdf2html的各种编译-优快云博客

https://stackoverflow.com/questions/68757803/pdf2htmlex-cairofontengine-cc-error-during-dobuild

educoder 5-3Python 计算思维训练——地图模拟 任务描述 本关任务:利用 Python 实现动画观察近 30 天 4.5 级以上地震发生情况。 相关知识 为了完成本关任务,你需要掌握:1.如何用 Python 从网络获取所需数据;2.如何用 Python 绘制地图 从网络获取数据 URL 处理模块(库) 在这里插入代码片 import urllib.request as req 创建一个表示远程 url 的类文件对象 urllib.urlopen(" ") 如同本地文件一样读取内容 print data的输出结果: 摘取动画所需数据 阅读详情

相关推荐

实战STM32G0驱动DRV8870/AT8870:PWM+DMA精准调速与H桥衰减模式详解

本文详细介绍了如何使用STM32G0单片机结合DRV8870/AT8870电机驱动芯片实现直流有刷电机的精准控制。重点讲解了PWM与DMA结合实现高效调速的硬件配置与软件驱动方法,并深入剖析了H桥快衰减与慢衰减模式的工作原理及应用场景,为嵌入式电机控制项目提供了完整的实战解决方案。

c7d8e9的博客 595

Ubuntu笔记本:pdf文件转换为HTML文件

1、首先 有一个工具叫pdftohtml,它在poppler-utils软件包中,安装命令: sudo apt-get install poppler-utils pdftohtml命令的man帮助: 2、其次 在终端执行命令: pdftohtml aaa.pdf ----->(备注:此命令把pdf文件---转换为---html文件) ...

陆山右的技术博客 1157

PyTorch+C3D实战:用UCF101数据集训练你的第一个视频动作识别模型(附完整代码)

本文详细介绍了如何使用PyTorch和C3D模型在UCF101数据集上构建视频动作识别系统。从环境配置、数据预处理到模型训练与优化,提供了完整的代码实战指南,帮助开发者快速掌握视频行为识别技术。文章特别强调了3D卷积核设计、混合精度训练等关键技术要点,并分享了模型部署优化经验。

weixin_29233857的博客 218

Mac下安装pdf2htmlex

Fuck....这是一个悲伤的故事....... 等我有空写给你们看..... 首先,安装brew:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 使用 brew install pdf2htmlex 命令,这便是安装软件的命令,install后添加软件名即可 ...

qq_41910367的博客 1114

超级详细!!!新手使用AutoDL跑深度学习(MixVPR项目)的学习记录

新手第一次在AutoDL上跑深度学习的实验,遇到一些问题,简单记录一下。如果大家发现问题,欢迎和我讨论。

weixin_45152283的博客 5万+

抖音视频数据抓取

最近经常有人问我抓取抖音视频的数据,问我一些很小白的问题,算法给他也不会用。 还是先抓包,获取需要的接口和参数,相关的算法在其它文章里面有描述。 搜索个视频看看 查看抓的包信息: 可以看到,这里是post请求...

2501_91048859的博客 3097

pdf2htmlEx学习笔记之ubuntu编译

按照官方文档的描述【https://github.com/coolwanglu/pdf2htmlEX/wiki/Building】,使用如下代码编译: git clone git://github.com/coolwanglu/pdf2htmlEX.git cd pdf2htmlEX cmake . && make && sudo make install 执行c...

taohongtaohuyiwei的博客 1060

移位寄存器——用Verilog实现串入串出、串并和并串转换并进行Modelsim仿真

用Verilog实现串并转换 首先我们先要了并串和串并转换的原理 并串转换:先将八位数据暂存于一个八位寄存器器中,然后左移输出到一位输出端口,这里可以通过一个“移位”来实现,相当于实现了移位寄存器的功能。 串并转换:新输入的位值成为原来数据的最低位,将原来数据的最高位舍去,这里可以通过一个简单的“连接符”来实现。 我们这里采用两种方式来进行串并转换 一:lsb优先 Least Significant Bit,最低比特,最低位优先 二:msb优先 Most Significant Bit,最高比特,

H19981118的博客 2万+

macOS 技巧之如何安装 pdf2htmlex PDF到HTML转换器

macOS 安装 pdf2htmlex 基础信息 应用名称:pdf2htmlex 应用说明:PDF到HTML转换器 应用程序网站:https : //coolwanglu.github.io/pdf2htmlEX/ 安装应用 按Command+Space并键入Terminal,然后按Enter /返回键。 在终端应用程序中运行: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

iCloudEnd的博客 1222

【教程4>第4章>第20节】基于FPGA的costas环整体实现与仿真测试

Costas 环是一种用于载波同步的闭环反馈控制系统,主要应用于通信系统中的相干解调。其基本原理是通过鉴相器(Phase Detector,PD)比较接收信号与本地载波信号的相位差,将这个相位差信息经过环路滤波器(Loop Filter,LF)滤波后,去控制数控振荡器(Numerically Controlled Oscillator,NCO)的输出频率和相位,使得本地载波能够跟踪接收信号的载波,最终实现载波同步。Costas 环环路滤波器在载波同步过程中起着不可或缺的作用。

FPGA/MATLAB学习教程/源码/项目合作开发 1262

ISOLAR Autosar BSW 配置 之 Com

Autosar ISOLAR Bsw Configuration 之 Com

qq_42262743的博客 452

pdf转html插件~~~pdf2htmlEX安装,配置及使用

这是一个将pdf转化为html的服务,开源的。 此功能服务的代码在git上的地址为: https://github.com/coolwanglu/pdf2htmlEX/wiki 安装: 在ubuntu上安装: 输入命令 sudo apt install pdf2htmlex 即可安装完成 在mac上面安装: sudo brew install pdf2htmlex 即...

weixin_30344795的博客 784

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

蓝易云 - ubuntu下安装Sphinx,编译pdf教程

本教程详细介绍了在Ubuntu系统下使用Sphinx工具生成PDF文档的完整流程。内容包括:安装Python环境、创建虚拟环境、配置Sphinx及主题、初始化文档项目、安装LaTeX依赖、配置PDF输出参数等关键步骤,并提供了中文支持设置和常见问题解决方案。通过执行sphinx-quickstart初始化项目,调整conf.py配置文件,最终使用makelatexpdf命令即可生成PDF文档。教程强调使用虚拟环境避免冲突,配置xeCJK支持中文显示,确保生成高质量的PDF技术文档。整个过程兼顾了技术严谨性和

高性价比服务器就选:蓝易云 1336

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

PHP扩展wkhtmltox,wkhtmltopdf html转pdf、html转图片

需求: 将网页转为pdf或者图片,并提供下载。 wkhtmltox项目主页:http://wkhtmltopdf.org/ 支持html转pdf、image php扩展php-wkhtmltox项目主页:https://github.com/mreiferson/php-wkhtml...

chuobao8343的博客 786

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

python-pdfkit:HTML 转 PDF,几行代码的事

摘要:python-pdfkit 是一个封装 wkhtmltopdf 的 Python 库,简化了 HTML 转 PDF 的操作。它支持三种输入方式(URL、文件、字符串),可直接生成 PDF 或返回二进制数据,并允许通过字典或 HTML meta 标签传递参数。还支持目录、封面、外部 CSS 等进阶功能。但该库已标记为弃用,且依赖的 wkhtmltopdf 项目停滞,可能存在兼容性问题。适合后端开发者快速实现 PDF 导出功能,但新项目建议评估替代方案。安装时需注意系统 PATH 和 wkhtmltopd

mofangcode820的博客 186

关于Ubuntu下的PDF阅读器

缘起 PDF格式的文件在网络上很常见,各种各样的技术通常都会提供PDF或HTML的文档。Windows下的Adobe reader和Foxitreader都是优秀的PDF阅读器,而Ubuntu/Linux下,一直使用的是系统自带的PDF阅读器Evince,于事,我想探索一番Ubuntu下可用的PDF阅读器。 正文 在Linux使用的PDF阅读器可以分为三类,一种是专为Linux开发的,一种是

4万+

pdf2html 手动编译,解决segmentation fault错误

是这样发现问题的: 在ubuntu 14.04上装pdf2htmlEX时, 默认安装的字体是20141104版本的(pdf2htmlEX -v看libfontforge版本),应该是作者https://github.com/coolwanglu/pdf2htmlEX/wiki/Building当时编译的fontforge2014年的版本; 在是ubuntu 15.10上安装pdf2html时,

haipengdai的博客 8171

Ubuntu12.04编译wkhtml2pdf

Ubuntu上直接下载wkhtmltopdf,解压后执行命令操作确实可以实现截屏,但存在从html直接转为pdf时的部分样式、字体、的错位和色差。 由于mac osx上使用wkhtmltopdf需要编译qt,所以老老实实的阅读了README_WKHTMLTOPDF,并按照官方的操作步骤走了一遍(详见osx10.8编译wkhtmltopdf),发现木有Ubuntu上之前的那些个失真现象,所以在...

weixin_30587025的博客 270

从源码编译wkhtmltopdf:解决现代Web技术PDF生成难题

HTML转PDF是Web开发中常见的需求,其核心原理是通过渲染引擎将HTML文档转换为固定布局的PDF格式。在众多技术方案中,基于WebKit的wkhtmltopdf因其开源免费、支持CSS和JavaScript而广泛应用。然而,随着前端技术演进,CSS Grid、Flexbox等现代布局特性对渲染引擎提出了更高要求。通过从源码编译wkhtmltopdf,开发者可以集成最新的Qt和WebKit版本,从而获得对CSS自定义属性、现代JavaScript语法(如async/await)的完整支持,解决样式错乱和

weixin_34176694的博客 345

HTML 转 PDF 之 wkhtmltopdf

wkhtmltopdf是一个可以把html转为pdf的插件,有windows、linux等平台的版本,比较简单 官网下载https://wkhtmltopdf.org/downloads.html根据自己的平台安装 无需编译安装,下载解压后,在bin目录下有wkhtmltoimage和wkhtmltopdf两个文件,生成pdf可以直接运行wkhtmltopdf(也可以把bin目录...

weixin_30536513的博客 157

office文档转html,OFFICE 文档转换为html在线预览

@H_404_0@OFFICE 文档在线预览方案很多:服务器先转换为PDF,再转换为SWF,最后通过网页加载Flash预览,比如flexpaperOffice文档直接转换为SWF,通过网页加载Flash预览微软的Office365在浏览器中直接打开转换为html@H_404_0@今天,我们要用的方案是转换为html来预览。@H_404_0@技术方案:office文档转换为pdf:使用libreof...

weixin_39887926的博客 414

Openwrt的docs目录下编译生成openwrt.pdf、openwrt.html、openwrt.css文档

在Openwrt中docs目录下有工程编译、配置等相关的说明文档,我们可以把它们编译成一 个pdf等格式的文件,这样方面我们阅读。我的环境是Ubuntu,但是编译的时候,会报latex、 pdflatex、tex4ht等工具未找到,我们需要通过下面这两天命令安装这些工具: apt-get install texlive apt-get install tex4ht 然后编译就会生成o

chuanzhilong的博客 1058

告别繁琐转换:用wkhtmltopdf实现HTML到PDF的无缝衔接

在数字化办公时代,将HTML网页或文档转换为PDF格式是一项常见需求。无论是保存网页内容、生成报告还是创建电子书,一个高效可靠的转换工具都至关重要。**wkhtmltopdf**作为一款基于WebKit引擎的强大工具,能够轻松实现HTML到PDF的高质量转换,让你的文档处理流程更加顺畅。 [![wkhtmltopdf HTML转PDF功能展示](https://raw.gitcode.com/g

gitblog_00827的博客 398

PDF.js代码的编译环境搭建以及错误处理

pdf.js代码的编译

VitalityShow(网络通讯) 4389

shell下office、html、pdf文档互转方法

分类: 后台开发 版权声明:本文为博主原创文章,未经博主允许不得转载。     OFFICE 文档在线预览方案很多: 服务器先转换为PDF,再转换为SWF,最后通过网页加载Flash预览,比如flexpaper Office文档直接转换为SWF,通过网页加载Flash预览 微软的Offi

全栈空间 1808
上一篇: ubuntu 安装jmeter 报OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 35789
下一篇: 通过NGINX代理实现域名授权功能
springdk2009
博客等级 码龄17年 1835粉丝 257原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值