一、PDFium 简介
Pdfium是一个由Google开发的开源PDF渲染库,可以用来显示、处理PDF文档。它是Google Chrome浏览器中用于处理PDF文档的核心引擎。该库不只限于Chrome浏览器使用,其他开发者也可在自己的项目中使用Pdfium库。Pdfium提供了丰富的特性,如文本提取、搜索、注解、表单填充等,且性能高、稳定性好、兼容性强,被许多第三方项目所使用。
二、编译环境
1. Docker unbuntu 22.04
2. Dockerfile
FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install -y build-essential git subversion pkg-config python3 libtool cmake glib2.0-dev libatspi2.0-dev wget nano
RUN mkdir /pdfium_build
WORKDIR /pdfium_build
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
ENV PATH=/pdfium_build/depot_tools:${PATH}
RUN gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git@9eec95782c4ecdae50cd8c8e9f88d3f8941db1cd
RUN echo "target_os = [ 'android' ]" >> .gclient
RUN gclient sync
# 可根据需要指定不同版本
RUN mv pdfium.git\@9eec95782c4ecdae50cd8c8e9f88d3f8941db1cd/ pdfium
# working dir
WORKDIR /app
3. build.sh
#!/bin/bash
DIR="$( cd "$( dirname "${
BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
set -e
build() {
local ARCH="$1"
shift
local OUT="

本文介绍了如何在Ubuntu22.04环境中使用Docker构建和编译Google的开源PDF渲染库PDFium,以便在Android应用中集成,包括设置编译环境、克隆代码、配置文件和执行编译步骤。

6709

被折叠的 条评论
为什么被折叠?



