Merge "Backport 940100c28ae28931722290794889cf84a92c5f6f from libopenjpeg20" into lmp-dev am: 57d92ccd81 am: 546760ac17 am: 10cae91e29 am: b44828b6cc am: 0ee97a4b56 am: 37654da1d3 am: 831761f84e am: ebaeb6a494 am: 81c5f7c382 am: e13b3512a4 am: 731d841ae5 am: 67f2ab0ec4 am: 33b62fe892
am: 3e5c0261ef

Change-Id: I76c354b65337e2131c61472fc029b64849ef1c82
tree: f29cc648443acb7492d326da46aabaa1ed5b2a36
  1. build_overrides/
  2. core/
  3. docs/
  4. fpdfsdk/
  5. fxjs/
  6. infra/
  7. public/
  8. samples/
  9. skia/
  10. test/
  11. testing/
  12. third_party/
  13. tools/
  14. xfa/
  15. .clang-format
  16. .gn
  17. Android.mk
  18. AUTHORS
  19. BUILD.gn
  20. codereview.settings
  21. DEPS
  22. LICENSE
  23. MODULE_LICENSE_BSD
  24. navbar.md
  25. NOTICE
  26. pdfium.gni
  27. pdfium.mk
  28. pdfiumfdrm.mk
  29. pdfiumformfiller.mk
  30. pdfiumfpdfapi.mk
  31. pdfiumfpdfdoc.mk
  32. pdfiumfpdftext.mk
  33. pdfiumfxcodec.mk
  34. pdfiumfxcrt.mk
  35. pdfiumfxedit.mk
  36. pdfiumfxge.mk
  37. pdfiumjavascript.mk
  38. pdfiumpdfwindow.mk
  39. PRESUBMIT.py
  40. README.md
  41. update_pdfium.py
README.md

PDFium

Prerequisites

Get the chromium depot tools via the instructions at http://www.chromium.org/developers/how-tos/install-depot-tools (this provides the gclient utility needed below).

Also install Python, Subversion, and Git and make sure they're in your path.

Windows development

PDFium uses a similar Windows toolchain as Chromium:

Open source contributors

Visual Studio 2015 Update 2 or later is highly recommended.

Run set DEPOT_TOOLS_WIN_TOOLCHAIN=0, or set that variable in your global environment.

Compilation is done through ninja, not Visual Studio.

CPU Architectures supported

The default architecture for Windows, Linux, and Mac is "x64". On Windows, "x86" is also supported. GN parameter "target_cpu = "x86"" can be used to override the default value. If you specify Android build, the default CPU architecture will be "arm".

Google employees

Run: download_from_google_storage --config and follow the authentication instructions. Note that you must authenticate with your @google.com credentials. Enter "0" if asked for a project-id.

Once you've done this, the toolchain will be installed automatically for you in the step below.

The toolchain will be in depot_tools\win_toolchain\vs_files\<hash>, and windbg can be found in depot_tools\win_toolchain\vs_files\<hash>\win_sdk\Debuggers.

If you want the IDE for debugging and editing, you will need to install it separately, but this is optional and not needed for building PDFium.

Get the code

The name of the top-level directory does not matter. In our examples, we use "repo". This directory must not have been used before by gclient config as each directory can only house a single gclient configuration.

mkdir repo
cd repo
gclient config --unmanaged https://pdfium.googlesource.com/pdfium.git
gclient sync
cd pdfium

## Generate the build files

We use GN to generate the build files and Ninja (also included with the depot_tools checkout) to execute the build files.

gn gen <directory>

Selecting build configuration

PDFium may be built either with or without JavaScript support, and with or without XFA forms support. Both of these features are enabled by default. Also note that the XFA feature requires JavaScript.

Configuration is done by executing gn args <directory> to configure the build. This will launch an editor in which you can set the following arguments.

use_goma = true  # Googlers only.
is_debug = true  # Enable debugging features.

pdf_use_skia = false  # Set true to enable experimental skia backend.
pdf_use_skia_paths = false  # Set true to enable experimental skia backend (paths only).

pdf_enable_xfa = true  # Set false to remove XFA support (implies JS support).
pdf_enable_v8 = true  # Set false to remove Javascript support.
pdf_is_standalone = true  # Set for a non-embedded build.
is_component_build = false # Disable component build (must be false)

clang_use_chrome_plugins = false  # Currently must be false.
use_sysroot = false  # Currently must be false on Linux.

Note, you must set pdf_is_standalone = true if you want the sample applications like pdfium_test to build.

When complete the arguments will be stored in <directory>/args.gn.

Building the code

If you used Ninja, you can build the sample program by: ninja -C <directory>/pdfium_test You can build the entire product (which includes a few unit tests) by: ninja -C <directory>.

Running the sample program

The pdfium_test program supports reading, parsing, and rasterizing the pages of a .pdf file to .ppm or .png output image files (windows supports two other formats). For example: <directory>/pdfium_test --ppm path/to/myfile.pdf. Note that this will write output images to path/to/myfile.pdf.<n>.ppm.

Testing

There are currently several test suites that can be run:

  • pdfium_unittests
  • pdfium_embeddertests
  • testing/tools/run_corpus_tests.py
  • testing/tools/run_javascript_tests.py
  • testing/tools/run_pixel_tests.py

It is possible the tests in the testing directory can fail due to font differences on the various platforms. These tests are reliable on the bots. If you see failures, it can be a good idea to run the tests on the tip-of-tree checkout to see if the same failures appear.

Waterfall

The current health of the source tree can be found at http://build.chromium.org/p/client.pdfium/console

Community

There are several mailing lists that are setup:

Note, the Reviews and Bugs lists are typically read-only.

Bugs

We use this bug tracker, but for security bugs, please use [Chromium's security bug template] (https://code.google.com/p/chromium/issues/entry?template=Security%20Bug) and add the "Cr-Internals-Plugins-PDF" label.

Contributing code

For contributing code, we will follow Chromium's process as much as possible. The main exceptions is:

  1. Code has to conform to the existing style and not Chromium/Google style.