├── testoutputs └── .gitignore ├── .gitignore ├── document ├── examples ├── .gitignore ├── squeeze.py └── merge.py ├── testinputs ├── attach.txt ├── metadata.txt ├── jpg.jpg ├── png.png ├── image.pdf ├── has_ocgs.pdf ├── cpdfmanual.pdf ├── cpdflibmanual.pdf ├── frontmatter.pdf ├── NotoSans-Black.ttf ├── has_attachments.pdf └── OFL.txt ├── logo.pdf ├── hello.pdf ├── run ├── pycpdflibmanual.pdf ├── fonts ├── NimbusRoman-Regular.ttf ├── LICENSE └── COPYING ├── format ├── differ ├── winbuild ├── clean ├── auto ├── Makefile ├── auto.ml └── OCamlMakefile ├── unixbuild ├── Makefile ├── make.bat ├── README.md ├── source ├── conf.py └── index.rst ├── libpycpdf.auto.c ├── LICENSE.md └── libpycpdf.c /testoutputs/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /document: -------------------------------------------------------------------------------- 1 | pydoc -w pycpdf 2 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | *.pdf 2 | -------------------------------------------------------------------------------- /testinputs/attach.txt: -------------------------------------------------------------------------------- 1 | This is the attachment! 2 | -------------------------------------------------------------------------------- /testinputs/metadata.txt: -------------------------------------------------------------------------------- 1 | This is the attachment! 2 | -------------------------------------------------------------------------------- /logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/logo.pdf -------------------------------------------------------------------------------- /hello.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/hello.pdf -------------------------------------------------------------------------------- /run: -------------------------------------------------------------------------------- 1 | CAMLPDF_REPRODUCIBLE_IDS=true CPDF_REPRODUCIBLE_DATES=true python3 pycpdftest.py 2 | -------------------------------------------------------------------------------- /testinputs/jpg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/testinputs/jpg.jpg -------------------------------------------------------------------------------- /testinputs/png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/testinputs/png.png -------------------------------------------------------------------------------- /pycpdflibmanual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/pycpdflibmanual.pdf -------------------------------------------------------------------------------- /testinputs/image.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/testinputs/image.pdf -------------------------------------------------------------------------------- /testinputs/has_ocgs.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/testinputs/has_ocgs.pdf -------------------------------------------------------------------------------- /testinputs/cpdfmanual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/testinputs/cpdfmanual.pdf -------------------------------------------------------------------------------- /testinputs/cpdflibmanual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/testinputs/cpdflibmanual.pdf -------------------------------------------------------------------------------- /testinputs/frontmatter.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/testinputs/frontmatter.pdf -------------------------------------------------------------------------------- /fonts/NimbusRoman-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/fonts/NimbusRoman-Regular.ttf -------------------------------------------------------------------------------- /testinputs/NotoSans-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/testinputs/NotoSans-Black.ttf -------------------------------------------------------------------------------- /testinputs/has_attachments.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coherentgraphics/python-libcpdf/HEAD/testinputs/has_attachments.pdf -------------------------------------------------------------------------------- /format: -------------------------------------------------------------------------------- 1 | autopep8 --in-place pycpdflib.py 2 | autopep8 --in-place pycpdftest.py 3 | clang-format -style=Google -i cpdflibwrapper.h 4 | -------------------------------------------------------------------------------- /differ: -------------------------------------------------------------------------------- 1 | diff -ua foo ../cpdflib-source/foo 2 | diff -q testoutputs/ ../cpdflib-source/testoutputs 3 | diff -ua foo2 ../cpdflib-source/foo2 4 | -------------------------------------------------------------------------------- /winbuild: -------------------------------------------------------------------------------- 1 | #Make code 2 | cd auto; make; ./auto; cd .. 3 | #Builds clib1.o 4 | cc -c -Wall -Werror -fpic libpycpdf.c 5 | #pull in libcpdf.dll 6 | cp ../cpdflib-source/libcpdf.dll . 7 | #Builds libclib1.so 8 | cc -shared -o libpycpdf.dll libpycpdf.o -L. -lcpdf 9 | -------------------------------------------------------------------------------- /clean: -------------------------------------------------------------------------------- 1 | rm -f libcpdf.so libcpdf.dll 2 | rm -f libpycpdf.o libpycpdf.so libpycpdf.dll 3 | rm -rf testoutputs/*.pdf testoutputs/*.json testoutputs/*.txt __pycache__ 4 | rm -f foo foo2 foo.diff 5 | rm -f pycpdf.html pycpdf.pyc 6 | rm -f examples/*.pdf 7 | make clean 8 | cd auto; make clean 9 | -------------------------------------------------------------------------------- /auto/Makefile: -------------------------------------------------------------------------------- 1 | # Build the camlpdf library as byte code and, if available, native code 2 | SOURCES = auto.ml 3 | 4 | RESULT = auto 5 | PACKS = camlpdf 6 | 7 | CFLAGS = -o2 8 | OCAMLFLAGS = -bin-annot 9 | OCAMLNCFLAGS = -g -safe-string 10 | OCAMLBCFLAGS = -g -safe-string 11 | OCAMLLDFLAGS = -g 12 | 13 | TARGETS := native-code 14 | 15 | all : $(TARGETS) 16 | 17 | clean :: 18 | rm -rf doc foo foo2 out.pdf out2.pdf *.ps *.cmt *.cmti *.zlib 19 | 20 | -include OCamlMakefile 21 | -------------------------------------------------------------------------------- /fonts/LICENSE: -------------------------------------------------------------------------------- 1 | The font and related files in this directory are distributed under the 2 | GNU AFFERO GENERAL PUBLIC LICENSE Version 3 (see the file COPYING), with 3 | the following exemption: 4 | 5 | As a special exception, permission is granted to include these font 6 | programs in a Postscript or PDF file that consists of a document that 7 | contains text to be displayed or printed using this font, regardless 8 | of the conditions or license applying to the document itself. 9 | 10 | -------------------------------------------------------------------------------- /unixbuild: -------------------------------------------------------------------------------- 1 | #set -o xtrace 2 | #e.g /usr/local/lib 3 | LOCATION=/tmp 4 | #Make code 5 | cd auto; make; ./auto; cd .. 6 | #install 7 | cp ../cpdflib-source/libcpdf.so $LOCATION/ 8 | #Builds libpycpdf.o 9 | cc -c -Wall -Wno-return-type -Werror -fpic libpycpdf.c 10 | #Builds libpycpdf.so 11 | cc -shared -o libpycpdf.so libpycpdf.o -L$LOCATION -lcpdf 12 | #Tell OS X where libpycpdf.so will find libcpdf.so 13 | if [[ $(uname) == 'Darwin' ]]; then 14 | install_name_tool -change libcpdf.so $LOCATION/libcpdf.so libpycpdf.so 15 | fi 16 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /examples/squeeze.py: -------------------------------------------------------------------------------- 1 | #Squeeze example 2 | import sys 3 | sys.path.insert(0,'..') 4 | import pycpdflib 5 | 6 | #DLL loading depends on your own platform. These are the author's settings. 7 | if sys.platform.startswith('darwin'): 8 | pycpdflib.loadDLL("/Users/john/repos/python-libcpdf/libpycpdf.so") 9 | elif sys.platform.startswith('linux'): 10 | pycpdflib.loadDLL("../libpycpdf.so") 11 | elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): 12 | os.add_dll_directory("C:\\\\OCaml64/home/JohnWhitington/python-libcpdf/") 13 | pycpdflib.loadDLL("libpycpdf.dll") 14 | 15 | #Load file 16 | pdf = pycpdflib.fromFile('../pycpdflibmanual.pdf', '') 17 | 18 | #Squeeze it 19 | pycpdflib.squeezeInMemory(pdf) 20 | 21 | #Write output. We make sure to use toFileExt, and make object streams. 22 | pycpdflib.toFileExt(pdf, 'squeezed.pdf', False, False, True, True, True) 23 | -------------------------------------------------------------------------------- /examples/merge.py: -------------------------------------------------------------------------------- 1 | #Merge example 2 | import sys 3 | sys.path.insert(0,'..') 4 | import pycpdflib 5 | 6 | # DLL loading depends on your own platform. These are the author's settings. 7 | if sys.platform.startswith('darwin'): 8 | pycpdflib.loadDLL("/Users/john/repos/python-libcpdf/libpycpdf.so") 9 | elif sys.platform.startswith('linux'): 10 | pycpdflib.loadDLL("../libpycpdf.so") 11 | elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): 12 | os.add_dll_directory("C:\\\\OCaml64/home/JohnWhitington/python-libcpdf/") 13 | pycpdflib.loadDLL("libpycpdf.dll") 14 | 15 | #We will take the input hello.pdf and repeat it three times 16 | mergepdf = pycpdflib.fromFile('../hello.pdf', '') 17 | 18 | #The list of PDFs to merge 19 | pdfs = [mergepdf, mergepdf, mergepdf] 20 | 21 | #Merge them 22 | merged = pycpdflib.mergeSimple(pdfs) 23 | 24 | #Write output 25 | pycpdflib.toFile(merged, 'merged.pdf', False, False) 26 | -------------------------------------------------------------------------------- /make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pycpdflib 2 | 3 | pycpdflib is a Python interface to the cpdf pdf tools. 4 | 5 | pycpdflib is distributed under the AGPL - see LICENSE.md. If you are unable to 6 | abide by the terms of the AGPL, you will need a commercial license. 7 | 8 | For commercial licenses, email 9 | [contact@coherentgraphics.co.uk](mailto:contact@coherentgraphics.co.uk) or 10 | visit [https://www.coherentpdf.com/](https://www.coherentpdf.com/) 11 | 12 | The python package may be installed with 13 | 14 | pip install pycpdflib 15 | 16 | and imported into your program with 17 | 18 | import pycpdflib 19 | 20 | 21 | Functionality 22 | ------------- 23 | 24 | * Quality Split and Merge, keeping bookmarks. Extract pages. Split on Bookmarks. 25 | * Encrypt and Decrypt (including AES 128 and AES 256 encryption) 26 | * Scale, rotate, crop and flip pages. Scale pages to fit 27 | * Copy, Remove and Add bookmarks 28 | * Stamp logos, watermarks, page numbers and multiline text. Transparency. 29 | * Supports Unicode UTF8 text input and output 30 | * Put multiple pages on a single page 31 | * List, copy, or remove annotations 32 | * Read and set document information and metadata 33 | * Add and remove file attachments to document or page. 34 | * Thicken hairlines, blacken text, make draft documents 35 | * Reconstruct malformed files 36 | * Detect missing fonts, low resolution images 37 | 38 | 39 | Obtaining the DLLs 40 | ------------------ 41 | 42 | The DLLs `pycpdflib` and `cpdflib` are required. They may be obtained here: 43 | 44 | 45 | 46 | 47 | Documentation 48 | ------------- 49 | 50 | Full manual (required reading): 51 | 52 | Follow the instructions at the end of Chapter 1 to load the DLLs and write your 53 | first pycpdflib program. 54 | 55 | Quick reference API docs: 56 | 57 | 58 | Contact 59 | ------- 60 | 61 | For commercial licenses, or queries: 62 | 63 | Bug report: 64 | -------------------------------------------------------------------------------- /source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | import os 14 | import sys 15 | sys.path.insert(0, os.path.abspath('..')) 16 | 17 | 18 | # -- Project information ----------------------------------------------------- 19 | 20 | project = 'pycpdflib' 21 | copyright = '2021, Coherent Graphics Ltd' 22 | author = 'Coherent Graphics Ltd' 23 | 24 | # The full version, including alpha/beta/rc tags 25 | release = '2.4' 26 | 27 | 28 | # -- General configuration --------------------------------------------------- 29 | 30 | # Add any Sphinx extension module names here, as strings. They can be 31 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 32 | # ones. 33 | extensions = ['sphinx.ext.autodoc'] 34 | 35 | # Add any paths that contain templates here, relative to this directory. 36 | templates_path = ['_templates'] 37 | 38 | # List of patterns, relative to source directory, that match files and 39 | # directories to ignore when looking for source files. 40 | # This pattern also affects html_static_path and html_extra_path. 41 | exclude_patterns = [] 42 | 43 | 44 | # -- Options for HTML output ------------------------------------------------- 45 | 46 | # The theme to use for HTML and HTML Help pages. See the documentation for 47 | # a list of builtin themes. 48 | # 49 | html_theme = 'alabaster' 50 | 51 | # Add any paths that contain custom static files (such as style sheets) here, 52 | # relative to this directory. They are copied after the builtin static files, 53 | # so a file named "default.css" will overwrite the builtin "default.css". 54 | html_static_path = ['_static'] 55 | 56 | 57 | 58 | autodoc_typehints = "description" 59 | -------------------------------------------------------------------------------- /auto/auto.ml: -------------------------------------------------------------------------------- 1 | (* AUTO for libpycdf.c *) 2 | open Pdfutil 3 | 4 | let contents_of_file filename = 5 | let ch = open_in_bin filename in 6 | let s = really_input_string ch (in_channel_length ch) in 7 | close_in ch; 8 | s 9 | 10 | let contents_to_file filename contents = 11 | let ch = open_out_bin filename in 12 | output_string ch contents; 13 | close_out ch 14 | 15 | let lines contents = 16 | map implode (split_around (eq '\n') (explode contents)) 17 | 18 | (* 19 | 20 | /* __AUTO int fromFile(char *filename, char *userpw) */ 21 | 22 | ...becomes... 23 | 24 | int pycpdf_fromFile(char *filename, char *userpw) { 25 | return cpdf_fromFile(filename, userpw); 26 | } 27 | 28 | *) 29 | 30 | (* 31 | 1. Extract type name (first thing, ends with space) 32 | 2. Extract function name (second thing, ends with '(' ) 33 | 3. Extract parameter names (have space before them and end with a non-alphabetic character) 34 | 4. Generate output 35 | *) 36 | 37 | let spliton c s = 38 | let a, b = cleavewhile (neq c) (explode s) in 39 | String.trim (implode a), String.trim (implode b) 40 | 41 | let getmany l = 42 | let r = ref [] in 43 | let l = ref (explode l) in 44 | while !l <> ['*'; '/'] do 45 | let x, y = cleavewhile (fun x -> x <> ' ' && x <> ',' && x <> ')') !l in 46 | (*Printf.printf "x = |%S|, y = |%S|\n%!" (implode x) (implode y);*) 47 | l := if y <> [] then explode (String.trim (implode (tl y))) else !l; 48 | r =| x 49 | done; 50 | rev (map String.trim (map implode !r)) 51 | 52 | let mkauto l = 53 | let l = String.sub l 10 (String.length l - 10) in 54 | let type_name, l = spliton ' ' l in 55 | let function_name, l = spliton '(' l in 56 | let param_types_and_names = getmany l in 57 | let types, names = really_drop_evens param_types_and_names, drop_odds param_types_and_names in 58 | (*Printf.printf "%i types, %i names\n" (length types) (length names);*) 59 | let cparams = 60 | if length types > length names then "" else 61 | implode (tl (rev (tl (tl (rev (explode (fold_left ( ^ ) "" (map2 (fun t n -> t ^ " " ^ n ^ ", ") types names)))))))) 62 | in 63 | let trim_star s = match explode s with '*'::t -> implode t | _ -> s in 64 | Printf.sprintf "%s pycpdf_%s(%s) {\n return cpdf_%s(%s);\n}\n" 65 | type_name function_name cparams function_name 66 | (fold_left (fun a b -> if a = "" then b else a ^ ", " ^ b) "" (map trim_star (drop_odds param_types_and_names))) 67 | 68 | let rec process a = function 69 | | [] -> rev (map (fun x -> x ^ "\n") a) 70 | | h::t -> 71 | if starts_with "/* __AUTO" h then process (mkauto h::a) t else process (h::a) t 72 | 73 | let go infile outfile = 74 | let indata = lines (contents_of_file infile) in 75 | let processed = process [] indata in 76 | contents_to_file outfile (fold_left ( ^ ) "" processed) 77 | 78 | let () = go "../libpycpdf.auto.c" "../libpycpdf.c" 79 | -------------------------------------------------------------------------------- /testinputs/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic) 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | https://openfontlicense.org 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /source/index.rst: -------------------------------------------------------------------------------- 1 | Pycpdflib: PDF document manipulator 2 | =================================== 3 | 4 | Pycpdflib is a library providing a huge range of tools for manipulating PDF files. 5 | It is based on ``cpdf``, the command line tool for PDF manipulation. It 6 | requires Python 3.8 or above. 7 | 8 | License 9 | ------- 10 | 11 | Pycpdflib itself is licensed under the BSD 3-clause license. See the file LICENSE 12 | in the distribution. 13 | 14 | However, using pycpdf requires the DLLs ``libpycpdf`` and 15 | ``libcpdf`` which are free for non-commercial use only. See the 16 | `license file `_. 17 | 18 | Commercial licenses may be purchased from `Coherent Graphics Ltd 19 | `_. 20 | 21 | Enquires to contact@coherentgraphics.co.uk 22 | 23 | Documentation 24 | ------------- 25 | 26 | This documentation should be read alongside the PDF manual `pycpdflibmanual.pdf 27 | `_ which describes the command line 28 | tools upon which ``pycpdflib`` is based, together with the Python interface. 29 | 30 | There are `some examples 31 | `_ in 32 | the project's GitHub repository. 33 | 34 | Obtaining the libpycpdf and libcpdf DLLs 35 | ---------------------------------------- 36 | 37 | The DLLs required are available to download in binary form for most major 38 | platforms `from here `_. 39 | For other platforms, please write to contact@coherentgraphics.co.uk. 40 | 41 | Loading the libpypcdf and libcpdf DLLs 42 | -------------------------------------- 43 | 44 | Before using the library, you must load the ``libpycpdf`` and ``libcpdf`` DLLs. 45 | This is achieved with the ``pycpdflib.loadDLL`` function, given the filename or 46 | full path of the ``libpycpdf`` DLL. 47 | 48 | On Windows, you may have to call ``os.add_dll_directory`` first. On MacOS, you 49 | may need to give the full path, and you may need to install ``libcpdf.so`` in a 50 | standard location ``/usr/local/lib/``, or use the ``install_name_tool`` command 51 | to tell ``libpycpdf.so`` where to find ``libcpdf.so``. 52 | 53 | Conventions 54 | ----------- 55 | 56 | Any function may raise the exception ``CPDFError``, carrying a string describing 57 | the error. 58 | 59 | A 'range' is a list of integers specifying page numbers. Page numbers start at 60 | 1. Range arguments are called `r`. 61 | 62 | Text arguments and results are in UTF8. Data is of type 'bytes'. 63 | 64 | Units are in PDF points (1/72 inch). 65 | 66 | Angles are in degrees. 67 | 68 | 69 | Built-in values 70 | --------------- 71 | 72 | **Paper sizes** 73 | 74 | ``a0portrait`` ``a1portrait`` ``a2portrait`` ``a3portrait`` ``a4portrait`` ``a5portrait`` ``a0landscape`` 75 | ``a1landscape`` ``a2landscape`` ``a3landscape`` ``a4landscape`` ``a5landscape`` ``usletterportrait`` 76 | ``usletterlandscape`` ``uslegalportrait`` ``uslegallandscape`` 77 | 78 | **Permissions** 79 | 80 | ``noEdit`` ``noPrint`` ``noCopy`` ``noAnnot`` ``noForms`` ``noExtract`` ``noAssemble`` ``noHqPrint`` 81 | 82 | **Encryption methods** 83 | 84 | ``pdf40bit`` ``pdf128bit`` ``aes128bitfalse`` ``aes128bittrue`` ``aes256bitfalse`` ``aes256bittrue`` 85 | ``aes256bitisofalse`` ``aes256bitisotrue`` 86 | 87 | **Positions** 88 | 89 | *Positions with two numbers in a tuple e.g (posLeft, 10.0, 20.0)* 90 | 91 | ``posCentre`` ``posLeft`` ``posRight`` 92 | 93 | *Positions with one number in a tuple e.g (top, 5.0)* 94 | 95 | ``top`` ``topLeft`` ``topRight`` ``left`` ``bottomLeft`` ``bottomRight`` ``right`` 96 | 97 | *Positions with no numbers e.g diagonal* 98 | 99 | ``diagonal`` ``reverseDiagonal`` 100 | 101 | **Fonts** 102 | 103 | ``timesRoman`` ``timesBold`` ``timesItalic`` ``timesBoldItalic`` ``helvetica`` ``helveticaBold`` 104 | ``helveticaOblique`` ``helveticaBoldOblique`` ``courier`` ``courierBold`` ``courierOblique`` 105 | ``courierBoldOblique`` 106 | 107 | **Justification** 108 | 109 | ``leftJustify`` ``centreJustify`` ``rightJustify`` 110 | 111 | **Page layouts** 112 | 113 | ``singlePage`` ``oneColumn`` ``twoColumnLeft`` ``twoColumnRight`` ``twoPageLeft`` ``twoPageRight`` 114 | 115 | **Page modes** 116 | 117 | ``useNone`` ``useOutlines`` ``useThumbs`` ``useOC`` ``useAttachments`` 118 | 119 | **Page label styles** 120 | 121 | ``decimalArabic`` ``uppercaseRoman`` ``lowercaseRoman`` ``uppercaseLetters`` ``lowercaseLetters`` 122 | 123 | Chapter 0. Preliminaries 124 | ------------------------ 125 | 126 | .. currentmodule:: pycpdflib 127 | .. autoclass:: Pdf 128 | .. autofunction:: loadDLL 129 | .. autoexception:: CPDFError 130 | .. autofunction:: lastError 131 | .. autofunction:: lastErrorString 132 | .. autofunction:: checkerror 133 | .. autofunction:: version 134 | .. autofunction:: setFast 135 | .. autofunction:: setSlow 136 | .. autofunction:: clearError 137 | .. autofunction:: onExit 138 | 139 | Chapter 1. Basics 140 | ----------------- 141 | 142 | .. autofunction:: fromFile 143 | .. autofunction:: fromFileLazy 144 | .. autofunction:: fromMemory 145 | .. autofunction:: fromMemoryLazy 146 | .. autofunction:: ptOfCm 147 | .. autofunction:: ptOfMm 148 | .. autofunction:: ptOfIn 149 | .. autofunction:: cmOfPt 150 | .. autofunction:: mmOfPt 151 | .. autofunction:: inOfPt 152 | .. autofunction:: parsePagespec 153 | .. autofunction:: validatePagespec 154 | .. autofunction:: stringOfPagespec 155 | .. autofunction:: blankRange 156 | .. autofunction:: pageRange 157 | .. autofunction:: all 158 | .. autofunction:: even 159 | .. autofunction:: odd 160 | .. autofunction:: rangeUnion 161 | .. autofunction:: difference 162 | .. autofunction:: removeDuplicates 163 | .. autofunction:: rangeLength 164 | .. autofunction:: rangeGet 165 | .. autofunction:: rangeAdd 166 | .. autofunction:: isInRange 167 | .. autofunction:: pages 168 | .. autofunction:: pagesFast 169 | .. autofunction:: toFile 170 | .. autofunction:: toFileExt 171 | .. autofunction:: toMemory 172 | .. autofunction:: isEncrypted 173 | .. autofunction:: toFileEncrypted 174 | .. autofunction:: toFileEncryptedExt 175 | .. autofunction:: decryptPdf 176 | .. autofunction:: decryptPdfOwner 177 | .. autofunction:: hasPermission 178 | .. autofunction:: encryptionKind 179 | 180 | Chapter 2. Merging and Splitting 181 | -------------------------------- 182 | 183 | .. autofunction:: mergeSimple 184 | .. autofunction:: merge 185 | .. autofunction:: mergeSame 186 | .. autofunction:: selectPages 187 | 188 | Chapter 3. Pages 189 | ---------------- 190 | 191 | .. autofunction:: scalePages 192 | .. autofunction:: scaleToFit 193 | .. autofunction:: scaleToFitPaper 194 | .. autofunction:: scaleContents 195 | .. autofunction:: shiftContents 196 | .. autofunction:: rotate 197 | .. autofunction:: rotateBy 198 | .. autofunction:: rotateContents 199 | .. autofunction:: upright 200 | .. autofunction:: hFlip 201 | .. autofunction:: vFlip 202 | .. autofunction:: crop 203 | .. autofunction:: removeCrop 204 | .. autofunction:: removeTrim 205 | .. autofunction:: removeArt 206 | .. autofunction:: removeBleed 207 | .. autofunction:: trimMarks 208 | .. autofunction:: showBoxes 209 | .. autofunction:: hardBox 210 | 211 | Chapter 4. Encryption 212 | --------------------- 213 | 214 | Encryption covered under Chapter 1 in pycpdflib. 215 | 216 | Chapter 5. Compression 217 | ---------------------- 218 | 219 | .. autofunction:: compress 220 | .. autofunction:: decompress 221 | .. autofunction:: squeezeInMemory 222 | 223 | Chapter 6. Bookmarks 224 | -------------------- 225 | 226 | .. autofunction:: getBookmarks 227 | .. autofunction:: setBookmarks 228 | .. autofunction:: getBookmarksJSON 229 | .. autofunction:: setBookmarksJSON 230 | .. autofunction:: tableOfContents 231 | 232 | Chapter 7. Presentations 233 | ------------------------ 234 | 235 | Not included in the library version. 236 | 237 | Chapter 8. Logos, Watermarks and Stamps 238 | --------------------------------------- 239 | 240 | .. autofunction:: stampOn 241 | .. autofunction:: stampUnder 242 | .. autofunction:: stampExtended 243 | .. autofunction:: combinePages 244 | .. autofunction:: addText 245 | .. autofunction:: addTextSimple 246 | .. autofunction:: removeText 247 | .. autofunction:: textWidth 248 | .. autofunction:: addContent 249 | .. autofunction:: stampAsXObject 250 | 251 | Chapter 9. Multipage facilities 252 | ------------------------------- 253 | 254 | .. autofunction:: twoUp 255 | .. autofunction:: twoUpStack 256 | .. autofunction:: impose 257 | .. autofunction:: padBefore 258 | .. autofunction:: padAfter 259 | .. autofunction:: padEvery 260 | .. autofunction:: padMultiple 261 | .. autofunction:: padMultipleBefore 262 | 263 | Chapter 10. Annotations 264 | ----------------------- 265 | 266 | Not in the library version. 267 | 268 | Chapter 11. Document Information and Metadata 269 | --------------------------------------------- 270 | 271 | .. autofunction:: isLinearized 272 | .. autofunction:: getVersion 273 | .. autofunction:: getMajorVersion 274 | .. autofunction:: getTitle 275 | .. autofunction:: getAuthor 276 | .. autofunction:: getSubject 277 | .. autofunction:: getKeywords 278 | .. autofunction:: getCreator 279 | .. autofunction:: getCreationDate 280 | .. autofunction:: getModificationDate 281 | .. autofunction:: getTitleXMP 282 | .. autofunction:: getAuthorXMP 283 | .. autofunction:: getSubjectXMP 284 | .. autofunction:: getKeywordsXMP 285 | .. autofunction:: getCreatorXMP 286 | .. autofunction:: getCreationDateXMP 287 | .. autofunction:: getModificationDateXMP 288 | .. autofunction:: setTitle 289 | .. autofunction:: setAuthor 290 | .. autofunction:: setSubject 291 | .. autofunction:: setKeywords 292 | .. autofunction:: setCreator 293 | .. autofunction:: setProducer 294 | .. autofunction:: setCreationDate 295 | .. autofunction:: setModificationDate 296 | .. autofunction:: setTitleXMP 297 | .. autofunction:: setAuthorXMP 298 | .. autofunction:: setSubjectXMP 299 | .. autofunction:: setKeywordsXMP 300 | .. autofunction:: setCreatorXMP 301 | .. autofunction:: setProducerXMP 302 | .. autofunction:: setCreationDateXMP 303 | .. autofunction:: setModificationDateXMP 304 | .. autofunction:: getDateComponents 305 | .. autofunction:: dateStringOfComponents 306 | .. autofunction:: getPageRotation 307 | .. autofunction:: hasBox 308 | .. autofunction:: getMediaBox 309 | .. autofunction:: getCropBox 310 | .. autofunction:: getTrimBox 311 | .. autofunction:: getArtBox 312 | .. autofunction:: getBleedBox 313 | .. autofunction:: setMediaBox 314 | .. autofunction:: setCropBox 315 | .. autofunction:: setTrimBox 316 | .. autofunction:: setArtBox 317 | .. autofunction:: setBleedBox 318 | .. autofunction:: markTrapped 319 | .. autofunction:: markUntrapped 320 | .. autofunction:: markTrappedXMP 321 | .. autofunction:: markUntrappedXMP 322 | .. autofunction:: setPageLayout 323 | .. autofunction:: setPageMode 324 | .. autofunction:: hideToolbar 325 | .. autofunction:: hideMenubar 326 | .. autofunction:: hideWindowUi 327 | .. autofunction:: fitWindow 328 | .. autofunction:: centerWindow 329 | .. autofunction:: displayDocTitle 330 | .. autofunction:: openAtPage 331 | .. autofunction:: setMetadataFromFile 332 | .. autofunction:: setMetadataFromByteArray 333 | .. autofunction:: getMetadata 334 | .. autofunction:: removeMetadata 335 | .. autofunction:: createMetadata 336 | .. autofunction:: setMetadataDate 337 | .. autofunction:: getPageLabels 338 | .. autofunction:: addPageLabels 339 | .. autofunction:: getPageLabelStringForPage 340 | 341 | Chapter 12. File Attachments 342 | ---------------------------- 343 | 344 | .. autofunction:: attachFile 345 | .. autofunction:: attachFileToPage 346 | .. autofunction:: attachFileFromMemory 347 | .. autofunction:: attachFileToPageFromMemory 348 | .. autofunction:: getAttachments 349 | 350 | Chapter 13. Images 351 | ------------------ 352 | 353 | .. autofunction:: getImageResolution 354 | 355 | 356 | Chapter 14. Fonts 357 | ----------------- 358 | 359 | .. autofunction:: getFontInfo 360 | .. autofunction:: removeFonts 361 | .. autofunction:: copyFont 362 | 363 | Chapter 15. PDF and JSON 364 | ------------------------ 365 | 366 | .. autofunction:: outputJSON 367 | .. autofunction:: outputJSONMemory 368 | .. autofunction:: fromJSON 369 | .. autofunction:: fromJSONMemory 370 | 371 | Chapter 16. Optional Content Groups 372 | ----------------------------------- 373 | 374 | .. autofunction:: getOCGList 375 | .. autofunction:: OCGRename 376 | .. autofunction:: OCGOrderAll 377 | .. autofunction:: OCGCoalesce 378 | 379 | Chapter 17. Making New PDFs 380 | --------------------------- 381 | 382 | .. autofunction:: blankDocument 383 | .. autofunction:: blankDocumentPaper 384 | .. autofunction:: textToPDF 385 | .. autofunction:: textToPDFPaper 386 | 387 | Chapter 18. Miscellaneous 388 | ------------------------- 389 | 390 | .. autofunction:: draft 391 | .. autofunction:: removeAllText 392 | .. autofunction:: blackText 393 | .. autofunction:: blackLines 394 | .. autofunction:: blackFills 395 | .. autofunction:: thinLines 396 | .. autofunction:: copyId 397 | .. autofunction:: removeId 398 | .. autofunction:: setVersion 399 | .. autofunction:: setFullVersion 400 | .. autofunction:: removeDictEntry 401 | .. autofunction:: removeDictEntrySearch 402 | .. autofunction:: replaceDictEntry 403 | .. autofunction:: replaceDictEntrySearch 404 | .. autofunction:: getDictEntries 405 | .. autofunction:: removeClipping 406 | -------------------------------------------------------------------------------- /libpycpdf.auto.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "cpdflibwrapper.h" 6 | 7 | /* CHAPTER 0. Preliminaries */ 8 | 9 | int pycpdf_startup(char **argv) { 10 | // char *argv[] = {"program_name", NULL}; 11 | cpdf_startup(argv); 12 | return 0; 13 | } 14 | 15 | /* __AUTO char* version() */ 16 | /* __AUTO void setFast() */ 17 | /* __AUTO void setSlow() */ 18 | /* __AUTO void embedStd14(int embed) */ 19 | /* __AUTO void embedStd14Dir(char* d) */ 20 | /* __AUTO void JSONUTF8(int utf8) */ 21 | 22 | int pycpdf_lastError(void) { 23 | return cpdf_lastError; 24 | } 25 | 26 | char *pycpdf_lastErrorString(void) { 27 | // printf("cpdf_lastErrorString is %s\n", cpdf_lastErrorString); 28 | return cpdf_lastErrorString; 29 | } 30 | 31 | void pycpdf_clearError(void) { 32 | cpdf_clearError(); 33 | cpdf_lastError = 0; 34 | cpdf_lastErrorString = ""; 35 | // printf("after clearerror, cpdf_lastErrorString is %s\n", 36 | // cpdf_lastErrorString); 37 | return; 38 | } 39 | 40 | /* __AUTO void onExit() */ 41 | 42 | /* CHAPTER 1. Basics */ 43 | 44 | /* __AUTO int fromFile(char *filename, char *userpw) */ 45 | /* __AUTO int fromFileLazy(char *filename, char *userpw) */ 46 | /* __AUTO int fromMemory(void *data, int len, char *userpw) */ 47 | /* __AUTO int fromMemoryLazy(void *data, int len, char *userpw) */ 48 | /* __AUTO void deletePdf(int pdf) */ 49 | /* __AUTO void replacePdf(int pdf, int pdf2) */ 50 | /* __AUTO double ptOfCm(double i) */ 51 | /* __AUTO double ptOfMm(double i) */ 52 | /* __AUTO double ptOfIn(double i) */ 53 | /* __AUTO double cmOfPt(double i) */ 54 | /* __AUTO double mmOfPt(double i) */ 55 | /* __AUTO double inOfPt(double i) */ 56 | /* __AUTO void startEnumeratePDFs() */ 57 | /* __AUTO int enumeratePDFsKey(int n) */ 58 | /* __AUTO char* enumeratePDFsInfo(int n) */ 59 | /* __AUTO void endEnumeratePDFs() */ 60 | /* __AUTO int parsePagespec(int pdf, char *pagespec) */ 61 | /* __AUTO int validatePagespec(char *pagespec) */ 62 | /* __AUTO char* stringOfPagespec(int pdf, int range) */ 63 | /* __AUTO int blankRange() */ 64 | /* __AUTO void deleteRange(int r) */ 65 | 66 | int pycpdf_pageRange(int f, int t) { return cpdf_range(f, t); } 67 | 68 | /* __AUTO int all(int r) */ 69 | /* __AUTO int even(int r) */ 70 | /* __AUTO int odd(int r) */ 71 | /* __AUTO int rangeUnion(int a, int b) */ 72 | /* __AUTO int difference(int a, int b) */ 73 | /* __AUTO int removeDuplicates(int r) */ 74 | /* __AUTO int rangeLength(int r) */ 75 | /* __AUTO int rangeGet(int r, int n) */ 76 | /* __AUTO int rangeAdd(int r, int p) */ 77 | /* __AUTO int isInRange(int r, int p) */ 78 | /* __AUTO int pages(int pdf) */ 79 | /* __AUTO int pagesFast(char *filename, char *userpw) */ 80 | /* __AUTO void toFile(int pdf, char *filename, int linearize, int make_id) */ 81 | /* __AUTO void toFileExt(int pdf, char *filename, int linearize, int make_id, int preserve_objstm, int generate_objstm, int compress_objstm) */ 82 | 83 | // We want to return a piece of memory which will be copied into a python 84 | // string, and the C string deallocated. 85 | void *toMemoryData; 86 | 87 | void *pycpdf_toMemory(int pdf, int linearize, int make_id, int *length) { 88 | toMemoryData = cpdf_toMemory(pdf, linearize, make_id, length); 89 | return toMemoryData; 90 | } 91 | 92 | void pycpdf_toMemoryFree(void) { 93 | free(toMemoryData); 94 | return; 95 | } 96 | 97 | /* __AUTO int isEncrypted(int pdf) */ 98 | /* __AUTO void toFileEncrypted(int pdf, int method, int *permissions, int permlength, char *ownerpw, char *userpw, int linearize, int makeid, char *filename) */ 99 | /* __AUTO void toFileEncryptedExt(int pdf, int method, int *permissions, int permlength, char *ownerpw, char *userpw, int linearize, int makeid, int preserve_objstm, int generate_objstm, int compress_objstm, char *filename) */ 100 | /* __AUTO void decryptPdf(int pdf, char *userpw) */ 101 | /* __AUTO void decryptPdfOwner(int pdf, char *ownerpw) */ 102 | /* __AUTO int hasPermission(int pdf, int perm) */ 103 | /* __AUTO int encryptionKind(int pdf) */ 104 | /* __AUTO void loadFont(char* name, char* filename) */ 105 | 106 | /* CHAPTER 2. Merging and Splitting */ 107 | 108 | /* __AUTO int mergeSimple(int *pdfs, int len) */ 109 | /* __AUTO int merge(int *pdfs, int len, int retain_numbering, int remove_duplicate_fonts) */ 110 | /* __AUTO int mergeSame(int *pdfs, int len, int retain_numbering, int remove_duplicate_fonts, int *ranges) */ 111 | /* __AUTO int selectPages(int pdf, int r) */ 112 | 113 | /* CHAPTER 3. Pages */ 114 | 115 | /* __AUTO void scalePages(int pdf, int r, double sx, double sy) */ 116 | /* __AUTO void scaleToFit(int pdf, int r, double sx, double sy, double scale_to_fit_scale) */ 117 | /* __AUTO void scaleToFitPaper(int pdf, int r, int papersize, double scale_to_fit_scale) */ 118 | 119 | void pycpdf_scaleContents(int pdf, int r, int pos, double p1, double p2, double scale) { 120 | struct cpdf_position p = { 121 | .cpdf_anchor = pos, .cpdf_coord1 = p1, .cpdf_coord2 = p2}; 122 | cpdf_scaleContents(pdf, r, p, scale); 123 | } 124 | 125 | /* __AUTO void shiftContents(int pdf, int r, double dx, double dy) */ 126 | /* __AUTO void shiftBoxes(int pdf, int r, double dx, double dy) */ 127 | /* __AUTO void rotate(int pdf, int r, int rotation) */ 128 | /* __AUTO void rotateBy(int pdf, int r, int rotation) */ 129 | /* __AUTO void rotateContents(int pdf, int r, double rotation) */ 130 | /* __AUTO void upright(int pdf, int r) */ 131 | /* __AUTO void hFlip(int pdf, int r) */ 132 | /* __AUTO void vFlip(int pdf, int r) */ 133 | /* __AUTO void crop(int pdf, int r, double x, double y, double w, double h) */ 134 | /* __AUTO void removeCrop(int pdf, int r) */ 135 | /* __AUTO void removeTrim(int pdf, int r) */ 136 | /* __AUTO void removeArt(int pdf, int r) */ 137 | /* __AUTO void removeBleed(int pdf, int r) */ 138 | /* __AUTO void trimMarks(int pdf, int r) */ 139 | /* __AUTO void showBoxes(int pdf, int r) */ 140 | /* __AUTO void hardBox(int pdf, int r, char *boxname) */ 141 | 142 | /* CHAPTER 4. Encryption */ 143 | 144 | /* Encryption covered under Chapter 1 in cpdflib. */ 145 | 146 | /* CHAPTER 5. Compression */ 147 | 148 | /* __AUTO void compress(int pdf) */ 149 | /* __AUTO void decompress(int pdf) */ 150 | /* __AUTO void squeezeInMemory(int pdf) */ 151 | 152 | /* CHAPTER 6. Bookmarks */ 153 | 154 | /* __AUTO void startGetBookmarkInfo(int pdf) */ 155 | /* __AUTO int numberBookmarks() */ 156 | /* __AUTO int getBookmarkLevel(int n) */ 157 | /* __AUTO int getBookmarkPage(int pdf, int page) */ 158 | /* __AUTO char* getBookmarkText(int n) */ 159 | /* __AUTO int getBookmarkOpenStatus(int n) */ 160 | /* __AUTO void endGetBookmarkInfo() */ 161 | /* __AUTO void startSetBookmarkInfo(int n) */ 162 | /* __AUTO void setBookmarkLevel(int n, int level) */ 163 | /* __AUTO void setBookmarkPage(int pdf, int n, int targetpage) */ 164 | /* __AUTO void setBookmarkOpenStatus(int n, int status) */ 165 | /* __AUTO void setBookmarkText(int n, char *text) */ 166 | /* __AUTO void endSetBookmarkInfo(int pdf) */ 167 | 168 | void *getBookmarksJSONData; 169 | 170 | void *pycpdf_getBookmarksJSON(int pdf, int *length) { 171 | getBookmarksJSONData = cpdf_getBookmarksJSON(pdf, length); 172 | return getBookmarksJSONData; 173 | } 174 | 175 | void pycpdf_getBookmarksJSONFree(void) { 176 | free(getBookmarksJSONData); 177 | return; 178 | } 179 | 180 | /* __AUTO void setBookmarksJSON(int pdf, void* data, int length) */ 181 | /* __AUTO void tableOfContents(int pdf, char* font, double fontsize, char* title, int bookmark) */ 182 | 183 | /* CHAPTER 7. Presentations */ 184 | 185 | /* Not included in the library version */ 186 | 187 | /* CHAPTER 8. Logos, Watermarks and Stamps */ 188 | 189 | /* __AUTO void stampOn(int pdf, int pdf2, int r) */ 190 | /* __AUTO void stampUnder(int pdf, int pdf2, int r) */ 191 | 192 | void pycpdf_stampExtended(int pdf, int pdf2, int r, int isover, 193 | int scale_stamp_to_fit, int pos, int c1, int c2, 194 | int relative_to_cropbox) { 195 | struct cpdf_position position = { 196 | .cpdf_anchor = pos, .cpdf_coord1 = c1, .cpdf_coord2 = c2}; 197 | cpdf_stampExtended(pdf, pdf2, r, isover, scale_stamp_to_fit, position, 198 | relative_to_cropbox); 199 | return; 200 | } 201 | 202 | /* __AUTO void combinePages(int pdf, int pdf2) */ 203 | 204 | void pycpdf_addText(int metrics, int pdf, int r, char *text, int pos, double p1, 205 | double p2, double line_spacing, int bates, char* font, 206 | double size, double red, double green, double blue, 207 | int underneath, int relative_to_cropbox, int outline, 208 | double opacity, int justification, int midline, int topline, 209 | char *filename, double line_width, int embed_fonts) { 210 | struct cpdf_position position = { 211 | .cpdf_anchor = pos, .cpdf_coord1 = p1, .cpdf_coord2 = p2}; 212 | cpdf_addText(metrics, pdf, r, text, position, line_spacing, bates, font, size, 213 | red, green, blue, underneath, relative_to_cropbox, outline, 214 | opacity, justification, midline, topline, filename, line_width, 215 | embed_fonts); 216 | return; 217 | } 218 | 219 | void pycpdf_addTextSimple(int pdf, int r, char *text, int pos, double p1, 220 | double p2, char* font, double size) { 221 | struct cpdf_position position = { 222 | .cpdf_anchor = pos, .cpdf_coord1 = p1, .cpdf_coord2 = p2}; 223 | cpdf_addTextSimple(pdf, r, text, position, font, size); 224 | return; 225 | } 226 | 227 | /* __AUTO void removeText(int pdf, int r) */ 228 | /* __AUTO int textWidth(char* font, char* string) */ 229 | /* __AUTO void addContent(char* content, int before, int pdf, int r) */ 230 | /* __AUTO char* stampAsXObject(int pdf, int r, int stamp_pdf) */ 231 | 232 | /* CHAPTER 9. Multipage facilities */ 233 | 234 | /* __AUTO void impose(int pdf, double x, double y, int fit, int columns, int rtl, int btt, int center, double margin, double spacing, double linewidth) */ 235 | /* __AUTO void chop(int pdf, int range, int x, int y, int columns, int rtl, int btt) */ 236 | /* __AUTO void chopH(int pdf, int range, int columns, double y) */ 237 | /* __AUTO void chopV(int pdf, int range, int columns, double x) */ 238 | /* __AUTO void twoUp(int pdf) */ 239 | /* __AUTO void twoUpStack(int pdf) */ 240 | /* __AUTO void padBefore(int pdf, int r) */ 241 | /* __AUTO void padAfter(int pdf, int r) */ 242 | /* __AUTO void padEvery(int pdf, int r) */ 243 | /* __AUTO void padMultiple(int pdf, int n) */ 244 | /* __AUTO void padMultipleBefore(int pdf, int n) */ 245 | 246 | /* CHAPTER 10. Annotations */ 247 | void *annotationsJSONData; 248 | 249 | void *pycpdf_annotationsJSON(int pdf, int *length) { 250 | annotationsJSONData = cpdf_annotationsJSON(pdf, length); 251 | return annotationsJSONData; 252 | } 253 | 254 | void pycpdf_annotationsJSONFree(void) { 255 | free(annotationsJSONData); 256 | return; 257 | } 258 | 259 | /* __AUTO void removeAnnotations(int pdf, int range) */ 260 | /* __AUTO void setAnnotationsJSON(int pdf, void* data, int length) */ 261 | 262 | /* CHAPTER 11. Document Information and Metadata */ 263 | 264 | /* __AUTO int isLinearized(char *filename) */ 265 | /* __AUTO int hasObjectStreams(int pdf) */ 266 | /* __AUTO char* id1(int pdf) */ 267 | /* __AUTO char* id2(int pdf) */ 268 | /* __AUTO int hasAcroForm(int pdf) */ 269 | /* __AUTO int startGetSubformats(int pdf) */ 270 | /* __AUTO char* getSubformat(int s) */ 271 | /* __AUTO void endGetSubformats() */ 272 | /* __AUTO int getVersion(int pdf) */ 273 | /* __AUTO int getMajorVersion(int pdf) */ 274 | /* __AUTO char* getTitle(int pdf) */ 275 | /* __AUTO char* getAuthor(int pdf) */ 276 | /* __AUTO char* getSubject(int pdf) */ 277 | /* __AUTO char* getKeywords(int pdf) */ 278 | /* __AUTO char* getCreator(int pdf) */ 279 | /* __AUTO char* getProducer(int pdf) */ 280 | /* __AUTO char* getCreationDate(int pdf) */ 281 | /* __AUTO char* getModificationDate(int pdf) */ 282 | /* __AUTO char* getTitleXMP(int pdf) */ 283 | /* __AUTO char* getAuthorXMP(int pdf) */ 284 | /* __AUTO char* getSubjectXMP(int pdf) */ 285 | /* __AUTO char* getKeywordsXMP(int pdf) */ 286 | /* __AUTO char* getCreatorXMP(int pdf) */ 287 | /* __AUTO char* getProducerXMP(int pdf) */ 288 | /* __AUTO char* getCreationDateXMP(int pdf) */ 289 | /* __AUTO char* getModificationDateXMP(int pdf) */ 290 | /* __AUTO void setTitle(int pdf, char *s) */ 291 | /* __AUTO void setAuthor(int pdf, char *s) */ 292 | /* __AUTO void setSubject(int pdf, char *s) */ 293 | /* __AUTO void setKeywords(int pdf, char *s) */ 294 | /* __AUTO void setCreator(int pdf, char *s) */ 295 | /* __AUTO void setProducer(int pdf, char *s) */ 296 | /* __AUTO void setCreationDate(int pdf, char *s) */ 297 | /* __AUTO void setModificationDate(int pdf, char *s) */ 298 | /* __AUTO void setTitleXMP(int pdf, char *s) */ 299 | /* __AUTO void setAuthorXMP(int pdf, char *s) */ 300 | /* __AUTO void setSubjectXMP(int pdf, char *s) */ 301 | /* __AUTO void setKeywordsXMP(int pdf, char *s) */ 302 | /* __AUTO void setCreatorXMP(int pdf, char *s) */ 303 | /* __AUTO void setProducerXMP(int pdf, char *s) */ 304 | /* __AUTO void setCreationDateXMP(int pdf, char *s) */ 305 | /* __AUTO void setModificationDateXMP(int pdf, char *s) */ 306 | /* __AUTO void getDateComponents(char *str, int *year, int *month, int *day, int *hour, int *minute, int *second, int *hour_offset, int *minute_offset) */ 307 | /* __AUTO char* dateStringOfComponents(int year, int month, int day, int hour, int minute, int second, int hour_offset, int minute_offset) */ 308 | /* __AUTO int getPageRotation(int pdf, int pagenumber) */ 309 | /* __AUTO int hasBox(int pdf, int pagenumber, char *box) */ 310 | /* __AUTO int numAnnots(int pdf, int pagenumber) */ 311 | /* __AUTO void getMediaBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) */ 312 | /* __AUTO void getCropBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) */ 313 | /* __AUTO void getTrimBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) */ 314 | /* __AUTO void getArtBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) */ 315 | /* __AUTO void getBleedBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) */ 316 | 317 | void pycpdf_setMediaBox(int pdf, int range, double minx, double maxx, 318 | double miny, double maxy) { 319 | cpdf_setMediabox(pdf, range, minx, maxx, miny, maxy); 320 | return; 321 | } 322 | 323 | /* __AUTO void setCropBox(int pdf, int range, double minx, double maxx, double miny, double maxy) */ 324 | /* __AUTO void setTrimBox(int pdf, int range, double minx, double maxx, double miny, double maxy) */ 325 | /* __AUTO void setArtBox(int pdf, int range, double minx, double maxx, double miny, double maxy) */ 326 | /* __AUTO void setBleedBox(int pdf, int range, double minx, double maxx, double miny, double maxy) */ 327 | 328 | 329 | void *pageInfoJSONData; 330 | 331 | void *pycpdf_pageInfoJSON(int pdf, int *length) { 332 | pageInfoJSONData = cpdf_pageInfoJSON(pdf, length); 333 | return pageInfoJSONData; 334 | } 335 | 336 | void pycpdf_pageInfoJSONFree(void) { 337 | free(pageInfoJSONData); 338 | return; 339 | } 340 | 341 | /* __AUTO void markTrapped(int pdf) */ 342 | /* __AUTO void markUntrapped(int pdf) */ 343 | /* __AUTO void markTrappedXMP(int pdf) */ 344 | /* __AUTO void markUntrappedXMP(int pdf) */ 345 | /* __AUTO void setPageLayout(int pdf, int layout) */ 346 | /* __AUTO int getPageLayout(int pdf) */ 347 | /* __AUTO void setPageMode(int pdf, int mode) */ 348 | /* __AUTO int getPageMode(int pdf) */ 349 | /* __AUTO void hideToolbar(int pdf, int flag) */ 350 | /* __AUTO int getHideToolbar(int pdf) */ 351 | /* __AUTO void hideMenubar(int pdf, int flag) */ 352 | /* __AUTO int getHideMenubar(int pdf) */ 353 | /* __AUTO void hideWindowUi(int pdf, int flag) */ 354 | /* __AUTO int getHideWindowUi(int pdf) */ 355 | /* __AUTO void fitWindow(int pdf, int flag) */ 356 | /* __AUTO int getFitWindow(int pdf) */ 357 | /* __AUTO void centerWindow(int pdf, int flag) */ 358 | /* __AUTO int getCenterWindow(int pdf) */ 359 | /* __AUTO void displayDocTitle(int pdf, int flag) */ 360 | /* __AUTO int getDisplayDocTitle(int pdf) */ 361 | /* __AUTO void nonFullScreenPageMode(int pdf, int flag) */ 362 | /* __AUTO int getNonFullScreenPageMode(int pdf) */ 363 | /* __AUTO void openAtPage(int pdf, int flag, int pagenumber) */ 364 | /* __AUTO void openAtPageCustom(int pdf, char* custom) */ 365 | /* __AUTO void setMetadataFromFile(int pdf, char* filename) */ 366 | /* __AUTO void setMetadataFromByteArray(int pdf, void* data, int len) */ 367 | 368 | void *getMetadataData; 369 | 370 | void *pycpdf_getMetadata(int pdf, int *length) { 371 | getMetadataData = cpdf_getMetadata(pdf, length); 372 | return getMetadataData; 373 | } 374 | 375 | void pycpdf_getMetadataFree(void) { 376 | free(getMetadataData); 377 | return; 378 | } 379 | 380 | /* __AUTO void removeMetadata(int pdf) */ 381 | /* __AUTO void createMetadata(int pdf) */ 382 | /* __AUTO void setMetadataDate(int pdf, char* date) */ 383 | /* __AUTO int startGetPageLabels(int pdf) */ 384 | /* __AUTO int getPageLabelStyle(int n) */ 385 | /* __AUTO char* getPageLabelPrefix(int n) */ 386 | /* __AUTO int getPageLabelOffset(int n) */ 387 | /* __AUTO int getPageLabelRange(int n) */ 388 | /* __AUTO void endGetPageLabels() */ 389 | /* __AUTO void addPageLabels(int pdf, int style, char *prefix, int offset, int range, int progress) */ 390 | /* __AUTO void removePageLabels(int pdf) */ 391 | /* __AUTO char* getPageLabelStringForPage(int pdf, int pagenumber) */ 392 | 393 | void *compositionJSONData; 394 | 395 | void *pycpdf_compositionJSON(int filesize, int pdf, int *length) { 396 | compositionJSONData = cpdf_compositionJSON(filesize, pdf, length); 397 | return compositionJSONData; 398 | } 399 | 400 | void pycpdf_compositionJSONFree(void) { 401 | free(compositionJSONData); 402 | return; 403 | } 404 | 405 | /* CHAPTER 12. File Attachments */ 406 | 407 | /* __AUTO void attachFile(char* filename, int pdf) */ 408 | /* __AUTO void attachFileToPage(char* filename, int pdf, int pagenumber) */ 409 | /* __AUTO void attachFileFromMemory(void* data, int len, char* filename, int pdf) */ 410 | /* __AUTO void attachFileToPageFromMemory(void* data, int len, char* filename, int pdf, int pagenumber) */ 411 | /* __AUTO void removeAttachedFiles(int pdf) */ 412 | /* __AUTO void startGetAttachments(int pdf) */ 413 | /* __AUTO int numberGetAttachments() */ 414 | /* __AUTO char* getAttachmentName(int n) */ 415 | /* __AUTO int getAttachmentPage(int n) */ 416 | 417 | void *getAttachmentData; 418 | 419 | void *pycpdf_getAttachmentData(int n, int *length) { 420 | getAttachmentData = cpdf_getAttachmentData(n, length); 421 | return getAttachmentData; 422 | } 423 | 424 | void pycpdf_getAttachmentFree(void) { 425 | free(getAttachmentData); 426 | return; 427 | } 428 | 429 | /* __AUTO void endGetAttachments() */ 430 | 431 | /* CHAPTER 13. Images. */ 432 | 433 | /* __AUTO int startGetImageResolution(int pdf, double min_required_resolution) */ 434 | /* __AUTO int getImageResolutionPageNumber(int n) */ 435 | /* __AUTO char* getImageResolutionImageName(int n) */ 436 | /* __AUTO int getImageResolutionXPixels(int n) */ 437 | /* __AUTO int getImageResolutionYPixels(int n) */ 438 | /* __AUTO double getImageResolutionXRes(int n) */ 439 | /* __AUTO double getImageResolutionYRes(int n) */ 440 | /* __AUTO int getImageResolutionObjNum(int n) */ 441 | /* __AUTO void endGetImageResolution() */ 442 | /* __AUTO int startGetImages(int pdf) */ 443 | /* __AUTO int getImageObjNum(int serial) */ 444 | /* __AUTO char* getImagePages(int serial) */ 445 | /* __AUTO char* getImageName(int serial) */ 446 | /* __AUTO int getImageWidth(int serial) */ 447 | /* __AUTO int getImageHeight(int serial) */ 448 | /* __AUTO int getImageSize(int serial) */ 449 | /* __AUTO int getImageBPC(int serial) */ 450 | /* __AUTO char* getImageColSpace(int serial) */ 451 | /* __AUTO char* getImageFilter(int serial) */ 452 | /* __AUTO void endGetImages() */ 453 | 454 | void *imageResolutionJSONData; 455 | 456 | void *pycpdf_imageResolutionJSON(int pdf, int *length, float resolution) { 457 | imageResolutionJSONData = cpdf_imageResolutionJSON(pdf, length, resolution); 458 | return imageResolutionJSONData; 459 | } 460 | 461 | void pycpdf_imageResolutionJSONFree(void) { 462 | free(imageResolutionJSONData); 463 | return; 464 | } 465 | 466 | void *imagesJSONData; 467 | 468 | void *pycpdf_imagesJSON(int pdf, int *length) { 469 | imagesJSONData = cpdf_imagesJSON(pdf, length); 470 | return imagesJSONData; 471 | } 472 | 473 | void pycpdf_imagesJSONFree(void) { 474 | free(imagesJSONData); 475 | return; 476 | } 477 | 478 | /* CHAPTER 14. Fonts */ 479 | 480 | /* __AUTO void removeFonts(int pdf) */ 481 | /* __AUTO void copyFont(int pdf, int pdf2, int range, int pagenumber, char *fontname) */ 482 | /* __AUTO void startGetFontInfo(int pdf) */ 483 | /* __AUTO int numberFonts() */ 484 | /* __AUTO int getFontPage(int n) */ 485 | /* __AUTO char* getFontName(int n) */ 486 | /* __AUTO char* getFontType(int n) */ 487 | /* __AUTO char* getFontEncoding(int n) */ 488 | /* __AUTO void endGetFontInfo() */ 489 | 490 | void *fontsJSONData; 491 | 492 | void *pycpdf_fontsJSON(int pdf, int *length) { 493 | fontsJSONData = cpdf_fontsJSON(pdf, length); 494 | return fontsJSONData; 495 | } 496 | 497 | void pycpdf_fontsJSONFree(void) { 498 | free(fontsJSONData); 499 | return; 500 | } 501 | 502 | /* CHAPTER 15. PDF and JSON */ 503 | 504 | /* __AUTO void outputJSON(char* filename, int parse_content, int no_stream_data, int decompress_streams, int pdf) */ 505 | 506 | void *outputJSONData; 507 | 508 | void *pycpdf_outputJSONMemory(int pdf, int parse_content, int no_stream_data, 509 | int decompress_stream, int *retlen) { 510 | outputJSONData = cpdf_outputJSONMemory(pdf, parse_content, no_stream_data, 511 | decompress_stream, retlen); 512 | return outputJSONData; 513 | } 514 | 515 | void pycpdf_outputJSONMemoryFree(void) { 516 | free(outputJSONData); 517 | return; 518 | } 519 | 520 | /* __AUTO int fromJSON(char *filename) */ 521 | /* __AUTO int fromJSONMemory(void *data, int len) */ 522 | 523 | /* CHAPTER 16. Optional Content Groups */ 524 | 525 | /* __AUTO int startGetOCGList(int pdf) */ 526 | /* __AUTO char* OCGListEntry(int i) */ 527 | /* __AUTO void endGetOCGList() */ 528 | /* __AUTO void OCGCoalesce(int pdf) */ 529 | /* __AUTO void OCGRename(int pdf, char* n_from, char* n_to) */ 530 | /* __AUTO void OCGOrderAll(int pdf) */ 531 | 532 | /* CHAPTER 17. Creating New PDFs */ 533 | 534 | /* __AUTO int blankDocument(double w, double h, int pages) */ 535 | /* __AUTO int blankDocumentPaper(int papersize, int pages) */ 536 | /* __AUTO int textToPDF(double w, double h, char* font, double fontsize, char *filename) */ 537 | /* __AUTO int textToPDFMemory(double w, double h, char* font, double fontsize, void* data, int len) */ 538 | /* __AUTO int textToPDFPaper(int papersize, char* font, double fontsize, char *filename) */ 539 | /* __AUTO int textToPDFPaperMemory(int papersize, char* font, double fontsize, void* data, int len) */ 540 | /* __AUTO int fromPNG(char* filename) */ 541 | /* __AUTO int fromPNGMemory(void* data, int len) */ 542 | /* __AUTO int fromJPEG(char* filename) */ 543 | /* __AUTO int fromJPEGMemory(void* data, int len) */ 544 | 545 | /* CHAPTER 18. Drawing on PDFs */ 546 | 547 | /* __AUTO void drawBegin() */ 548 | /* __AUTO void drawEnd(int pdf, int range) */ 549 | /* __AUTO void drawEndExtended(int pdf, int range, int underneath, int bates, char* filename) */ 550 | /* __AUTO void drawRect(double x, double y, double w, double h) */ 551 | /* __AUTO void drawTo(double x, double y) */ 552 | /* __AUTO void drawLine(double x, double y) */ 553 | /* __AUTO void drawBez(double x1, double y1, double x2, double y2, double x3, double y3) */ 554 | /* __AUTO void drawBez23(double x2, double y2, double x3, double y3) */ 555 | /* __AUTO void drawBez13(double x1, double y1, double x3, double y3) */ 556 | /* __AUTO void drawCircle(double x, double y, double r) */ 557 | /* __AUTO void drawStroke() */ 558 | /* __AUTO void drawFill() */ 559 | /* __AUTO void drawFillEo() */ 560 | /* __AUTO void drawStrokeFill() */ 561 | /* __AUTO void drawStrokeFillEo() */ 562 | /* __AUTO void drawClose() */ 563 | /* __AUTO void drawClip() */ 564 | /* __AUTO void drawClipEo() */ 565 | /* __AUTO void drawStrokeColGrey(double g) */ 566 | /* __AUTO void drawStrokeColRGB(double r, double g, double b) */ 567 | /* __AUTO void drawStrokeColCYMK(double c, double y, double m, double k) */ 568 | /* __AUTO void drawFillColGrey(double g) */ 569 | /* __AUTO void drawFillColRGB(double r, double g, double b) */ 570 | /* __AUTO void drawFillColCYMK(double c, double y, double m, double k) */ 571 | /* __AUTO void drawThick(double thickness) */ 572 | /* __AUTO void drawCap(int captype) */ 573 | /* __AUTO void drawJoin(int jointype) */ 574 | /* __AUTO void drawMiter(double m) */ 575 | /* __AUTO void drawDash(char* description) */ 576 | /* __AUTO void drawPush() */ 577 | /* __AUTO void drawPop() */ 578 | /* __AUTO void drawMatrix(double a, double b, double c, double d, double e, double f) */ 579 | /* __AUTO void drawMTrans(double tx, double ty) */ 580 | /* __AUTO void drawMRot(double x, double y, double a) */ 581 | /* __AUTO void drawMScale(double x, double y, double sx, double sy) */ 582 | /* __AUTO void drawMShearX(double x, double y, double a) */ 583 | /* __AUTO void drawMShearY(double x, double y, double a) */ 584 | /* __AUTO void drawXObjBBox(double x, double y, double w, double h) */ 585 | /* __AUTO void drawXObj(char* name) */ 586 | /* __AUTO void drawUse(char* name) */ 587 | /* __AUTO void drawEndXObj() */ 588 | /* __AUTO void drawJPEG(char* name, char* fontname) */ 589 | /* __AUTO void drawJPEGMemory(char* name, void* data, int len) */ 590 | /* __AUTO void drawPNG(char* name, char* fontname) */ 591 | /* __AUTO void drawPNGMemory(char* name, void* data, int len) */ 592 | /* __AUTO void drawImage(char* name) */ 593 | /* __AUTO void drawFillOpacity(double n) */ 594 | /* __AUTO void drawStrokeOpacity(double n) */ 595 | /* __AUTO void drawBT() */ 596 | /* __AUTO void drawET() */ 597 | /* __AUTO void drawFont(char* name) */ 598 | /* __AUTO void drawFontSize(double n) */ 599 | /* __AUTO void drawText(char* text) */ 600 | /* __AUTO void drawSText(char* text) */ 601 | /* __AUTO void drawLeading(double n) */ 602 | /* __AUTO void drawCharSpace(double n) */ 603 | /* __AUTO void drawWordSpace(double n) */ 604 | /* __AUTO void drawTextScale(double n) */ 605 | /* __AUTO void drawRenderMode(int n) */ 606 | /* __AUTO void drawRise(double n) */ 607 | /* __AUTO void drawNL() */ 608 | /* __AUTO void drawNewPage() */ 609 | 610 | /* CHAPTER 19. Miscellaneous */ 611 | 612 | /* __AUTO void draft(int pdf, int r, int boxes) */ 613 | /* __AUTO void removeAllText(int pdf, int r) */ 614 | /* __AUTO void blackText(int pdf, int r) */ 615 | /* __AUTO void blackLines(int pdf, int r) */ 616 | /* __AUTO void blackFills(int pdf, int r) */ 617 | /* __AUTO void thinLines(int pdf, int r, double linewidth) */ 618 | /* __AUTO void copyId(int pdf, int pdf2) */ 619 | /* __AUTO void removeId(int pdf) */ 620 | /* __AUTO void setVersion(int pdf, int version) */ 621 | /* __AUTO void setFullVersion(int pdf, int major, int minor) */ 622 | /* __AUTO void removeDictEntry(int pdf, char *key) */ 623 | /* __AUTO void removeDictEntrySearch(int pdf, char *key, char *searchterm) */ 624 | /* __AUTO void replaceDictEntry(int pdf, char *key, char *newvalue) */ 625 | /* __AUTO void replaceDictEntrySearch(int pdf, char *key, char *newvalue, char *searchterm) */ 626 | /* __AUTO void removeClipping(int pdf, int r) */ 627 | 628 | void *getDictEntriesData; 629 | 630 | void *pycpdf_getDictEntries(int pdf, char *key, int *length) { 631 | getDictEntriesData = cpdf_getDictEntries(pdf, key, length); 632 | return getDictEntriesData; 633 | } 634 | 635 | void pycpdf_getDictEntriesFree(void) { 636 | free(getDictEntriesData); 637 | return; 638 | } 639 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /fonts/COPYING: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /auto/OCamlMakefile: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # OCamlMakefile 3 | # Copyright (C) 1999- Markus Mottl 4 | # 5 | # For updates see: 6 | # http://www.ocaml.info/home/ocaml_sources.html 7 | # 8 | ########################################################################### 9 | 10 | # Modified by damien for .glade.ml compilation 11 | 12 | # Set these variables to the names of the sources to be processed and 13 | # the result variable. Order matters during linkage! 14 | 15 | ifndef SOURCES 16 | SOURCES := foo.ml 17 | endif 18 | export SOURCES 19 | 20 | ifndef RES_CLIB_SUF 21 | RES_CLIB_SUF := _stubs 22 | endif 23 | export RES_CLIB_SUF 24 | 25 | ifndef RESULT 26 | RESULT := foo 27 | endif 28 | export RESULT := $(strip $(RESULT)) 29 | 30 | export LIB_PACK_NAME 31 | 32 | ifndef DOC_FILES 33 | DOC_FILES := $(filter %.mli, $(SOURCES)) 34 | endif 35 | export DOC_FILES 36 | FIRST_DOC_FILE := $(firstword $(DOC_FILES)) 37 | 38 | export BCSUFFIX 39 | export NCSUFFIX 40 | 41 | ifndef TOPSUFFIX 42 | TOPSUFFIX := .top 43 | endif 44 | export TOPSUFFIX 45 | 46 | # Eventually set include- and library-paths, libraries to link, 47 | # additional compilation-, link- and ocamlyacc-flags 48 | # Path- and library information needs not be written with "-I" and such... 49 | # Define THREADS if you need it, otherwise leave it unset (same for 50 | # USE_CAMLP4)! 51 | 52 | export THREADS 53 | export VMTHREADS 54 | export ANNOTATE 55 | export USE_CAMLP4 56 | 57 | export INCDIRS 58 | export LIBDIRS 59 | export EXTLIBDIRS 60 | export RESULTDEPS 61 | export OCAML_DEFAULT_DIRS 62 | 63 | export LIBS 64 | export CLIBS 65 | export CFRAMEWORKS 66 | 67 | export OCAMLFLAGS 68 | export OCAMLNCFLAGS 69 | export OCAMLBCFLAGS 70 | 71 | export OCAMLLDFLAGS 72 | export OCAMLNLDFLAGS 73 | export OCAMLBLDFLAGS 74 | 75 | export OCAMLMKLIB_FLAGS 76 | 77 | ifndef OCAMLCPFLAGS 78 | OCAMLCPFLAGS := a 79 | endif 80 | export OCAMLCPFLAGS 81 | 82 | ifndef DOC_DIR 83 | DOC_DIR := doc 84 | endif 85 | export DOC_DIR 86 | 87 | export PPFLAGS 88 | 89 | export LFLAGS 90 | export YFLAGS 91 | export IDLFLAGS 92 | 93 | export OCAMLDOCFLAGS 94 | 95 | export OCAMLFIND_INSTFLAGS 96 | 97 | export DVIPSFLAGS 98 | 99 | export STATIC 100 | 101 | # Add a list of optional trash files that should be deleted by "make clean" 102 | export TRASH 103 | 104 | ECHO := echo 105 | 106 | ifdef REALLY_QUIET 107 | export REALLY_QUIET 108 | ECHO := true 109 | LFLAGS := $(LFLAGS) -q 110 | YFLAGS := $(YFLAGS) -q 111 | endif 112 | 113 | #################### variables depending on your OCaml-installation 114 | 115 | SYSTEM := $(shell ocamlc -config 2>/dev/null | grep system | sed 's/system: //') 116 | # This may be 117 | # - mingw 118 | # - mingw64 119 | # - win32 120 | # - cygwin 121 | # - some other string means Unix 122 | # - empty means ocamlc does not support -config 123 | 124 | ifeq ($(SYSTEM),$(filter $(SYSTEM),mingw mingw64)) 125 | MINGW=1 126 | endif 127 | ifeq ($(SYSTEM),win32) 128 | MSVC=1 129 | endif 130 | 131 | ifdef MINGW 132 | export MINGW 133 | WIN32 := 1 134 | # The default value 'cc' makes 'ocamlc -cc "cc"' raises the error 'The 135 | # NTVDM CPU has encountered an illegal instruction'. 136 | ifndef CC 137 | MNO_CYGWIN := $(shell gcc -Wextra -v --help 2>/dev/null | grep -q '\-mno-cygwin'; echo $$?) 138 | CC := gcc 139 | else 140 | MNO_CYGWIN := $(shell $$CC -Wextra -v --help 2>/dev/null | grep -q '\-mno-cygwin'; echo $$?) 141 | endif 142 | # We are compiling with cygwin tools: 143 | ifeq ($(MNO_CYGWIN),0) 144 | CFLAGS_WIN32 := -mno-cygwin 145 | endif 146 | # The OCaml C header files use this flag: 147 | CFLAGS += -D__MINGW32__ 148 | endif 149 | ifdef MSVC 150 | export MSVC 151 | WIN32 := 1 152 | ifndef STATIC 153 | CPPFLAGS_WIN32 := -DCAML_DLL 154 | endif 155 | CFLAGS_WIN32 += -nologo 156 | EXT_OBJ := obj 157 | EXT_LIB := lib 158 | ifeq ($(CC),gcc) 159 | # work around GNU Make default value 160 | ifdef THREADS 161 | CC := cl -MT 162 | else 163 | CC := cl 164 | endif 165 | endif 166 | ifeq ($(CXX),g++) 167 | # work around GNU Make default value 168 | CXX := $(CC) 169 | endif 170 | CFLAG_O := -Fo 171 | endif 172 | ifdef WIN32 173 | EXT_CXX := cpp 174 | EXE := .exe 175 | endif 176 | 177 | ifndef EXT_OBJ 178 | EXT_OBJ := o 179 | endif 180 | ifndef EXT_LIB 181 | EXT_LIB := a 182 | endif 183 | ifndef EXT_CXX 184 | EXT_CXX := cc 185 | endif 186 | ifndef EXE 187 | EXE := # empty 188 | endif 189 | ifndef CFLAG_O 190 | CFLAG_O := -o # do not delete this comment (preserves trailing whitespace)! 191 | endif 192 | 193 | export CC 194 | export CXX 195 | export CFLAGS 196 | export CXXFLAGS 197 | export LDFLAGS 198 | export CPPFLAGS 199 | 200 | ifndef RPATH_FLAG 201 | ifdef ELF_RPATH_FLAG 202 | RPATH_FLAG := $(ELF_RPATH_FLAG) 203 | else 204 | RPATH_FLAG := -R 205 | endif 206 | endif 207 | export RPATH_FLAG 208 | 209 | ifndef MSVC 210 | ifndef PIC_CFLAGS 211 | PIC_CFLAGS := -fPIC 212 | endif 213 | ifndef PIC_CPPFLAGS 214 | PIC_CPPFLAGS := -DPIC 215 | endif 216 | endif 217 | 218 | export PIC_CFLAGS 219 | export PIC_CPPFLAGS 220 | 221 | BCRESULT := $(addsuffix $(BCSUFFIX), $(RESULT)) 222 | NCRESULT := $(addsuffix $(NCSUFFIX), $(RESULT)) 223 | TOPRESULT := $(addsuffix $(TOPSUFFIX), $(RESULT)) 224 | 225 | ifndef OCAMLFIND 226 | OCAMLFIND := ocamlfind 227 | endif 228 | export OCAMLFIND 229 | 230 | ifndef OCAML 231 | OCAML := ocaml 232 | endif 233 | export OCAML 234 | 235 | ifndef OCAMLC 236 | OCAMLC := ocamlc 237 | endif 238 | export OCAMLC 239 | 240 | ifndef OCAMLOPT 241 | OCAMLOPT := ocamlopt 242 | endif 243 | export OCAMLOPT 244 | 245 | ifndef OCAMLMKTOP 246 | OCAMLMKTOP := ocamlmktop 247 | endif 248 | export OCAMLMKTOP 249 | 250 | ifndef OCAMLCP 251 | OCAMLCP := ocamlcp 252 | endif 253 | export OCAMLCP 254 | 255 | ifndef OCAMLDEP 256 | OCAMLDEP := ocamldep 257 | endif 258 | export OCAMLDEP 259 | 260 | ifndef OCAMLLEX 261 | OCAMLLEX := ocamllex 262 | endif 263 | export OCAMLLEX 264 | 265 | ifndef OCAMLYACC 266 | OCAMLYACC := ocamlyacc 267 | endif 268 | export OCAMLYACC 269 | 270 | ifndef OCAMLMKLIB 271 | OCAMLMKLIB := ocamlmklib 272 | endif 273 | export OCAMLMKLIB 274 | 275 | ifndef OCAML_GLADECC 276 | OCAML_GLADECC := lablgladecc2 277 | endif 278 | export OCAML_GLADECC 279 | 280 | ifndef OCAML_GLADECC_FLAGS 281 | OCAML_GLADECC_FLAGS := 282 | endif 283 | export OCAML_GLADECC_FLAGS 284 | 285 | ifndef CAMELEON_REPORT 286 | CAMELEON_REPORT := report 287 | endif 288 | export CAMELEON_REPORT 289 | 290 | ifndef CAMELEON_REPORT_FLAGS 291 | CAMELEON_REPORT_FLAGS := 292 | endif 293 | export CAMELEON_REPORT_FLAGS 294 | 295 | ifndef CAMELEON_ZOGGY 296 | CAMELEON_ZOGGY := camlp4o pa_zog.cma pr_o.cmo 297 | endif 298 | export CAMELEON_ZOGGY 299 | 300 | ifndef CAMELEON_ZOGGY_FLAGS 301 | CAMELEON_ZOGGY_FLAGS := 302 | endif 303 | export CAMELEON_ZOGGY_FLAGS 304 | 305 | ifndef OXRIDL 306 | OXRIDL := oxridl 307 | endif 308 | export OXRIDL 309 | 310 | ifndef CAMLIDL 311 | CAMLIDL := camlidl 312 | endif 313 | export CAMLIDL 314 | 315 | ifndef CAMLIDLDLL 316 | CAMLIDLDLL := camlidldll 317 | endif 318 | export CAMLIDLDLL 319 | 320 | ifndef NOIDLHEADER 321 | MAYBE_IDL_HEADER := -header 322 | endif 323 | export NOIDLHEADER 324 | 325 | export NO_CUSTOM 326 | 327 | ifndef CAMLP4 328 | CAMLP4 := camlp4 329 | endif 330 | export CAMLP4 331 | 332 | ifndef REAL_OCAMLFIND 333 | ifdef PACKS 334 | ifndef CREATE_LIB 335 | ifdef THREADS 336 | PACKS += threads 337 | endif 338 | endif 339 | empty := 340 | space := $(empty) $(empty) 341 | comma := , 342 | ifdef PREDS 343 | PRE_OCAML_FIND_PREDICATES := $(subst $(space),$(comma),$(PREDS)) 344 | PRE_OCAML_FIND_PACKAGES := $(subst $(space),$(comma),$(PACKS)) 345 | OCAML_FIND_PREDICATES := -predicates $(PRE_OCAML_FIND_PREDICATES) 346 | # OCAML_DEP_PREDICATES := -syntax $(PRE_OCAML_FIND_PREDICATES) 347 | OCAML_FIND_PACKAGES := $(OCAML_FIND_PREDICATES) -package $(PRE_OCAML_FIND_PACKAGES) 348 | OCAML_DEP_PACKAGES := $(OCAML_DEP_PREDICATES) -package $(PRE_OCAML_FIND_PACKAGES) 349 | else 350 | OCAML_FIND_PACKAGES := -package $(subst $(space),$(comma),$(PACKS)) 351 | OCAML_DEP_PACKAGES := 352 | endif 353 | OCAML_FIND_LINKPKG := -linkpkg 354 | REAL_OCAMLFIND := $(OCAMLFIND) 355 | endif 356 | endif 357 | 358 | export OCAML_FIND_PACKAGES 359 | export OCAML_DEP_PACKAGES 360 | export OCAML_FIND_LINKPKG 361 | export REAL_OCAMLFIND 362 | 363 | ifndef OCAMLDOC 364 | OCAMLDOC := ocamldoc 365 | endif 366 | export OCAMLDOC 367 | 368 | ifndef LATEX 369 | LATEX := latex 370 | endif 371 | export LATEX 372 | 373 | ifndef DVIPS 374 | DVIPS := dvips 375 | endif 376 | export DVIPS 377 | 378 | ifndef PS2PDF 379 | PS2PDF := ps2pdf 380 | endif 381 | export PS2PDF 382 | 383 | ifndef OCAMLMAKEFILE 384 | OCAMLMAKEFILE := OCamlMakefile 385 | endif 386 | export OCAMLMAKEFILE 387 | 388 | ifndef OCAMLLIBPATH 389 | OCAMLLIBPATH := \ 390 | $(shell $(OCAMLC) 2>/dev/null -where || echo /usr/local/lib/ocaml) 391 | endif 392 | export OCAMLLIBPATH 393 | 394 | ifndef OCAML_LIB_INSTALL 395 | OCAML_LIB_INSTALL := $(OCAMLLIBPATH)/contrib 396 | endif 397 | export OCAML_LIB_INSTALL 398 | 399 | ########################################################################### 400 | 401 | #################### change following sections only if 402 | #################### you know what you are doing! 403 | 404 | # delete target files when a build command fails 405 | .PHONY: .DELETE_ON_ERROR 406 | .DELETE_ON_ERROR: 407 | 408 | # for pedants using "--warn-undefined-variables" 409 | export MAYBE_IDL 410 | export REAL_RESULT 411 | export CAMLIDLFLAGS 412 | export THREAD_FLAG 413 | export RES_CLIB 414 | export MAKEDLL 415 | export ANNOT_FLAG 416 | export C_OXRIDL 417 | export SUBPROJS 418 | export CFLAGS_WIN32 419 | export CPPFLAGS_WIN32 420 | 421 | INCFLAGS := 422 | 423 | SHELL := /bin/sh 424 | 425 | MLDEPDIR := ._d 426 | BCDIDIR := ._bcdi 427 | NCDIDIR := ._ncdi 428 | 429 | FILTER_EXTNS := %.mli %.ml %.mll %.mly %.idl %.oxridl %.c %.m %.$(EXT_CXX) %.rep %.zog %.glade 430 | 431 | FILTERED := $(filter $(FILTER_EXTNS), $(SOURCES)) 432 | SOURCE_DIRS := $(filter-out ./, $(sort $(dir $(FILTERED)))) 433 | 434 | FILTERED_REP := $(filter %.rep, $(FILTERED)) 435 | DEP_REP := $(FILTERED_REP:%.rep=$(MLDEPDIR)/%.d) 436 | AUTO_REP := $(FILTERED_REP:.rep=.ml) 437 | 438 | FILTERED_ZOG := $(filter %.zog, $(FILTERED)) 439 | DEP_ZOG := $(FILTERED_ZOG:%.zog=$(MLDEPDIR)/%.d) 440 | AUTO_ZOG := $(FILTERED_ZOG:.zog=.ml) 441 | 442 | FILTERED_GLADE := $(filter %.glade, $(FILTERED)) 443 | DEP_GLADE := $(FILTERED_GLADE:%.glade=$(MLDEPDIR)/%.d) 444 | AUTO_GLADE := $(FILTERED_GLADE:.glade=.ml) 445 | 446 | FILTERED_ML := $(filter %.ml, $(FILTERED)) 447 | DEP_ML := $(FILTERED_ML:%.ml=$(MLDEPDIR)/%.d) 448 | 449 | FILTERED_MLI := $(filter %.mli, $(FILTERED)) 450 | DEP_MLI := $(FILTERED_MLI:.mli=.di) 451 | 452 | FILTERED_MLL := $(filter %.mll, $(FILTERED)) 453 | DEP_MLL := $(FILTERED_MLL:%.mll=$(MLDEPDIR)/%.d) 454 | AUTO_MLL := $(FILTERED_MLL:.mll=.ml) 455 | 456 | FILTERED_MLY := $(filter %.mly, $(FILTERED)) 457 | DEP_MLY := $(FILTERED_MLY:%.mly=$(MLDEPDIR)/%.d) $(FILTERED_MLY:.mly=.di) 458 | AUTO_MLY := $(FILTERED_MLY:.mly=.mli) $(FILTERED_MLY:.mly=.ml) 459 | 460 | FILTERED_IDL := $(filter %.idl, $(FILTERED)) 461 | DEP_IDL := $(FILTERED_IDL:%.idl=$(MLDEPDIR)/%.d) $(FILTERED_IDL:.idl=.di) 462 | C_IDL := $(FILTERED_IDL:%.idl=%_stubs.c) 463 | ifndef NOIDLHEADER 464 | C_IDL += $(FILTERED_IDL:.idl=.h) 465 | endif 466 | OBJ_C_IDL := $(FILTERED_IDL:%.idl=%_stubs.$(EXT_OBJ)) 467 | AUTO_IDL := $(FILTERED_IDL:.idl=.mli) $(FILTERED_IDL:.idl=.ml) $(C_IDL) 468 | 469 | FILTERED_OXRIDL := $(filter %.oxridl, $(FILTERED)) 470 | DEP_OXRIDL := $(FILTERED_OXRIDL:%.oxridl=$(MLDEPDIR)/%.d) $(FILTERED_OXRIDL:.oxridl=.di) 471 | AUTO_OXRIDL := $(FILTERED_OXRIDL:.oxridl=.mli) $(FILTERED_OXRIDL:.oxridl=.ml) $(C_OXRIDL) 472 | 473 | FILTERED_C_CXX := $(filter %.c %.m %.$(EXT_CXX), $(FILTERED)) 474 | OBJ_C_CXX := $(FILTERED_C_CXX:.c=.$(EXT_OBJ)) 475 | OBJ_C_CXX := $(OBJ_C_CXX:.m=.$(EXT_OBJ)) 476 | OBJ_C_CXX := $(OBJ_C_CXX:.$(EXT_CXX)=.$(EXT_OBJ)) 477 | 478 | PRE_TARGETS += $(AUTO_MLL) $(AUTO_MLY) $(AUTO_IDL) $(AUTO_OXRIDL) $(AUTO_ZOG) $(AUTO_REP) $(AUTO_GLADE) 479 | 480 | ALL_DEPS := $(DEP_ML) $(DEP_MLI) $(DEP_MLL) $(DEP_MLY) $(DEP_IDL) $(DEP_OXRIDL) $(DEP_ZOG) $(DEP_REP) $(DEP_GLADE) 481 | 482 | MLDEPS := $(filter %.d, $(ALL_DEPS)) 483 | MLIDEPS := $(filter %.di, $(ALL_DEPS)) 484 | BCDEPIS := $(MLIDEPS:%.di=$(BCDIDIR)/%.di) 485 | NCDEPIS := $(MLIDEPS:%.di=$(NCDIDIR)/%.di) 486 | 487 | ALLML := $(filter %.mli %.ml %.mll %.mly %.idl %.oxridl %.rep %.zog %.glade, $(FILTERED)) 488 | 489 | IMPLO_INTF := $(ALLML:%.mli=%.mli.__) 490 | IMPLO_INTF := $(foreach file, $(IMPLO_INTF), \ 491 | $(basename $(file)).cmi $(basename $(file)).cmo) 492 | IMPLO_INTF := $(filter-out %.mli.cmo, $(IMPLO_INTF)) 493 | IMPLO_INTF := $(IMPLO_INTF:%.mli.cmi=%.cmi) 494 | 495 | IMPLX_INTF := $(IMPLO_INTF:.cmo=.cmx) 496 | 497 | INTF := $(filter %.cmi, $(IMPLO_INTF)) 498 | IMPL_CMO := $(filter %.cmo, $(IMPLO_INTF)) 499 | IMPL_CMX := $(IMPL_CMO:.cmo=.cmx) 500 | IMPL_ASM := $(IMPL_CMO:.cmo=.asm) 501 | IMPL_S := $(IMPL_CMO:.cmo=.s) 502 | 503 | OBJ_LINK := $(OBJ_C_IDL) $(OBJ_C_CXX) 504 | OBJ_FILES := $(IMPL_CMO:.cmo=.$(EXT_OBJ)) $(OBJ_LINK) 505 | 506 | EXECS := $(addsuffix $(EXE), \ 507 | $(sort $(TOPRESULT) $(BCRESULT) $(NCRESULT))) 508 | ifdef WIN32 509 | EXECS += $(BCRESULT).dll $(NCRESULT).dll 510 | endif 511 | 512 | CLIB_BASE := $(RESULT)$(RES_CLIB_SUF) 513 | ifneq ($(strip $(OBJ_LINK)),) 514 | RES_CLIB := lib$(CLIB_BASE).$(EXT_LIB) 515 | endif 516 | 517 | ifdef WIN32 518 | DLLSONAME := dll$(CLIB_BASE).dll 519 | else 520 | DLLSONAME := dll$(CLIB_BASE).so 521 | endif 522 | 523 | NONEXECS := $(INTF) $(IMPL_CMO) $(IMPL_CMX) $(IMPL_ASM) $(IMPL_S) \ 524 | $(OBJ_FILES) $(PRE_TARGETS) $(BCRESULT).cma $(NCRESULT).cmxa \ 525 | $(NCRESULT).$(EXT_LIB) $(BCRESULT).cmi $(BCRESULT).cmo \ 526 | $(NCRESULT).cmi $(NCRESULT).cmx $(NCRESULT).$(EXT_OBJ) \ 527 | $(RES_CLIB) $(IMPL_CMO:.cmo=.annot) \ 528 | $(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmo $(LIB_PACK_NAME).cmx \ 529 | $(LIB_PACK_NAME).$(EXT_OBJ) 530 | 531 | ifndef STATIC 532 | NONEXECS += $(DLLSONAME) 533 | endif 534 | 535 | ifndef LIBINSTALL_FILES 536 | LIBINSTALL_FILES := $(RESULT).mli $(RESULT).cmi $(RESULT).cma \ 537 | $(RESULT).cmxa $(RESULT).$(EXT_LIB) $(RES_CLIB) 538 | ifndef STATIC 539 | ifneq ($(strip $(OBJ_LINK)),) 540 | LIBINSTALL_FILES += $(DLLSONAME) 541 | endif 542 | endif 543 | endif 544 | 545 | export LIBINSTALL_FILES 546 | 547 | ifdef WIN32 548 | # some extra stuff is created while linking DLLs 549 | NONEXECS += $(BCRESULT).$(EXT_LIB) $(BCRESULT).exp $(NCRESULT).exp $(CLIB_BASE).exp $(CLIB_BASE).lib 550 | endif 551 | 552 | TARGETS := $(EXECS) $(NONEXECS) 553 | 554 | # If there are IDL-files 555 | ifneq ($(strip $(FILTERED_IDL)),) 556 | MAYBE_IDL := -cclib -lcamlidl 557 | endif 558 | 559 | ifdef USE_CAMLP4 560 | CAMLP4PATH := \ 561 | $(shell $(CAMLP4) -where 2>/dev/null || echo /usr/local/lib/camlp4) 562 | INCFLAGS := -I $(CAMLP4PATH) 563 | CINCFLAGS := -I$(CAMLP4PATH) 564 | endif 565 | 566 | INCFLAGS := $(INCFLAGS) $(INCDIRS:%=-I %) $(SOURCE_DIRS:%=-I %) $(OCAML_DEFAULT_DIRS:%=-I %) 567 | CINCFLAGS += $(SOURCE_DIRS:%=-I%) $(INCDIRS:%=-I%) $(OCAML_DEFAULT_DIRS:%=-I%) 568 | 569 | ifndef MSVC 570 | CLIBFLAGS += $(SOURCE_DIRS:%=-L%) $(LIBDIRS:%=-L%) \ 571 | $(EXTLIBDIRS:%=-L%) $(OCAML_DEFAULT_DIRS:%=-L%) 572 | 573 | ifeq ($(ELF_RPATH), yes) 574 | CLIBFLAGS += $(EXTLIBDIRS:%=-Wl,$(RPATH_FLAG)%) 575 | endif 576 | endif 577 | 578 | ifndef PROFILING 579 | INTF_OCAMLC := $(OCAMLC) 580 | else 581 | ifndef THREADS 582 | INTF_OCAMLC := $(OCAMLCP) -p $(OCAMLCPFLAGS) 583 | else 584 | # OCaml does not support profiling byte code 585 | # with threads (yet), therefore we force an error. 586 | ifndef REAL_OCAMLC 587 | $(error Profiling of multithreaded byte code not yet supported by OCaml) 588 | endif 589 | INTF_OCAMLC := $(OCAMLC) 590 | endif 591 | endif 592 | 593 | ifndef MSVC 594 | COMMON_LDFLAGS := $(LDFLAGS:%=-ccopt %) $(SOURCE_DIRS:%=-ccopt -L%) \ 595 | $(LIBDIRS:%=-ccopt -L%) $(EXTLIBDIRS:%=-ccopt -L%) \ 596 | $(EXTLIBDIRS:%=-ccopt -Wl $(OCAML_DEFAULT_DIRS:%=-ccopt -L%)) 597 | 598 | ifeq ($(ELF_RPATH),yes) 599 | COMMON_LDFLAGS += $(EXTLIBDIRS:%=-ccopt -Wl,$(RPATH_FLAG)%) 600 | endif 601 | else 602 | COMMON_LDFLAGS := -ccopt "/link -NODEFAULTLIB:LIBC $(LDFLAGS:%=%) $(SOURCE_DIRS:%=-LIBPATH:%) \ 603 | $(LIBDIRS:%=-LIBPATH:%) $(EXTLIBDIRS:%=-LIBPATH:%) \ 604 | $(OCAML_DEFAULT_DIRS:%=-LIBPATH:%) " 605 | endif 606 | 607 | CLIBS_OPTS := $(CLIBS:%=-cclib -l%) $(CFRAMEWORKS:%=-cclib '-framework %') 608 | ifdef MSVC 609 | ifndef STATIC 610 | # MSVC libraries do not have 'lib' prefix 611 | CLIBS_OPTS := $(CLIBS:%=-cclib %.lib) 612 | endif 613 | endif 614 | 615 | ifneq ($(strip $(OBJ_LINK)),) 616 | ifdef CREATE_LIB 617 | OBJS_LIBS := -cclib -l$(CLIB_BASE) $(CLIBS_OPTS) $(MAYBE_IDL) 618 | else 619 | OBJS_LIBS := $(OBJ_LINK) $(CLIBS_OPTS) $(MAYBE_IDL) 620 | endif 621 | else 622 | OBJS_LIBS := $(CLIBS_OPTS) $(MAYBE_IDL) 623 | endif 624 | 625 | ifdef LIB_PACK_NAME 626 | FOR_PACK_NAME := $(shell echo $(LIB_PACK_NAME) | awk '{print toupper(substr($$0,1,1))substr($$0,2)}') 627 | endif 628 | 629 | # If we have to make byte-code 630 | ifndef REAL_OCAMLC 631 | BYTE_OCAML := y 632 | 633 | # EXTRADEPS is added dependencies we have to insert for all 634 | # executable files we generate. Ideally it should be all of the 635 | # libraries we use, but it's hard to find the ones that get searched on 636 | # the path since I don't know the paths built into the compiler, so 637 | # just include the ones with slashes in their names. 638 | EXTRADEPS := $(addsuffix .cma,$(foreach i,$(LIBS),$(if $(findstring /,$(i)),$(i)))) 639 | 640 | 641 | ifndef LIB_PACK_NAME 642 | SPECIAL_OCAMLFLAGS := $(OCAMLBCFLAGS) 643 | else 644 | SPECIAL_OCAMLFLAGS := -for-pack $(FOR_PACK_NAME) $(OCAMLBCFLAGS) 645 | endif 646 | 647 | REAL_OCAMLC := $(INTF_OCAMLC) 648 | 649 | REAL_IMPL := $(IMPL_CMO) 650 | REAL_IMPL_INTF := $(IMPLO_INTF) 651 | IMPL_SUF := .cmo 652 | 653 | DEPFLAGS := 654 | MAKE_DEPS := $(MLDEPS) $(BCDEPIS) 655 | 656 | ifdef CREATE_LIB 657 | override CFLAGS := $(PIC_CFLAGS) $(CFLAGS) 658 | override CPPFLAGS := $(PIC_CPPFLAGS) $(CPPFLAGS) 659 | ifndef STATIC 660 | ifneq ($(strip $(OBJ_LINK)),) 661 | MAKEDLL := $(DLLSONAME) 662 | ALL_LDFLAGS := -dllib $(DLLSONAME) 663 | endif 664 | endif 665 | endif 666 | 667 | ifndef NO_CUSTOM 668 | ifneq "$(strip $(OBJ_LINK) $(THREADS) $(MAYBE_IDL) $(CLIBS) $(CFRAMEWORKS))" "" 669 | ALL_LDFLAGS += -custom 670 | endif 671 | endif 672 | 673 | ALL_LDFLAGS += $(INCFLAGS) $(OCAMLLDFLAGS) $(OCAMLBLDFLAGS) \ 674 | $(COMMON_LDFLAGS) $(LIBS:%=%.cma) 675 | CAMLIDLDLLFLAGS := 676 | 677 | ifdef THREADS 678 | ifdef VMTHREADS 679 | THREAD_FLAG := -vmthread 680 | else 681 | THREAD_FLAG := -thread 682 | endif 683 | ALL_LDFLAGS := $(THREAD_FLAG) $(ALL_LDFLAGS) 684 | ifndef CREATE_LIB 685 | ifndef REAL_OCAMLFIND 686 | ALL_LDFLAGS := unix.cma threads.cma $(ALL_LDFLAGS) 687 | endif 688 | endif 689 | endif 690 | 691 | # we have to make native-code 692 | else 693 | EXTRADEPS := $(addsuffix .cmxa,$(foreach i,$(LIBS),$(if $(findstring /,$(i)),$(i)))) 694 | ifndef PROFILING 695 | SPECIAL_OCAMLFLAGS := $(OCAMLNCFLAGS) 696 | PLDFLAGS := 697 | else 698 | SPECIAL_OCAMLFLAGS := -p $(OCAMLNCFLAGS) 699 | PLDFLAGS := -p 700 | endif 701 | 702 | ifndef LIB_PACK_NAME 703 | SPECIAL_OCAMLFLAGS := $(OCAMLNCFLAGS) 704 | else 705 | SPECIAL_OCAMLFLAGS := -for-pack $(FOR_PACK_NAME) $(OCAMLNCFLAGS) 706 | endif 707 | REAL_IMPL := $(IMPL_CMX) 708 | REAL_IMPL_INTF := $(IMPLX_INTF) 709 | IMPL_SUF := .cmx 710 | 711 | override CPPFLAGS := -DNATIVE_CODE $(CPPFLAGS) 712 | 713 | DEPFLAGS := -native 714 | MAKE_DEPS := $(MLDEPS) $(NCDEPIS) 715 | 716 | ALL_LDFLAGS := $(PLDFLAGS) $(INCFLAGS) $(OCAMLLDFLAGS) \ 717 | $(OCAMLNLDFLAGS) $(COMMON_LDFLAGS) 718 | CAMLIDLDLLFLAGS := -opt 719 | 720 | ifndef CREATE_LIB 721 | ALL_LDFLAGS += $(LIBS:%=%.cmxa) 722 | else 723 | override CFLAGS := $(PIC_CFLAGS) $(CFLAGS) 724 | override CPPFLAGS := $(PIC_CPPFLAGS) $(CPPFLAGS) 725 | endif 726 | 727 | ifdef THREADS 728 | THREAD_FLAG := -thread 729 | ALL_LDFLAGS := $(THREAD_FLAG) $(ALL_LDFLAGS) 730 | ifndef CREATE_LIB 731 | ifndef REAL_OCAMLFIND 732 | ALL_LDFLAGS := unix.cmxa threads.cmxa $(ALL_LDFLAGS) 733 | endif 734 | endif 735 | endif 736 | endif 737 | 738 | export MAKE_DEPS 739 | 740 | ifdef ANNOTATE 741 | ANNOT_FLAG := -annot -bin-annot 742 | else 743 | endif 744 | 745 | ALL_OCAMLCFLAGS := $(THREAD_FLAG) $(ANNOT_FLAG) $(OCAMLFLAGS) \ 746 | $(INCFLAGS) $(SPECIAL_OCAMLFLAGS) 747 | 748 | ifdef make_deps 749 | -include $(MAKE_DEPS) 750 | PRE_TARGETS := 751 | endif 752 | 753 | ########################################################################### 754 | # USER RULES 755 | 756 | # Call "OCamlMakefile QUIET=" to get rid of all of the @'s. 757 | QUIET=@ 758 | 759 | # generates byte-code (default) 760 | byte-code: $(PRE_TARGETS) 761 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT) \ 762 | REAL_RESULT="$(BCRESULT)" make_deps=yes 763 | bc: byte-code 764 | 765 | byte-code-nolink: $(PRE_TARGETS) 766 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ 767 | REAL_RESULT="$(BCRESULT)" make_deps=yes 768 | bcnl: byte-code-nolink 769 | 770 | top: $(PRE_TARGETS) 771 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(TOPRESULT) \ 772 | REAL_RESULT="$(BCRESULT)" make_deps=yes 773 | 774 | # generates native-code 775 | 776 | native-code: $(PRE_TARGETS) 777 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(NCRESULT) \ 778 | REAL_RESULT="$(NCRESULT)" \ 779 | REAL_OCAMLC="$(OCAMLOPT)" \ 780 | make_deps=yes 781 | nc: native-code 782 | 783 | native-code-nolink: $(PRE_TARGETS) 784 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ 785 | REAL_RESULT="$(NCRESULT)" \ 786 | REAL_OCAMLC="$(OCAMLOPT)" \ 787 | make_deps=yes 788 | ncnl: native-code-nolink 789 | 790 | # generates byte-code libraries 791 | byte-code-library: $(PRE_TARGETS) 792 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ 793 | $(RES_CLIB) $(BCRESULT).cma \ 794 | REAL_RESULT="$(BCRESULT)" \ 795 | CREATE_LIB=yes \ 796 | make_deps=yes 797 | bcl: byte-code-library 798 | 799 | # generates native-code libraries 800 | native-code-library: $(PRE_TARGETS) 801 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ 802 | $(RES_CLIB) $(NCRESULT).cmxa \ 803 | REAL_RESULT="$(NCRESULT)" \ 804 | REAL_OCAMLC="$(OCAMLOPT)" \ 805 | CREATE_LIB=yes \ 806 | make_deps=yes 807 | ncl: native-code-library 808 | 809 | ifdef WIN32 810 | # generates byte-code dll 811 | byte-code-dll: $(PRE_TARGETS) 812 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ 813 | $(RES_CLIB) $(BCRESULT).dll \ 814 | REAL_RESULT="$(BCRESULT)" \ 815 | make_deps=yes 816 | bcd: byte-code-dll 817 | 818 | # generates native-code dll 819 | native-code-dll: $(PRE_TARGETS) 820 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ 821 | $(RES_CLIB) $(NCRESULT).dll \ 822 | REAL_RESULT="$(NCRESULT)" \ 823 | REAL_OCAMLC="$(OCAMLOPT)" \ 824 | make_deps=yes 825 | ncd: native-code-dll 826 | endif 827 | 828 | # generates byte-code with debugging information 829 | debug-code: $(PRE_TARGETS) 830 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT) \ 831 | REAL_RESULT="$(BCRESULT)" make_deps=yes \ 832 | OCAMLFLAGS="-g $(OCAMLFLAGS)" \ 833 | OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" 834 | dc: debug-code 835 | 836 | debug-code-nolink: $(PRE_TARGETS) 837 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ 838 | REAL_RESULT="$(BCRESULT)" make_deps=yes \ 839 | OCAMLFLAGS="-g $(OCAMLFLAGS)" \ 840 | OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" 841 | dcnl: debug-code-nolink 842 | 843 | # generates byte-code with debugging information (native code) 844 | debug-native-code: $(PRE_TARGETS) 845 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(NCRESULT) \ 846 | REAL_RESULT="$(NCRESULT)" make_deps=yes \ 847 | REAL_OCAMLC="$(OCAMLOPT)" \ 848 | OCAMLFLAGS="-g $(OCAMLFLAGS)" \ 849 | OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" 850 | dnc: debug-native-code 851 | 852 | debug-native-code-nolink: $(PRE_TARGETS) 853 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) nolink \ 854 | REAL_RESULT="$(NCRESULT)" make_deps=yes \ 855 | REAL_OCAMLC="$(OCAMLOPT)" \ 856 | OCAMLFLAGS="-g $(OCAMLFLAGS)" \ 857 | OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" 858 | dncnl: debug-native-code-nolink 859 | 860 | # generates byte-code libraries with debugging information 861 | debug-code-library: $(PRE_TARGETS) 862 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ 863 | $(RES_CLIB) $(BCRESULT).cma \ 864 | REAL_RESULT="$(BCRESULT)" make_deps=yes \ 865 | CREATE_LIB=yes \ 866 | OCAMLFLAGS="-g $(OCAMLFLAGS)" \ 867 | OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" 868 | dcl: debug-code-library 869 | 870 | # generates byte-code libraries with debugging information (native code) 871 | debug-native-code-library: $(PRE_TARGETS) 872 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ 873 | $(RES_CLIB) $(NCRESULT).cmxa \ 874 | REAL_RESULT="$(NCRESULT)" make_deps=yes \ 875 | REAL_OCAMLC="$(OCAMLOPT)" \ 876 | CREATE_LIB=yes \ 877 | OCAMLFLAGS="-g $(OCAMLFLAGS)" \ 878 | OCAMLLDFLAGS="-g $(OCAMLLDFLAGS)" 879 | dncl: debug-native-code-library 880 | 881 | # generates byte-code for profiling 882 | profiling-byte-code: $(PRE_TARGETS) 883 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT) \ 884 | REAL_RESULT="$(BCRESULT)" PROFILING="y" \ 885 | make_deps=yes 886 | pbc: profiling-byte-code 887 | 888 | # generates native-code 889 | 890 | profiling-native-code: $(PRE_TARGETS) 891 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(NCRESULT) \ 892 | REAL_RESULT="$(NCRESULT)" \ 893 | REAL_OCAMLC="$(OCAMLOPT)" \ 894 | PROFILING="y" \ 895 | make_deps=yes 896 | pnc: profiling-native-code 897 | 898 | # generates byte-code libraries 899 | profiling-byte-code-library: $(PRE_TARGETS) 900 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ 901 | $(RES_CLIB) $(BCRESULT).cma \ 902 | REAL_RESULT="$(BCRESULT)" PROFILING="y" \ 903 | CREATE_LIB=yes \ 904 | make_deps=yes 905 | pbcl: profiling-byte-code-library 906 | 907 | # generates native-code libraries 908 | profiling-native-code-library: $(PRE_TARGETS) 909 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ 910 | $(RES_CLIB) $(NCRESULT).cmxa \ 911 | REAL_RESULT="$(NCRESULT)" PROFILING="y" \ 912 | REAL_OCAMLC="$(OCAMLOPT)" \ 913 | CREATE_LIB=yes \ 914 | make_deps=yes 915 | pncl: profiling-native-code-library 916 | 917 | # packs byte-code objects 918 | pack-byte-code: $(PRE_TARGETS) 919 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(BCRESULT).cmo \ 920 | REAL_RESULT="$(BCRESULT)" \ 921 | PACK_LIB=yes make_deps=yes 922 | pabc: pack-byte-code 923 | 924 | # packs native-code objects 925 | pack-native-code: $(PRE_TARGETS) 926 | $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \ 927 | $(NCRESULT).cmx $(NCRESULT).$(EXT_OBJ) \ 928 | REAL_RESULT="$(NCRESULT)" \ 929 | REAL_OCAMLC="$(OCAMLOPT)" \ 930 | PACK_LIB=yes make_deps=yes 931 | panc: pack-native-code 932 | 933 | # generates HTML-documentation 934 | htdoc: $(DOC_DIR)/$(RESULT)/html/index.html 935 | 936 | # generates Latex-documentation 937 | ladoc: $(DOC_DIR)/$(RESULT)/latex/doc.tex 938 | 939 | # generates PostScript-documentation 940 | psdoc: $(DOC_DIR)/$(RESULT)/latex/doc.ps 941 | 942 | # generates PDF-documentation 943 | pdfdoc: $(DOC_DIR)/$(RESULT)/latex/doc.pdf 944 | 945 | # generates all supported forms of documentation 946 | doc: htdoc ladoc psdoc pdfdoc 947 | 948 | ########################################################################### 949 | # LOW LEVEL RULES 950 | 951 | $(REAL_RESULT): $(REAL_IMPL_INTF) $(OBJ_LINK) $(EXTRADEPS) $(RESULTDEPS) 952 | $(REAL_OCAMLFIND) $(REAL_OCAMLC) \ 953 | $(OCAML_FIND_PACKAGES) $(OCAML_FIND_LINKPKG) \ 954 | $(OBJS_LIBS) $(ALL_LDFLAGS) -o $@$(EXE) \ 955 | $(REAL_IMPL) 956 | 957 | nolink: $(REAL_IMPL_INTF) $(OBJ_LINK) 958 | 959 | ifdef WIN32 960 | $(REAL_RESULT).dll: $(REAL_IMPL_INTF) $(OBJ_LINK) 961 | $(CAMLIDLDLL) $(CAMLIDLDLLFLAGS) $(OBJ_LINK) $(CLIBS) \ 962 | -o $@ $(REAL_IMPL) 963 | endif 964 | 965 | %$(TOPSUFFIX): $(REAL_IMPL_INTF) $(OBJ_LINK) $(EXTRADEPS) 966 | $(REAL_OCAMLFIND) $(OCAMLMKTOP) \ 967 | $(OCAML_FIND_PACKAGES) $(OCAML_FIND_LINKPKG) \ 968 | $(OBJS_LIBS) $(ALL_LDFLAGS) -o $@$(EXE) \ 969 | $(REAL_IMPL) 970 | 971 | .SUFFIXES: .mli .ml .cmi .cmo .cmx .cma .cmxa .$(EXT_OBJ) \ 972 | .mly .di .d .$(EXT_LIB) .idl %.oxridl .c .m .$(EXT_CXX) .h .so \ 973 | .rep .zog .glade 974 | 975 | ifndef STATIC 976 | ifdef MINGW 977 | # From OCaml 3.11.0, ocamlmklib is available on windows 978 | OCAMLMLIB_EXISTS = $(shell which $(OCAMLMKLIB)) 979 | ifeq ($(strip $(OCAMLMLIB_EXISTS)),) 980 | $(DLLSONAME): $(OBJ_LINK) 981 | $(CC) $(CFLAGS) $(CFLAGS_WIN32) $(OBJ_LINK) -shared -o $@ \ 982 | $(wildcard $(foreach dir,$(LIBDIRS),$(CLIBS:%=$(dir)/lib%.a))) \ 983 | '$(OCAMLLIBPATH)/ocamlrun.a' \ 984 | -Wl,--whole-archive \ 985 | -Wl,--export-all-symbols \ 986 | -Wl,--allow-multiple-definition \ 987 | -Wl,--enable-auto-import 988 | else 989 | $(DLLSONAME): $(OBJ_LINK) 990 | $(OCAMLMKLIB) $(INCFLAGS) $(CLIBFLAGS) \ 991 | -o $(CLIB_BASE) $(OBJ_LINK) $(CLIBS:%=-l%) \ 992 | $(CFRAMEWORKS:%=-framework %) \ 993 | $(OCAMLMKLIB_FLAGS) 994 | endif 995 | else 996 | ifdef MSVC 997 | $(DLLSONAME): $(OBJ_LINK) 998 | link /NOLOGO /DLL /OUT:$@ $(OBJ_LINK) \ 999 | $(wildcard $(foreach dir,$(LIBDIRS),$(CLIBS:%=$(dir)/%.lib))) \ 1000 | '$(OCAMLLIBPATH)/ocamlrun.lib' 1001 | 1002 | else 1003 | $(DLLSONAME): $(OBJ_LINK) 1004 | $(OCAMLMKLIB) $(INCFLAGS) $(CLIBFLAGS) \ 1005 | -o $(CLIB_BASE) $(OBJ_LINK) $(CLIBS:%=-l%) $(CFRAMEWORKS:%=-framework %) \ 1006 | $(OCAMLMKLIB_FLAGS) 1007 | endif 1008 | endif 1009 | endif 1010 | 1011 | ifndef LIB_PACK_NAME 1012 | $(RESULT).cma: $(REAL_IMPL_INTF) $(MAKEDLL) $(EXTRADEPS) $(RESULTDEPS) 1013 | $(REAL_OCAMLFIND) $(REAL_OCAMLC) -a $(OBJS_LIBS) $(ALL_LDFLAGS) -o $@ $(REAL_IMPL) 1014 | 1015 | $(RESULT).cmxa $(RESULT).$(EXT_LIB): $(REAL_IMPL_INTF) $(EXTRADEPS) $(RESULTDEPS) 1016 | $(REAL_OCAMLFIND) $(OCAMLOPT) -a $(OBJS_LIBS) $(ALL_LDFLAGS) -o $@ $(REAL_IMPL) 1017 | else 1018 | # Packing a bytecode library 1019 | LIB_PACK_NAME_MLI = $(wildcard $(LIB_PACK_NAME).mli) 1020 | ifeq ($(LIB_PACK_NAME_MLI),) 1021 | LIB_PACK_NAME_CMI = $(LIB_PACK_NAME).cmi 1022 | else 1023 | # $(LIB_PACK_NAME).mli exists, it likely depends on other compiled interfaces 1024 | LIB_PACK_NAME_CMI = 1025 | $(LIB_PACK_NAME).cmi: $(REAL_IMPL_INTF) 1026 | endif 1027 | ifdef BYTE_OCAML 1028 | $(LIB_PACK_NAME_CMI) $(LIB_PACK_NAME).cmo: $(REAL_IMPL_INTF) 1029 | $(REAL_OCAMLFIND) $(REAL_OCAMLC) -pack -o $(LIB_PACK_NAME).cmo $(OCAMLLDFLAGS) $(REAL_IMPL) 1030 | # Packing into a unit which can be transformed into a library 1031 | # Remember the .ml's must have been compiled with -for-pack $(LIB_PACK_NAME) 1032 | else 1033 | $(LIB_PACK_NAME_CMI) $(LIB_PACK_NAME).cmx: $(REAL_IMPL_INTF) 1034 | $(REAL_OCAMLFIND) $(OCAMLOPT) -pack -o $(LIB_PACK_NAME).cmx $(OCAMLLDFLAGS) $(REAL_IMPL) 1035 | endif 1036 | 1037 | $(RESULT).cma: $(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmo $(MAKEDLL) $(EXTRADEPS) $(RESULTDEPS) 1038 | $(REAL_OCAMLFIND) $(REAL_OCAMLC) -a $(OBJS_LIBS) $(ALL_LDFLAGS) -o $@ $(LIB_PACK_NAME).cmo 1039 | 1040 | $(RESULT).cmxa $(RESULT).$(EXT_LIB): $(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmx $(EXTRADEPS) $(RESULTDEPS) 1041 | $(REAL_OCAMLFIND) $(OCAMLOPT) -a $(OBJS_LIBS) $(filter-out -custom, $(ALL_LDFLAGS)) -o $@ $(LIB_PACK_NAME).cmx 1042 | endif 1043 | 1044 | $(RES_CLIB): $(OBJ_LINK) 1045 | ifndef MSVC 1046 | ifneq ($(strip $(OBJ_LINK)),) 1047 | $(AR) rcs $@ $(OBJ_LINK) 1048 | endif 1049 | else 1050 | ifneq ($(strip $(OBJ_LINK)),) 1051 | lib -nologo -debugtype:cv -out:$(RES_CLIB) $(OBJ_LINK) 1052 | endif 1053 | endif 1054 | 1055 | %.cmi: %.mli $(EXTRADEPS) 1056 | $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ 1057 | if [ -z "$$pp" ]; then \ 1058 | $(ECHO) $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ 1059 | -c $(THREAD_FLAG) $(ANNOT_FLAG) \ 1060 | $(OCAMLFLAGS) $(INCFLAGS) $<; \ 1061 | $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ 1062 | -c $(THREAD_FLAG) $(ANNOT_FLAG) \ 1063 | $(OCAMLFLAGS) $(INCFLAGS) $<; \ 1064 | else \ 1065 | $(ECHO) $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ 1066 | -c -pp \"$$pp $(PPFLAGS)\" $(THREAD_FLAG) $(ANNOT_FLAG) \ 1067 | $(OCAMLFLAGS) $(INCFLAGS) $<; \ 1068 | $(REAL_OCAMLFIND) $(INTF_OCAMLC) $(OCAML_FIND_PACKAGES) \ 1069 | -c -pp "$$pp $(PPFLAGS)" $(THREAD_FLAG) $(ANNOT_FLAG) \ 1070 | $(OCAMLFLAGS) $(INCFLAGS) $<; \ 1071 | fi 1072 | 1073 | %.cmi: %$(IMPL_SUF); 1074 | 1075 | %$(IMPL_SUF) %.$(EXT_OBJ): %.ml $(EXTRADEPS) 1076 | $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ 1077 | if [ -z "$$pp" ]; then \ 1078 | $(ECHO) $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ 1079 | -c $(ALL_OCAMLCFLAGS) $<; \ 1080 | $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ 1081 | -c $(ALL_OCAMLCFLAGS) $<; \ 1082 | else \ 1083 | $(ECHO) $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ 1084 | -c -pp \"$$pp $(PPFLAGS)\" $(ALL_OCAMLCFLAGS) $<; \ 1085 | $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(OCAML_FIND_PACKAGES) \ 1086 | -c -pp "$$pp $(PPFLAGS)" $(ALL_OCAMLCFLAGS) $<; \ 1087 | fi 1088 | 1089 | .PRECIOUS: %.ml 1090 | %.ml: %.mll 1091 | $(OCAMLLEX) $(LFLAGS) $< 1092 | 1093 | .PRECIOUS: %.ml %.mli 1094 | %.ml %.mli: %.mly 1095 | $(OCAMLYACC) $(YFLAGS) $< 1096 | $(QUIET)pp=`sed -n -e 's/.*(\*pp \([^*]*\) \*).*/\1/p;q' $<`; \ 1097 | if [ ! -z "$$pp" ]; then \ 1098 | mv $*.ml $*.ml.temporary; \ 1099 | echo "(*pp $$pp $(PPFLAGS)*)" > $*.ml; \ 1100 | cat $*.ml.temporary >> $*.ml; \ 1101 | rm $*.ml.temporary; \ 1102 | mv $*.mli $*.mli.temporary; \ 1103 | echo "(*pp $$pp $(PPFLAGS)*)" > $*.mli; \ 1104 | cat $*.mli.temporary >> $*.mli; \ 1105 | rm $*.mli.temporary; \ 1106 | fi 1107 | 1108 | 1109 | .PRECIOUS: %.ml 1110 | %.ml: %.rep 1111 | $(CAMELEON_REPORT) $(CAMELEON_REPORT_FLAGS) -gen $< 1112 | 1113 | .PRECIOUS: %.ml 1114 | %.ml: %.zog 1115 | $(CAMELEON_ZOGGY) $(CAMELEON_ZOGGY_FLAGS) -impl $< > $@ 1116 | 1117 | .PRECIOUS: %.ml 1118 | %.ml: %.glade 1119 | $(OCAML_GLADECC) $(OCAML_GLADECC_FLAGS) $< > $@ 1120 | 1121 | .PRECIOUS: %.ml %.mli 1122 | %.ml %.mli: %.oxridl 1123 | $(OXRIDL) $< 1124 | 1125 | .PRECIOUS: %.ml %.mli %_stubs.c %.h 1126 | %.ml %.mli %_stubs.c %.h: %.idl 1127 | $(CAMLIDL) $(MAYBE_IDL_HEADER) $(IDLFLAGS) \ 1128 | $(CAMLIDLFLAGS) $< 1129 | $(QUIET)if [ $(NOIDLHEADER) ]; then touch $*.h; fi 1130 | 1131 | %.$(EXT_OBJ): %.c 1132 | $(REAL_OCAMLFIND) $(REAL_OCAMLC) $(THREAD_FLAG) $(OCAML_FIND_PACKAGES) \ 1133 | -c -cc "$(CC)" $(INCFLAGS) -ccopt "$(CFLAGS) \ 1134 | $(CPPFLAGS) $(CPPFLAGS_WIN32) \ 1135 | $(CFLAGS_WIN32) $(CINCFLAGS) $(CFLAG_O)$@ " $< 1136 | 1137 | %.$(EXT_OBJ): %.m 1138 | $(CC) -c $(CFLAGS) $(CINCFLAGS) $(CPPFLAGS) \ 1139 | -I'$(OCAMLLIBPATH)' \ 1140 | $< $(CFLAG_O)$@ 1141 | 1142 | %.$(EXT_OBJ): %.$(EXT_CXX) 1143 | $(CXX) -c $(CXXFLAGS) $(CINCFLAGS) $(CPPFLAGS) \ 1144 | -I'$(OCAMLLIBPATH)' \ 1145 | $< $(CFLAG_O)$@ 1146 | 1147 | $(MLDEPDIR)/%.d: %.ml 1148 | $(QUIET)if [ ! -d $(@D) ]; then mkdir -p $(@D); fi 1149 | $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ 1150 | if [ -z "$$pp" ]; then \ 1151 | $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_DEP_PACKAGES) \ 1152 | $(INCFLAGS) $< \> $@; \ 1153 | $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_DEP_PACKAGES) \ 1154 | $(INCFLAGS) $< > $@; \ 1155 | else \ 1156 | $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_DEP_PACKAGES) \ 1157 | -pp \"$$pp $(PPFLAGS)\" $(INCFLAGS) $< \> $@; \ 1158 | $(REAL_OCAMLFIND) $(OCAMLDEP) $(OCAML_DEP_PACKAGES) \ 1159 | -pp "$$pp $(PPFLAGS)" $(INCFLAGS) $< > $@; \ 1160 | fi 1161 | 1162 | $(BCDIDIR)/%.di $(NCDIDIR)/%.di: %.mli 1163 | $(QUIET)if [ ! -d $(@D) ]; then mkdir -p $(@D); fi 1164 | $(QUIET)pp=`sed -n -e '/^#/d' -e 's/(\*pp \([^*]*\) \*)/\1/p;q' $<`; \ 1165 | if [ -z "$$pp" ]; then \ 1166 | $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) $(INCFLAGS) $< \> $@; \ 1167 | $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) $(INCFLAGS) $< > $@; \ 1168 | else \ 1169 | $(ECHO) $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) \ 1170 | -pp \"$$pp $(PPFLAGS)\" $(INCFLAGS) $< \> $@; \ 1171 | $(REAL_OCAMLFIND) $(OCAMLDEP) $(DEPFLAGS) \ 1172 | -pp "$$pp $(PPFLAGS)" $(INCFLAGS) $< > $@; \ 1173 | fi 1174 | 1175 | $(DOC_DIR)/$(RESULT)/html: 1176 | mkdir -p $@ 1177 | 1178 | $(DOC_DIR)/$(RESULT)/html/index.html: $(DOC_DIR)/$(RESULT)/html $(DOC_FILES) 1179 | rm -rf $ 2 | #include 3 | #include 4 | 5 | #include "cpdflibwrapper.h" 6 | 7 | /* CHAPTER 0. Preliminaries */ 8 | 9 | int pycpdf_startup(char **argv) { 10 | // char *argv[] = {"program_name", NULL}; 11 | cpdf_startup(argv); 12 | return 0; 13 | } 14 | 15 | char* pycpdf_version() { 16 | return cpdf_version(); 17 | } 18 | 19 | void pycpdf_setFast() { 20 | return cpdf_setFast(); 21 | } 22 | 23 | void pycpdf_setSlow() { 24 | return cpdf_setSlow(); 25 | } 26 | 27 | void pycpdf_embedStd14(int embed) { 28 | return cpdf_embedStd14(embed); 29 | } 30 | 31 | void pycpdf_embedStd14Dir(char* d) { 32 | return cpdf_embedStd14Dir(d); 33 | } 34 | 35 | void pycpdf_JSONUTF8(int utf8) { 36 | return cpdf_JSONUTF8(utf8); 37 | } 38 | 39 | 40 | int pycpdf_lastError(void) { 41 | return cpdf_lastError; 42 | } 43 | 44 | char *pycpdf_lastErrorString(void) { 45 | // printf("cpdf_lastErrorString is %s\n", cpdf_lastErrorString); 46 | return cpdf_lastErrorString; 47 | } 48 | 49 | void pycpdf_clearError(void) { 50 | cpdf_clearError(); 51 | cpdf_lastError = 0; 52 | cpdf_lastErrorString = ""; 53 | // printf("after clearerror, cpdf_lastErrorString is %s\n", 54 | // cpdf_lastErrorString); 55 | return; 56 | } 57 | 58 | void pycpdf_onExit() { 59 | return cpdf_onExit(); 60 | } 61 | 62 | 63 | /* CHAPTER 1. Basics */ 64 | 65 | int pycpdf_fromFile(char *filename, char *userpw) { 66 | return cpdf_fromFile(filename, userpw); 67 | } 68 | 69 | int pycpdf_fromFileLazy(char *filename, char *userpw) { 70 | return cpdf_fromFileLazy(filename, userpw); 71 | } 72 | 73 | int pycpdf_fromMemory(void *data, int len, char *userpw) { 74 | return cpdf_fromMemory(data, len, userpw); 75 | } 76 | 77 | int pycpdf_fromMemoryLazy(void *data, int len, char *userpw) { 78 | return cpdf_fromMemoryLazy(data, len, userpw); 79 | } 80 | 81 | void pycpdf_deletePdf(int pdf) { 82 | return cpdf_deletePdf(pdf); 83 | } 84 | 85 | void pycpdf_replacePdf(int pdf, int pdf2) { 86 | return cpdf_replacePdf(pdf, pdf2); 87 | } 88 | 89 | double pycpdf_ptOfCm(double i) { 90 | return cpdf_ptOfCm(i); 91 | } 92 | 93 | double pycpdf_ptOfMm(double i) { 94 | return cpdf_ptOfMm(i); 95 | } 96 | 97 | double pycpdf_ptOfIn(double i) { 98 | return cpdf_ptOfIn(i); 99 | } 100 | 101 | double pycpdf_cmOfPt(double i) { 102 | return cpdf_cmOfPt(i); 103 | } 104 | 105 | double pycpdf_mmOfPt(double i) { 106 | return cpdf_mmOfPt(i); 107 | } 108 | 109 | double pycpdf_inOfPt(double i) { 110 | return cpdf_inOfPt(i); 111 | } 112 | 113 | void pycpdf_startEnumeratePDFs() { 114 | return cpdf_startEnumeratePDFs(); 115 | } 116 | 117 | int pycpdf_enumeratePDFsKey(int n) { 118 | return cpdf_enumeratePDFsKey(n); 119 | } 120 | 121 | char* pycpdf_enumeratePDFsInfo(int n) { 122 | return cpdf_enumeratePDFsInfo(n); 123 | } 124 | 125 | void pycpdf_endEnumeratePDFs() { 126 | return cpdf_endEnumeratePDFs(); 127 | } 128 | 129 | int pycpdf_parsePagespec(int pdf, char *pagespec) { 130 | return cpdf_parsePagespec(pdf, pagespec); 131 | } 132 | 133 | int pycpdf_validatePagespec(char *pagespec) { 134 | return cpdf_validatePagespec(pagespec); 135 | } 136 | 137 | char* pycpdf_stringOfPagespec(int pdf, int range) { 138 | return cpdf_stringOfPagespec(pdf, range); 139 | } 140 | 141 | int pycpdf_blankRange() { 142 | return cpdf_blankRange(); 143 | } 144 | 145 | void pycpdf_deleteRange(int r) { 146 | return cpdf_deleteRange(r); 147 | } 148 | 149 | 150 | int pycpdf_pageRange(int f, int t) { return cpdf_range(f, t); } 151 | 152 | int pycpdf_all(int r) { 153 | return cpdf_all(r); 154 | } 155 | 156 | int pycpdf_even(int r) { 157 | return cpdf_even(r); 158 | } 159 | 160 | int pycpdf_odd(int r) { 161 | return cpdf_odd(r); 162 | } 163 | 164 | int pycpdf_rangeUnion(int a, int b) { 165 | return cpdf_rangeUnion(a, b); 166 | } 167 | 168 | int pycpdf_difference(int a, int b) { 169 | return cpdf_difference(a, b); 170 | } 171 | 172 | int pycpdf_removeDuplicates(int r) { 173 | return cpdf_removeDuplicates(r); 174 | } 175 | 176 | int pycpdf_rangeLength(int r) { 177 | return cpdf_rangeLength(r); 178 | } 179 | 180 | int pycpdf_rangeGet(int r, int n) { 181 | return cpdf_rangeGet(r, n); 182 | } 183 | 184 | int pycpdf_rangeAdd(int r, int p) { 185 | return cpdf_rangeAdd(r, p); 186 | } 187 | 188 | int pycpdf_isInRange(int r, int p) { 189 | return cpdf_isInRange(r, p); 190 | } 191 | 192 | int pycpdf_pages(int pdf) { 193 | return cpdf_pages(pdf); 194 | } 195 | 196 | int pycpdf_pagesFast(char *filename, char *userpw) { 197 | return cpdf_pagesFast(filename, userpw); 198 | } 199 | 200 | void pycpdf_toFile(int pdf, char *filename, int linearize, int make_id) { 201 | return cpdf_toFile(pdf, filename, linearize, make_id); 202 | } 203 | 204 | void pycpdf_toFileExt(int pdf, char *filename, int linearize, int make_id, int preserve_objstm, int generate_objstm, int compress_objstm) { 205 | return cpdf_toFileExt(pdf, filename, linearize, make_id, preserve_objstm, generate_objstm, compress_objstm); 206 | } 207 | 208 | 209 | // We want to return a piece of memory which will be copied into a python 210 | // string, and the C string deallocated. 211 | void *toMemoryData; 212 | 213 | void *pycpdf_toMemory(int pdf, int linearize, int make_id, int *length) { 214 | toMemoryData = cpdf_toMemory(pdf, linearize, make_id, length); 215 | return toMemoryData; 216 | } 217 | 218 | void pycpdf_toMemoryFree(void) { 219 | free(toMemoryData); 220 | return; 221 | } 222 | 223 | int pycpdf_isEncrypted(int pdf) { 224 | return cpdf_isEncrypted(pdf); 225 | } 226 | 227 | void pycpdf_toFileEncrypted(int pdf, int method, int *permissions, int permlength, char *ownerpw, char *userpw, int linearize, int makeid, char *filename) { 228 | return cpdf_toFileEncrypted(pdf, method, permissions, permlength, ownerpw, userpw, linearize, makeid, filename); 229 | } 230 | 231 | void pycpdf_toFileEncryptedExt(int pdf, int method, int *permissions, int permlength, char *ownerpw, char *userpw, int linearize, int makeid, int preserve_objstm, int generate_objstm, int compress_objstm, char *filename) { 232 | return cpdf_toFileEncryptedExt(pdf, method, permissions, permlength, ownerpw, userpw, linearize, makeid, preserve_objstm, generate_objstm, compress_objstm, filename); 233 | } 234 | 235 | void pycpdf_decryptPdf(int pdf, char *userpw) { 236 | return cpdf_decryptPdf(pdf, userpw); 237 | } 238 | 239 | void pycpdf_decryptPdfOwner(int pdf, char *ownerpw) { 240 | return cpdf_decryptPdfOwner(pdf, ownerpw); 241 | } 242 | 243 | int pycpdf_hasPermission(int pdf, int perm) { 244 | return cpdf_hasPermission(pdf, perm); 245 | } 246 | 247 | int pycpdf_encryptionKind(int pdf) { 248 | return cpdf_encryptionKind(pdf); 249 | } 250 | 251 | void pycpdf_loadFont(char* name, char* filename) { 252 | return cpdf_loadFont(name, filename); 253 | } 254 | 255 | 256 | /* CHAPTER 2. Merging and Splitting */ 257 | 258 | int pycpdf_mergeSimple(int *pdfs, int len) { 259 | return cpdf_mergeSimple(pdfs, len); 260 | } 261 | 262 | int pycpdf_merge(int *pdfs, int len, int retain_numbering, int remove_duplicate_fonts) { 263 | return cpdf_merge(pdfs, len, retain_numbering, remove_duplicate_fonts); 264 | } 265 | 266 | int pycpdf_mergeSame(int *pdfs, int len, int retain_numbering, int remove_duplicate_fonts, int *ranges) { 267 | return cpdf_mergeSame(pdfs, len, retain_numbering, remove_duplicate_fonts, ranges); 268 | } 269 | 270 | int pycpdf_selectPages(int pdf, int r) { 271 | return cpdf_selectPages(pdf, r); 272 | } 273 | 274 | 275 | /* CHAPTER 3. Pages */ 276 | 277 | void pycpdf_scalePages(int pdf, int r, double sx, double sy) { 278 | return cpdf_scalePages(pdf, r, sx, sy); 279 | } 280 | 281 | void pycpdf_scaleToFit(int pdf, int r, double sx, double sy, double scale_to_fit_scale) { 282 | return cpdf_scaleToFit(pdf, r, sx, sy, scale_to_fit_scale); 283 | } 284 | 285 | void pycpdf_scaleToFitPaper(int pdf, int r, int papersize, double scale_to_fit_scale) { 286 | return cpdf_scaleToFitPaper(pdf, r, papersize, scale_to_fit_scale); 287 | } 288 | 289 | 290 | void pycpdf_scaleContents(int pdf, int r, int pos, double p1, double p2, double scale) { 291 | struct cpdf_position p = { 292 | .cpdf_anchor = pos, .cpdf_coord1 = p1, .cpdf_coord2 = p2}; 293 | cpdf_scaleContents(pdf, r, p, scale); 294 | } 295 | 296 | void pycpdf_shiftContents(int pdf, int r, double dx, double dy) { 297 | return cpdf_shiftContents(pdf, r, dx, dy); 298 | } 299 | 300 | void pycpdf_shiftBoxes(int pdf, int r, double dx, double dy) { 301 | return cpdf_shiftBoxes(pdf, r, dx, dy); 302 | } 303 | 304 | void pycpdf_rotate(int pdf, int r, int rotation) { 305 | return cpdf_rotate(pdf, r, rotation); 306 | } 307 | 308 | void pycpdf_rotateBy(int pdf, int r, int rotation) { 309 | return cpdf_rotateBy(pdf, r, rotation); 310 | } 311 | 312 | void pycpdf_rotateContents(int pdf, int r, double rotation) { 313 | return cpdf_rotateContents(pdf, r, rotation); 314 | } 315 | 316 | void pycpdf_upright(int pdf, int r) { 317 | return cpdf_upright(pdf, r); 318 | } 319 | 320 | void pycpdf_hFlip(int pdf, int r) { 321 | return cpdf_hFlip(pdf, r); 322 | } 323 | 324 | void pycpdf_vFlip(int pdf, int r) { 325 | return cpdf_vFlip(pdf, r); 326 | } 327 | 328 | void pycpdf_crop(int pdf, int r, double x, double y, double w, double h) { 329 | return cpdf_crop(pdf, r, x, y, w, h); 330 | } 331 | 332 | void pycpdf_removeCrop(int pdf, int r) { 333 | return cpdf_removeCrop(pdf, r); 334 | } 335 | 336 | void pycpdf_removeTrim(int pdf, int r) { 337 | return cpdf_removeTrim(pdf, r); 338 | } 339 | 340 | void pycpdf_removeArt(int pdf, int r) { 341 | return cpdf_removeArt(pdf, r); 342 | } 343 | 344 | void pycpdf_removeBleed(int pdf, int r) { 345 | return cpdf_removeBleed(pdf, r); 346 | } 347 | 348 | void pycpdf_trimMarks(int pdf, int r) { 349 | return cpdf_trimMarks(pdf, r); 350 | } 351 | 352 | void pycpdf_showBoxes(int pdf, int r) { 353 | return cpdf_showBoxes(pdf, r); 354 | } 355 | 356 | void pycpdf_hardBox(int pdf, int r, char *boxname) { 357 | return cpdf_hardBox(pdf, r, boxname); 358 | } 359 | 360 | 361 | /* CHAPTER 4. Encryption */ 362 | 363 | /* Encryption covered under Chapter 1 in cpdflib. */ 364 | 365 | /* CHAPTER 5. Compression */ 366 | 367 | void pycpdf_compress(int pdf) { 368 | return cpdf_compress(pdf); 369 | } 370 | 371 | void pycpdf_decompress(int pdf) { 372 | return cpdf_decompress(pdf); 373 | } 374 | 375 | void pycpdf_squeezeInMemory(int pdf) { 376 | return cpdf_squeezeInMemory(pdf); 377 | } 378 | 379 | 380 | /* CHAPTER 6. Bookmarks */ 381 | 382 | void pycpdf_startGetBookmarkInfo(int pdf) { 383 | return cpdf_startGetBookmarkInfo(pdf); 384 | } 385 | 386 | int pycpdf_numberBookmarks() { 387 | return cpdf_numberBookmarks(); 388 | } 389 | 390 | int pycpdf_getBookmarkLevel(int n) { 391 | return cpdf_getBookmarkLevel(n); 392 | } 393 | 394 | int pycpdf_getBookmarkPage(int pdf, int page) { 395 | return cpdf_getBookmarkPage(pdf, page); 396 | } 397 | 398 | char* pycpdf_getBookmarkText(int n) { 399 | return cpdf_getBookmarkText(n); 400 | } 401 | 402 | int pycpdf_getBookmarkOpenStatus(int n) { 403 | return cpdf_getBookmarkOpenStatus(n); 404 | } 405 | 406 | void pycpdf_endGetBookmarkInfo() { 407 | return cpdf_endGetBookmarkInfo(); 408 | } 409 | 410 | void pycpdf_startSetBookmarkInfo(int n) { 411 | return cpdf_startSetBookmarkInfo(n); 412 | } 413 | 414 | void pycpdf_setBookmarkLevel(int n, int level) { 415 | return cpdf_setBookmarkLevel(n, level); 416 | } 417 | 418 | void pycpdf_setBookmarkPage(int pdf, int n, int targetpage) { 419 | return cpdf_setBookmarkPage(pdf, n, targetpage); 420 | } 421 | 422 | void pycpdf_setBookmarkOpenStatus(int n, int status) { 423 | return cpdf_setBookmarkOpenStatus(n, status); 424 | } 425 | 426 | void pycpdf_setBookmarkText(int n, char *text) { 427 | return cpdf_setBookmarkText(n, text); 428 | } 429 | 430 | void pycpdf_endSetBookmarkInfo(int pdf) { 431 | return cpdf_endSetBookmarkInfo(pdf); 432 | } 433 | 434 | 435 | void *getBookmarksJSONData; 436 | 437 | void *pycpdf_getBookmarksJSON(int pdf, int *length) { 438 | getBookmarksJSONData = cpdf_getBookmarksJSON(pdf, length); 439 | return getBookmarksJSONData; 440 | } 441 | 442 | void pycpdf_getBookmarksJSONFree(void) { 443 | free(getBookmarksJSONData); 444 | return; 445 | } 446 | 447 | void pycpdf_setBookmarksJSON(int pdf, void* data, int length) { 448 | return cpdf_setBookmarksJSON(pdf, data, length); 449 | } 450 | 451 | void pycpdf_tableOfContents(int pdf, char* font, double fontsize, char* title, int bookmark) { 452 | return cpdf_tableOfContents(pdf, font, fontsize, title, bookmark); 453 | } 454 | 455 | 456 | /* CHAPTER 7. Presentations */ 457 | 458 | /* Not included in the library version */ 459 | 460 | /* CHAPTER 8. Logos, Watermarks and Stamps */ 461 | 462 | void pycpdf_stampOn(int pdf, int pdf2, int r) { 463 | return cpdf_stampOn(pdf, pdf2, r); 464 | } 465 | 466 | void pycpdf_stampUnder(int pdf, int pdf2, int r) { 467 | return cpdf_stampUnder(pdf, pdf2, r); 468 | } 469 | 470 | 471 | void pycpdf_stampExtended(int pdf, int pdf2, int r, int isover, 472 | int scale_stamp_to_fit, int pos, int c1, int c2, 473 | int relative_to_cropbox) { 474 | struct cpdf_position position = { 475 | .cpdf_anchor = pos, .cpdf_coord1 = c1, .cpdf_coord2 = c2}; 476 | cpdf_stampExtended(pdf, pdf2, r, isover, scale_stamp_to_fit, position, 477 | relative_to_cropbox); 478 | return; 479 | } 480 | 481 | void pycpdf_combinePages(int pdf, int pdf2) { 482 | return cpdf_combinePages(pdf, pdf2); 483 | } 484 | 485 | 486 | void pycpdf_addText(int metrics, int pdf, int r, char *text, int pos, double p1, 487 | double p2, double line_spacing, int bates, char* font, 488 | double size, double red, double green, double blue, 489 | int underneath, int relative_to_cropbox, int outline, 490 | double opacity, int justification, int midline, int topline, 491 | char *filename, double line_width, int embed_fonts) { 492 | struct cpdf_position position = { 493 | .cpdf_anchor = pos, .cpdf_coord1 = p1, .cpdf_coord2 = p2}; 494 | cpdf_addText(metrics, pdf, r, text, position, line_spacing, bates, font, size, 495 | red, green, blue, underneath, relative_to_cropbox, outline, 496 | opacity, justification, midline, topline, filename, line_width, 497 | embed_fonts); 498 | return; 499 | } 500 | 501 | void pycpdf_addTextSimple(int pdf, int r, char *text, int pos, double p1, 502 | double p2, char* font, double size) { 503 | struct cpdf_position position = { 504 | .cpdf_anchor = pos, .cpdf_coord1 = p1, .cpdf_coord2 = p2}; 505 | cpdf_addTextSimple(pdf, r, text, position, font, size); 506 | return; 507 | } 508 | 509 | void pycpdf_removeText(int pdf, int r) { 510 | return cpdf_removeText(pdf, r); 511 | } 512 | 513 | int pycpdf_textWidth(char* font, char* string) { 514 | return cpdf_textWidth(font, string); 515 | } 516 | 517 | void pycpdf_addContent(char* content, int before, int pdf, int r) { 518 | return cpdf_addContent(content, before, pdf, r); 519 | } 520 | 521 | char* pycpdf_stampAsXObject(int pdf, int r, int stamp_pdf) { 522 | return cpdf_stampAsXObject(pdf, r, stamp_pdf); 523 | } 524 | 525 | 526 | /* CHAPTER 9. Multipage facilities */ 527 | 528 | void pycpdf_impose(int pdf, double x, double y, int fit, int columns, int rtl, int btt, int center, double margin, double spacing, double linewidth) { 529 | return cpdf_impose(pdf, x, y, fit, columns, rtl, btt, center, margin, spacing, linewidth); 530 | } 531 | 532 | void pycpdf_chop(int pdf, int range, int x, int y, int columns, int rtl, int btt) { 533 | return cpdf_chop(pdf, range, x, y, columns, rtl, btt); 534 | } 535 | 536 | void pycpdf_chopH(int pdf, int range, int columns, double y) { 537 | return cpdf_chopH(pdf, range, columns, y); 538 | } 539 | 540 | void pycpdf_chopV(int pdf, int range, int columns, double x) { 541 | return cpdf_chopV(pdf, range, columns, x); 542 | } 543 | 544 | void pycpdf_twoUp(int pdf) { 545 | return cpdf_twoUp(pdf); 546 | } 547 | 548 | void pycpdf_twoUpStack(int pdf) { 549 | return cpdf_twoUpStack(pdf); 550 | } 551 | 552 | void pycpdf_padBefore(int pdf, int r) { 553 | return cpdf_padBefore(pdf, r); 554 | } 555 | 556 | void pycpdf_padAfter(int pdf, int r) { 557 | return cpdf_padAfter(pdf, r); 558 | } 559 | 560 | void pycpdf_padEvery(int pdf, int r) { 561 | return cpdf_padEvery(pdf, r); 562 | } 563 | 564 | void pycpdf_padMultiple(int pdf, int n) { 565 | return cpdf_padMultiple(pdf, n); 566 | } 567 | 568 | void pycpdf_padMultipleBefore(int pdf, int n) { 569 | return cpdf_padMultipleBefore(pdf, n); 570 | } 571 | 572 | 573 | /* CHAPTER 10. Annotations */ 574 | void *annotationsJSONData; 575 | 576 | void *pycpdf_annotationsJSON(int pdf, int *length) { 577 | annotationsJSONData = cpdf_annotationsJSON(pdf, length); 578 | return annotationsJSONData; 579 | } 580 | 581 | void pycpdf_annotationsJSONFree(void) { 582 | free(annotationsJSONData); 583 | return; 584 | } 585 | 586 | void pycpdf_removeAnnotations(int pdf, int range) { 587 | return cpdf_removeAnnotations(pdf, range); 588 | } 589 | 590 | void pycpdf_setAnnotationsJSON(int pdf, void* data, int length) { 591 | return cpdf_setAnnotationsJSON(pdf, data, length); 592 | } 593 | 594 | 595 | /* CHAPTER 11. Document Information and Metadata */ 596 | 597 | int pycpdf_isLinearized(char *filename) { 598 | return cpdf_isLinearized(filename); 599 | } 600 | 601 | int pycpdf_hasObjectStreams(int pdf) { 602 | return cpdf_hasObjectStreams(pdf); 603 | } 604 | 605 | char* pycpdf_id1(int pdf) { 606 | return cpdf_id1(pdf); 607 | } 608 | 609 | char* pycpdf_id2(int pdf) { 610 | return cpdf_id2(pdf); 611 | } 612 | 613 | int pycpdf_hasAcroForm(int pdf) { 614 | return cpdf_hasAcroForm(pdf); 615 | } 616 | 617 | int pycpdf_startGetSubformats(int pdf) { 618 | return cpdf_startGetSubformats(pdf); 619 | } 620 | 621 | char* pycpdf_getSubformat(int s) { 622 | return cpdf_getSubformat(s); 623 | } 624 | 625 | void pycpdf_endGetSubformats() { 626 | return cpdf_endGetSubformats(); 627 | } 628 | 629 | int pycpdf_getVersion(int pdf) { 630 | return cpdf_getVersion(pdf); 631 | } 632 | 633 | int pycpdf_getMajorVersion(int pdf) { 634 | return cpdf_getMajorVersion(pdf); 635 | } 636 | 637 | char* pycpdf_getTitle(int pdf) { 638 | return cpdf_getTitle(pdf); 639 | } 640 | 641 | char* pycpdf_getAuthor(int pdf) { 642 | return cpdf_getAuthor(pdf); 643 | } 644 | 645 | char* pycpdf_getSubject(int pdf) { 646 | return cpdf_getSubject(pdf); 647 | } 648 | 649 | char* pycpdf_getKeywords(int pdf) { 650 | return cpdf_getKeywords(pdf); 651 | } 652 | 653 | char* pycpdf_getCreator(int pdf) { 654 | return cpdf_getCreator(pdf); 655 | } 656 | 657 | char* pycpdf_getProducer(int pdf) { 658 | return cpdf_getProducer(pdf); 659 | } 660 | 661 | char* pycpdf_getCreationDate(int pdf) { 662 | return cpdf_getCreationDate(pdf); 663 | } 664 | 665 | char* pycpdf_getModificationDate(int pdf) { 666 | return cpdf_getModificationDate(pdf); 667 | } 668 | 669 | char* pycpdf_getTitleXMP(int pdf) { 670 | return cpdf_getTitleXMP(pdf); 671 | } 672 | 673 | char* pycpdf_getAuthorXMP(int pdf) { 674 | return cpdf_getAuthorXMP(pdf); 675 | } 676 | 677 | char* pycpdf_getSubjectXMP(int pdf) { 678 | return cpdf_getSubjectXMP(pdf); 679 | } 680 | 681 | char* pycpdf_getKeywordsXMP(int pdf) { 682 | return cpdf_getKeywordsXMP(pdf); 683 | } 684 | 685 | char* pycpdf_getCreatorXMP(int pdf) { 686 | return cpdf_getCreatorXMP(pdf); 687 | } 688 | 689 | char* pycpdf_getProducerXMP(int pdf) { 690 | return cpdf_getProducerXMP(pdf); 691 | } 692 | 693 | char* pycpdf_getCreationDateXMP(int pdf) { 694 | return cpdf_getCreationDateXMP(pdf); 695 | } 696 | 697 | char* pycpdf_getModificationDateXMP(int pdf) { 698 | return cpdf_getModificationDateXMP(pdf); 699 | } 700 | 701 | void pycpdf_setTitle(int pdf, char *s) { 702 | return cpdf_setTitle(pdf, s); 703 | } 704 | 705 | void pycpdf_setAuthor(int pdf, char *s) { 706 | return cpdf_setAuthor(pdf, s); 707 | } 708 | 709 | void pycpdf_setSubject(int pdf, char *s) { 710 | return cpdf_setSubject(pdf, s); 711 | } 712 | 713 | void pycpdf_setKeywords(int pdf, char *s) { 714 | return cpdf_setKeywords(pdf, s); 715 | } 716 | 717 | void pycpdf_setCreator(int pdf, char *s) { 718 | return cpdf_setCreator(pdf, s); 719 | } 720 | 721 | void pycpdf_setProducer(int pdf, char *s) { 722 | return cpdf_setProducer(pdf, s); 723 | } 724 | 725 | void pycpdf_setCreationDate(int pdf, char *s) { 726 | return cpdf_setCreationDate(pdf, s); 727 | } 728 | 729 | void pycpdf_setModificationDate(int pdf, char *s) { 730 | return cpdf_setModificationDate(pdf, s); 731 | } 732 | 733 | void pycpdf_setTitleXMP(int pdf, char *s) { 734 | return cpdf_setTitleXMP(pdf, s); 735 | } 736 | 737 | void pycpdf_setAuthorXMP(int pdf, char *s) { 738 | return cpdf_setAuthorXMP(pdf, s); 739 | } 740 | 741 | void pycpdf_setSubjectXMP(int pdf, char *s) { 742 | return cpdf_setSubjectXMP(pdf, s); 743 | } 744 | 745 | void pycpdf_setKeywordsXMP(int pdf, char *s) { 746 | return cpdf_setKeywordsXMP(pdf, s); 747 | } 748 | 749 | void pycpdf_setCreatorXMP(int pdf, char *s) { 750 | return cpdf_setCreatorXMP(pdf, s); 751 | } 752 | 753 | void pycpdf_setProducerXMP(int pdf, char *s) { 754 | return cpdf_setProducerXMP(pdf, s); 755 | } 756 | 757 | void pycpdf_setCreationDateXMP(int pdf, char *s) { 758 | return cpdf_setCreationDateXMP(pdf, s); 759 | } 760 | 761 | void pycpdf_setModificationDateXMP(int pdf, char *s) { 762 | return cpdf_setModificationDateXMP(pdf, s); 763 | } 764 | 765 | void pycpdf_getDateComponents(char *str, int *year, int *month, int *day, int *hour, int *minute, int *second, int *hour_offset, int *minute_offset) { 766 | return cpdf_getDateComponents(str, year, month, day, hour, minute, second, hour_offset, minute_offset); 767 | } 768 | 769 | char* pycpdf_dateStringOfComponents(int year, int month, int day, int hour, int minute, int second, int hour_offset, int minute_offset) { 770 | return cpdf_dateStringOfComponents(year, month, day, hour, minute, second, hour_offset, minute_offset); 771 | } 772 | 773 | int pycpdf_getPageRotation(int pdf, int pagenumber) { 774 | return cpdf_getPageRotation(pdf, pagenumber); 775 | } 776 | 777 | int pycpdf_hasBox(int pdf, int pagenumber, char *box) { 778 | return cpdf_hasBox(pdf, pagenumber, box); 779 | } 780 | 781 | int pycpdf_numAnnots(int pdf, int pagenumber) { 782 | return cpdf_numAnnots(pdf, pagenumber); 783 | } 784 | 785 | void pycpdf_getMediaBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) { 786 | return cpdf_getMediaBox(pdf, pagenumber, minx, maxx, miny, maxy); 787 | } 788 | 789 | void pycpdf_getCropBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) { 790 | return cpdf_getCropBox(pdf, pagenumber, minx, maxx, miny, maxy); 791 | } 792 | 793 | void pycpdf_getTrimBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) { 794 | return cpdf_getTrimBox(pdf, pagenumber, minx, maxx, miny, maxy); 795 | } 796 | 797 | void pycpdf_getArtBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) { 798 | return cpdf_getArtBox(pdf, pagenumber, minx, maxx, miny, maxy); 799 | } 800 | 801 | void pycpdf_getBleedBox(int pdf, int pagenumber, double *minx, double *maxx, double *miny, double *maxy) { 802 | return cpdf_getBleedBox(pdf, pagenumber, minx, maxx, miny, maxy); 803 | } 804 | 805 | 806 | void pycpdf_setMediaBox(int pdf, int range, double minx, double maxx, 807 | double miny, double maxy) { 808 | cpdf_setMediabox(pdf, range, minx, maxx, miny, maxy); 809 | return; 810 | } 811 | 812 | void pycpdf_setCropBox(int pdf, int range, double minx, double maxx, double miny, double maxy) { 813 | return cpdf_setCropBox(pdf, range, minx, maxx, miny, maxy); 814 | } 815 | 816 | void pycpdf_setTrimBox(int pdf, int range, double minx, double maxx, double miny, double maxy) { 817 | return cpdf_setTrimBox(pdf, range, minx, maxx, miny, maxy); 818 | } 819 | 820 | void pycpdf_setArtBox(int pdf, int range, double minx, double maxx, double miny, double maxy) { 821 | return cpdf_setArtBox(pdf, range, minx, maxx, miny, maxy); 822 | } 823 | 824 | void pycpdf_setBleedBox(int pdf, int range, double minx, double maxx, double miny, double maxy) { 825 | return cpdf_setBleedBox(pdf, range, minx, maxx, miny, maxy); 826 | } 827 | 828 | 829 | 830 | void *pageInfoJSONData; 831 | 832 | void *pycpdf_pageInfoJSON(int pdf, int *length) { 833 | pageInfoJSONData = cpdf_pageInfoJSON(pdf, length); 834 | return pageInfoJSONData; 835 | } 836 | 837 | void pycpdf_pageInfoJSONFree(void) { 838 | free(pageInfoJSONData); 839 | return; 840 | } 841 | 842 | void pycpdf_markTrapped(int pdf) { 843 | return cpdf_markTrapped(pdf); 844 | } 845 | 846 | void pycpdf_markUntrapped(int pdf) { 847 | return cpdf_markUntrapped(pdf); 848 | } 849 | 850 | void pycpdf_markTrappedXMP(int pdf) { 851 | return cpdf_markTrappedXMP(pdf); 852 | } 853 | 854 | void pycpdf_markUntrappedXMP(int pdf) { 855 | return cpdf_markUntrappedXMP(pdf); 856 | } 857 | 858 | void pycpdf_setPageLayout(int pdf, int layout) { 859 | return cpdf_setPageLayout(pdf, layout); 860 | } 861 | 862 | int pycpdf_getPageLayout(int pdf) { 863 | return cpdf_getPageLayout(pdf); 864 | } 865 | 866 | void pycpdf_setPageMode(int pdf, int mode) { 867 | return cpdf_setPageMode(pdf, mode); 868 | } 869 | 870 | int pycpdf_getPageMode(int pdf) { 871 | return cpdf_getPageMode(pdf); 872 | } 873 | 874 | void pycpdf_hideToolbar(int pdf, int flag) { 875 | return cpdf_hideToolbar(pdf, flag); 876 | } 877 | 878 | int pycpdf_getHideToolbar(int pdf) { 879 | return cpdf_getHideToolbar(pdf); 880 | } 881 | 882 | void pycpdf_hideMenubar(int pdf, int flag) { 883 | return cpdf_hideMenubar(pdf, flag); 884 | } 885 | 886 | int pycpdf_getHideMenubar(int pdf) { 887 | return cpdf_getHideMenubar(pdf); 888 | } 889 | 890 | void pycpdf_hideWindowUi(int pdf, int flag) { 891 | return cpdf_hideWindowUi(pdf, flag); 892 | } 893 | 894 | int pycpdf_getHideWindowUi(int pdf) { 895 | return cpdf_getHideWindowUi(pdf); 896 | } 897 | 898 | void pycpdf_fitWindow(int pdf, int flag) { 899 | return cpdf_fitWindow(pdf, flag); 900 | } 901 | 902 | int pycpdf_getFitWindow(int pdf) { 903 | return cpdf_getFitWindow(pdf); 904 | } 905 | 906 | void pycpdf_centerWindow(int pdf, int flag) { 907 | return cpdf_centerWindow(pdf, flag); 908 | } 909 | 910 | int pycpdf_getCenterWindow(int pdf) { 911 | return cpdf_getCenterWindow(pdf); 912 | } 913 | 914 | void pycpdf_displayDocTitle(int pdf, int flag) { 915 | return cpdf_displayDocTitle(pdf, flag); 916 | } 917 | 918 | int pycpdf_getDisplayDocTitle(int pdf) { 919 | return cpdf_getDisplayDocTitle(pdf); 920 | } 921 | 922 | void pycpdf_nonFullScreenPageMode(int pdf, int flag) { 923 | return cpdf_nonFullScreenPageMode(pdf, flag); 924 | } 925 | 926 | int pycpdf_getNonFullScreenPageMode(int pdf) { 927 | return cpdf_getNonFullScreenPageMode(pdf); 928 | } 929 | 930 | void pycpdf_openAtPage(int pdf, int flag, int pagenumber) { 931 | return cpdf_openAtPage(pdf, flag, pagenumber); 932 | } 933 | 934 | void pycpdf_openAtPageCustom(int pdf, char* custom) { 935 | return cpdf_openAtPageCustom(pdf, custom); 936 | } 937 | 938 | void pycpdf_setMetadataFromFile(int pdf, char* filename) { 939 | return cpdf_setMetadataFromFile(pdf, filename); 940 | } 941 | 942 | void pycpdf_setMetadataFromByteArray(int pdf, void* data, int len) { 943 | return cpdf_setMetadataFromByteArray(pdf, data, len); 944 | } 945 | 946 | 947 | void *getMetadataData; 948 | 949 | void *pycpdf_getMetadata(int pdf, int *length) { 950 | getMetadataData = cpdf_getMetadata(pdf, length); 951 | return getMetadataData; 952 | } 953 | 954 | void pycpdf_getMetadataFree(void) { 955 | free(getMetadataData); 956 | return; 957 | } 958 | 959 | void pycpdf_removeMetadata(int pdf) { 960 | return cpdf_removeMetadata(pdf); 961 | } 962 | 963 | void pycpdf_createMetadata(int pdf) { 964 | return cpdf_createMetadata(pdf); 965 | } 966 | 967 | void pycpdf_setMetadataDate(int pdf, char* date) { 968 | return cpdf_setMetadataDate(pdf, date); 969 | } 970 | 971 | int pycpdf_startGetPageLabels(int pdf) { 972 | return cpdf_startGetPageLabels(pdf); 973 | } 974 | 975 | int pycpdf_getPageLabelStyle(int n) { 976 | return cpdf_getPageLabelStyle(n); 977 | } 978 | 979 | char* pycpdf_getPageLabelPrefix(int n) { 980 | return cpdf_getPageLabelPrefix(n); 981 | } 982 | 983 | int pycpdf_getPageLabelOffset(int n) { 984 | return cpdf_getPageLabelOffset(n); 985 | } 986 | 987 | int pycpdf_getPageLabelRange(int n) { 988 | return cpdf_getPageLabelRange(n); 989 | } 990 | 991 | void pycpdf_endGetPageLabels() { 992 | return cpdf_endGetPageLabels(); 993 | } 994 | 995 | void pycpdf_addPageLabels(int pdf, int style, char *prefix, int offset, int range, int progress) { 996 | return cpdf_addPageLabels(pdf, style, prefix, offset, range, progress); 997 | } 998 | 999 | void pycpdf_removePageLabels(int pdf) { 1000 | return cpdf_removePageLabels(pdf); 1001 | } 1002 | 1003 | char* pycpdf_getPageLabelStringForPage(int pdf, int pagenumber) { 1004 | return cpdf_getPageLabelStringForPage(pdf, pagenumber); 1005 | } 1006 | 1007 | 1008 | void *compositionJSONData; 1009 | 1010 | void *pycpdf_compositionJSON(int filesize, int pdf, int *length) { 1011 | compositionJSONData = cpdf_compositionJSON(filesize, pdf, length); 1012 | return compositionJSONData; 1013 | } 1014 | 1015 | void pycpdf_compositionJSONFree(void) { 1016 | free(compositionJSONData); 1017 | return; 1018 | } 1019 | 1020 | /* CHAPTER 12. File Attachments */ 1021 | 1022 | void pycpdf_attachFile(char* filename, int pdf) { 1023 | return cpdf_attachFile(filename, pdf); 1024 | } 1025 | 1026 | void pycpdf_attachFileToPage(char* filename, int pdf, int pagenumber) { 1027 | return cpdf_attachFileToPage(filename, pdf, pagenumber); 1028 | } 1029 | 1030 | void pycpdf_attachFileFromMemory(void* data, int len, char* filename, int pdf) { 1031 | return cpdf_attachFileFromMemory(data, len, filename, pdf); 1032 | } 1033 | 1034 | void pycpdf_attachFileToPageFromMemory(void* data, int len, char* filename, int pdf, int pagenumber) { 1035 | return cpdf_attachFileToPageFromMemory(data, len, filename, pdf, pagenumber); 1036 | } 1037 | 1038 | void pycpdf_removeAttachedFiles(int pdf) { 1039 | return cpdf_removeAttachedFiles(pdf); 1040 | } 1041 | 1042 | void pycpdf_startGetAttachments(int pdf) { 1043 | return cpdf_startGetAttachments(pdf); 1044 | } 1045 | 1046 | int pycpdf_numberGetAttachments() { 1047 | return cpdf_numberGetAttachments(); 1048 | } 1049 | 1050 | char* pycpdf_getAttachmentName(int n) { 1051 | return cpdf_getAttachmentName(n); 1052 | } 1053 | 1054 | int pycpdf_getAttachmentPage(int n) { 1055 | return cpdf_getAttachmentPage(n); 1056 | } 1057 | 1058 | 1059 | void *getAttachmentData; 1060 | 1061 | void *pycpdf_getAttachmentData(int n, int *length) { 1062 | getAttachmentData = cpdf_getAttachmentData(n, length); 1063 | return getAttachmentData; 1064 | } 1065 | 1066 | void pycpdf_getAttachmentFree(void) { 1067 | free(getAttachmentData); 1068 | return; 1069 | } 1070 | 1071 | void pycpdf_endGetAttachments() { 1072 | return cpdf_endGetAttachments(); 1073 | } 1074 | 1075 | 1076 | /* CHAPTER 13. Images. */ 1077 | 1078 | int pycpdf_startGetImageResolution(int pdf, double min_required_resolution) { 1079 | return cpdf_startGetImageResolution(pdf, min_required_resolution); 1080 | } 1081 | 1082 | int pycpdf_getImageResolutionPageNumber(int n) { 1083 | return cpdf_getImageResolutionPageNumber(n); 1084 | } 1085 | 1086 | char* pycpdf_getImageResolutionImageName(int n) { 1087 | return cpdf_getImageResolutionImageName(n); 1088 | } 1089 | 1090 | int pycpdf_getImageResolutionXPixels(int n) { 1091 | return cpdf_getImageResolutionXPixels(n); 1092 | } 1093 | 1094 | int pycpdf_getImageResolutionYPixels(int n) { 1095 | return cpdf_getImageResolutionYPixels(n); 1096 | } 1097 | 1098 | double pycpdf_getImageResolutionXRes(int n) { 1099 | return cpdf_getImageResolutionXRes(n); 1100 | } 1101 | 1102 | double pycpdf_getImageResolutionYRes(int n) { 1103 | return cpdf_getImageResolutionYRes(n); 1104 | } 1105 | 1106 | int pycpdf_getImageResolutionObjNum(int n) { 1107 | return cpdf_getImageResolutionObjNum(n); 1108 | } 1109 | 1110 | void pycpdf_endGetImageResolution() { 1111 | return cpdf_endGetImageResolution(); 1112 | } 1113 | 1114 | int pycpdf_startGetImages(int pdf) { 1115 | return cpdf_startGetImages(pdf); 1116 | } 1117 | 1118 | int pycpdf_getImageObjNum(int serial) { 1119 | return cpdf_getImageObjNum(serial); 1120 | } 1121 | 1122 | char* pycpdf_getImagePages(int serial) { 1123 | return cpdf_getImagePages(serial); 1124 | } 1125 | 1126 | char* pycpdf_getImageName(int serial) { 1127 | return cpdf_getImageName(serial); 1128 | } 1129 | 1130 | int pycpdf_getImageWidth(int serial) { 1131 | return cpdf_getImageWidth(serial); 1132 | } 1133 | 1134 | int pycpdf_getImageHeight(int serial) { 1135 | return cpdf_getImageHeight(serial); 1136 | } 1137 | 1138 | int pycpdf_getImageSize(int serial) { 1139 | return cpdf_getImageSize(serial); 1140 | } 1141 | 1142 | int pycpdf_getImageBPC(int serial) { 1143 | return cpdf_getImageBPC(serial); 1144 | } 1145 | 1146 | char* pycpdf_getImageColSpace(int serial) { 1147 | return cpdf_getImageColSpace(serial); 1148 | } 1149 | 1150 | char* pycpdf_getImageFilter(int serial) { 1151 | return cpdf_getImageFilter(serial); 1152 | } 1153 | 1154 | void pycpdf_endGetImages() { 1155 | return cpdf_endGetImages(); 1156 | } 1157 | 1158 | 1159 | void *imageResolutionJSONData; 1160 | 1161 | void *pycpdf_imageResolutionJSON(int pdf, int *length, float resolution) { 1162 | imageResolutionJSONData = cpdf_imageResolutionJSON(pdf, length, resolution); 1163 | return imageResolutionJSONData; 1164 | } 1165 | 1166 | void pycpdf_imageResolutionJSONFree(void) { 1167 | free(imageResolutionJSONData); 1168 | return; 1169 | } 1170 | 1171 | void *imagesJSONData; 1172 | 1173 | void *pycpdf_imagesJSON(int pdf, int *length) { 1174 | imagesJSONData = cpdf_imagesJSON(pdf, length); 1175 | return imagesJSONData; 1176 | } 1177 | 1178 | void pycpdf_imagesJSONFree(void) { 1179 | free(imagesJSONData); 1180 | return; 1181 | } 1182 | 1183 | /* CHAPTER 14. Fonts */ 1184 | 1185 | void pycpdf_removeFonts(int pdf) { 1186 | return cpdf_removeFonts(pdf); 1187 | } 1188 | 1189 | void pycpdf_copyFont(int pdf, int pdf2, int range, int pagenumber, char *fontname) { 1190 | return cpdf_copyFont(pdf, pdf2, range, pagenumber, fontname); 1191 | } 1192 | 1193 | void pycpdf_startGetFontInfo(int pdf) { 1194 | return cpdf_startGetFontInfo(pdf); 1195 | } 1196 | 1197 | int pycpdf_numberFonts() { 1198 | return cpdf_numberFonts(); 1199 | } 1200 | 1201 | int pycpdf_getFontPage(int n) { 1202 | return cpdf_getFontPage(n); 1203 | } 1204 | 1205 | char* pycpdf_getFontName(int n) { 1206 | return cpdf_getFontName(n); 1207 | } 1208 | 1209 | char* pycpdf_getFontType(int n) { 1210 | return cpdf_getFontType(n); 1211 | } 1212 | 1213 | char* pycpdf_getFontEncoding(int n) { 1214 | return cpdf_getFontEncoding(n); 1215 | } 1216 | 1217 | void pycpdf_endGetFontInfo() { 1218 | return cpdf_endGetFontInfo(); 1219 | } 1220 | 1221 | 1222 | void *fontsJSONData; 1223 | 1224 | void *pycpdf_fontsJSON(int pdf, int *length) { 1225 | fontsJSONData = cpdf_fontsJSON(pdf, length); 1226 | return fontsJSONData; 1227 | } 1228 | 1229 | void pycpdf_fontsJSONFree(void) { 1230 | free(fontsJSONData); 1231 | return; 1232 | } 1233 | 1234 | /* CHAPTER 15. PDF and JSON */ 1235 | 1236 | void pycpdf_outputJSON(char* filename, int parse_content, int no_stream_data, int decompress_streams, int pdf) { 1237 | return cpdf_outputJSON(filename, parse_content, no_stream_data, decompress_streams, pdf); 1238 | } 1239 | 1240 | 1241 | void *outputJSONData; 1242 | 1243 | void *pycpdf_outputJSONMemory(int pdf, int parse_content, int no_stream_data, 1244 | int decompress_stream, int *retlen) { 1245 | outputJSONData = cpdf_outputJSONMemory(pdf, parse_content, no_stream_data, 1246 | decompress_stream, retlen); 1247 | return outputJSONData; 1248 | } 1249 | 1250 | void pycpdf_outputJSONMemoryFree(void) { 1251 | free(outputJSONData); 1252 | return; 1253 | } 1254 | 1255 | int pycpdf_fromJSON(char *filename) { 1256 | return cpdf_fromJSON(filename); 1257 | } 1258 | 1259 | int pycpdf_fromJSONMemory(void *data, int len) { 1260 | return cpdf_fromJSONMemory(data, len); 1261 | } 1262 | 1263 | 1264 | /* CHAPTER 16. Optional Content Groups */ 1265 | 1266 | int pycpdf_startGetOCGList(int pdf) { 1267 | return cpdf_startGetOCGList(pdf); 1268 | } 1269 | 1270 | char* pycpdf_OCGListEntry(int i) { 1271 | return cpdf_OCGListEntry(i); 1272 | } 1273 | 1274 | void pycpdf_endGetOCGList() { 1275 | return cpdf_endGetOCGList(); 1276 | } 1277 | 1278 | void pycpdf_OCGCoalesce(int pdf) { 1279 | return cpdf_OCGCoalesce(pdf); 1280 | } 1281 | 1282 | void pycpdf_OCGRename(int pdf, char* n_from, char* n_to) { 1283 | return cpdf_OCGRename(pdf, n_from, n_to); 1284 | } 1285 | 1286 | void pycpdf_OCGOrderAll(int pdf) { 1287 | return cpdf_OCGOrderAll(pdf); 1288 | } 1289 | 1290 | 1291 | /* CHAPTER 17. Creating New PDFs */ 1292 | 1293 | int pycpdf_blankDocument(double w, double h, int pages) { 1294 | return cpdf_blankDocument(w, h, pages); 1295 | } 1296 | 1297 | int pycpdf_blankDocumentPaper(int papersize, int pages) { 1298 | return cpdf_blankDocumentPaper(papersize, pages); 1299 | } 1300 | 1301 | int pycpdf_textToPDF(double w, double h, char* font, double fontsize, char *filename) { 1302 | return cpdf_textToPDF(w, h, font, fontsize, filename); 1303 | } 1304 | 1305 | int pycpdf_textToPDFMemory(double w, double h, char* font, double fontsize, void* data, int len) { 1306 | return cpdf_textToPDFMemory(w, h, font, fontsize, data, len); 1307 | } 1308 | 1309 | int pycpdf_textToPDFPaper(int papersize, char* font, double fontsize, char *filename) { 1310 | return cpdf_textToPDFPaper(papersize, font, fontsize, filename); 1311 | } 1312 | 1313 | int pycpdf_textToPDFPaperMemory(int papersize, char* font, double fontsize, void* data, int len) { 1314 | return cpdf_textToPDFPaperMemory(papersize, font, fontsize, data, len); 1315 | } 1316 | 1317 | int pycpdf_fromPNG(char* filename) { 1318 | return cpdf_fromPNG(filename); 1319 | } 1320 | 1321 | int pycpdf_fromPNGMemory(void* data, int len) { 1322 | return cpdf_fromPNGMemory(data, len); 1323 | } 1324 | 1325 | int pycpdf_fromJPEG(char* filename) { 1326 | return cpdf_fromJPEG(filename); 1327 | } 1328 | 1329 | int pycpdf_fromJPEGMemory(void* data, int len) { 1330 | return cpdf_fromJPEGMemory(data, len); 1331 | } 1332 | 1333 | 1334 | /* CHAPTER 18. Drawing on PDFs */ 1335 | 1336 | void pycpdf_drawBegin() { 1337 | return cpdf_drawBegin(); 1338 | } 1339 | 1340 | void pycpdf_drawEnd(int pdf, int range) { 1341 | return cpdf_drawEnd(pdf, range); 1342 | } 1343 | 1344 | void pycpdf_drawEndExtended(int pdf, int range, int underneath, int bates, char* filename) { 1345 | return cpdf_drawEndExtended(pdf, range, underneath, bates, filename); 1346 | } 1347 | 1348 | void pycpdf_drawRect(double x, double y, double w, double h) { 1349 | return cpdf_drawRect(x, y, w, h); 1350 | } 1351 | 1352 | void pycpdf_drawTo(double x, double y) { 1353 | return cpdf_drawTo(x, y); 1354 | } 1355 | 1356 | void pycpdf_drawLine(double x, double y) { 1357 | return cpdf_drawLine(x, y); 1358 | } 1359 | 1360 | void pycpdf_drawBez(double x1, double y1, double x2, double y2, double x3, double y3) { 1361 | return cpdf_drawBez(x1, y1, x2, y2, x3, y3); 1362 | } 1363 | 1364 | void pycpdf_drawBez23(double x2, double y2, double x3, double y3) { 1365 | return cpdf_drawBez23(x2, y2, x3, y3); 1366 | } 1367 | 1368 | void pycpdf_drawBez13(double x1, double y1, double x3, double y3) { 1369 | return cpdf_drawBez13(x1, y1, x3, y3); 1370 | } 1371 | 1372 | void pycpdf_drawCircle(double x, double y, double r) { 1373 | return cpdf_drawCircle(x, y, r); 1374 | } 1375 | 1376 | void pycpdf_drawStroke() { 1377 | return cpdf_drawStroke(); 1378 | } 1379 | 1380 | void pycpdf_drawFill() { 1381 | return cpdf_drawFill(); 1382 | } 1383 | 1384 | void pycpdf_drawFillEo() { 1385 | return cpdf_drawFillEo(); 1386 | } 1387 | 1388 | void pycpdf_drawStrokeFill() { 1389 | return cpdf_drawStrokeFill(); 1390 | } 1391 | 1392 | void pycpdf_drawStrokeFillEo() { 1393 | return cpdf_drawStrokeFillEo(); 1394 | } 1395 | 1396 | void pycpdf_drawClose() { 1397 | return cpdf_drawClose(); 1398 | } 1399 | 1400 | void pycpdf_drawClip() { 1401 | return cpdf_drawClip(); 1402 | } 1403 | 1404 | void pycpdf_drawClipEo() { 1405 | return cpdf_drawClipEo(); 1406 | } 1407 | 1408 | void pycpdf_drawStrokeColGrey(double g) { 1409 | return cpdf_drawStrokeColGrey(g); 1410 | } 1411 | 1412 | void pycpdf_drawStrokeColRGB(double r, double g, double b) { 1413 | return cpdf_drawStrokeColRGB(r, g, b); 1414 | } 1415 | 1416 | void pycpdf_drawStrokeColCYMK(double c, double y, double m, double k) { 1417 | return cpdf_drawStrokeColCYMK(c, y, m, k); 1418 | } 1419 | 1420 | void pycpdf_drawFillColGrey(double g) { 1421 | return cpdf_drawFillColGrey(g); 1422 | } 1423 | 1424 | void pycpdf_drawFillColRGB(double r, double g, double b) { 1425 | return cpdf_drawFillColRGB(r, g, b); 1426 | } 1427 | 1428 | void pycpdf_drawFillColCYMK(double c, double y, double m, double k) { 1429 | return cpdf_drawFillColCYMK(c, y, m, k); 1430 | } 1431 | 1432 | void pycpdf_drawThick(double thickness) { 1433 | return cpdf_drawThick(thickness); 1434 | } 1435 | 1436 | void pycpdf_drawCap(int captype) { 1437 | return cpdf_drawCap(captype); 1438 | } 1439 | 1440 | void pycpdf_drawJoin(int jointype) { 1441 | return cpdf_drawJoin(jointype); 1442 | } 1443 | 1444 | void pycpdf_drawMiter(double m) { 1445 | return cpdf_drawMiter(m); 1446 | } 1447 | 1448 | void pycpdf_drawDash(char* description) { 1449 | return cpdf_drawDash(description); 1450 | } 1451 | 1452 | void pycpdf_drawPush() { 1453 | return cpdf_drawPush(); 1454 | } 1455 | 1456 | void pycpdf_drawPop() { 1457 | return cpdf_drawPop(); 1458 | } 1459 | 1460 | void pycpdf_drawMatrix(double a, double b, double c, double d, double e, double f) { 1461 | return cpdf_drawMatrix(a, b, c, d, e, f); 1462 | } 1463 | 1464 | void pycpdf_drawMTrans(double tx, double ty) { 1465 | return cpdf_drawMTrans(tx, ty); 1466 | } 1467 | 1468 | void pycpdf_drawMRot(double x, double y, double a) { 1469 | return cpdf_drawMRot(x, y, a); 1470 | } 1471 | 1472 | void pycpdf_drawMScale(double x, double y, double sx, double sy) { 1473 | return cpdf_drawMScale(x, y, sx, sy); 1474 | } 1475 | 1476 | void pycpdf_drawMShearX(double x, double y, double a) { 1477 | return cpdf_drawMShearX(x, y, a); 1478 | } 1479 | 1480 | void pycpdf_drawMShearY(double x, double y, double a) { 1481 | return cpdf_drawMShearY(x, y, a); 1482 | } 1483 | 1484 | void pycpdf_drawXObjBBox(double x, double y, double w, double h) { 1485 | return cpdf_drawXObjBBox(x, y, w, h); 1486 | } 1487 | 1488 | void pycpdf_drawXObj(char* name) { 1489 | return cpdf_drawXObj(name); 1490 | } 1491 | 1492 | void pycpdf_drawUse(char* name) { 1493 | return cpdf_drawUse(name); 1494 | } 1495 | 1496 | void pycpdf_drawEndXObj() { 1497 | return cpdf_drawEndXObj(); 1498 | } 1499 | 1500 | void pycpdf_drawJPEG(char* name, char* fontname) { 1501 | return cpdf_drawJPEG(name, fontname); 1502 | } 1503 | 1504 | void pycpdf_drawJPEGMemory(char* name, void* data, int len) { 1505 | return cpdf_drawJPEGMemory(name, data, len); 1506 | } 1507 | 1508 | void pycpdf_drawPNG(char* name, char* fontname) { 1509 | return cpdf_drawPNG(name, fontname); 1510 | } 1511 | 1512 | void pycpdf_drawPNGMemory(char* name, void* data, int len) { 1513 | return cpdf_drawPNGMemory(name, data, len); 1514 | } 1515 | 1516 | void pycpdf_drawImage(char* name) { 1517 | return cpdf_drawImage(name); 1518 | } 1519 | 1520 | void pycpdf_drawFillOpacity(double n) { 1521 | return cpdf_drawFillOpacity(n); 1522 | } 1523 | 1524 | void pycpdf_drawStrokeOpacity(double n) { 1525 | return cpdf_drawStrokeOpacity(n); 1526 | } 1527 | 1528 | void pycpdf_drawBT() { 1529 | return cpdf_drawBT(); 1530 | } 1531 | 1532 | void pycpdf_drawET() { 1533 | return cpdf_drawET(); 1534 | } 1535 | 1536 | void pycpdf_drawFont(char* name) { 1537 | return cpdf_drawFont(name); 1538 | } 1539 | 1540 | void pycpdf_drawFontSize(double n) { 1541 | return cpdf_drawFontSize(n); 1542 | } 1543 | 1544 | void pycpdf_drawText(char* text) { 1545 | return cpdf_drawText(text); 1546 | } 1547 | 1548 | void pycpdf_drawSText(char* text) { 1549 | return cpdf_drawSText(text); 1550 | } 1551 | 1552 | void pycpdf_drawLeading(double n) { 1553 | return cpdf_drawLeading(n); 1554 | } 1555 | 1556 | void pycpdf_drawCharSpace(double n) { 1557 | return cpdf_drawCharSpace(n); 1558 | } 1559 | 1560 | void pycpdf_drawWordSpace(double n) { 1561 | return cpdf_drawWordSpace(n); 1562 | } 1563 | 1564 | void pycpdf_drawTextScale(double n) { 1565 | return cpdf_drawTextScale(n); 1566 | } 1567 | 1568 | void pycpdf_drawRenderMode(int n) { 1569 | return cpdf_drawRenderMode(n); 1570 | } 1571 | 1572 | void pycpdf_drawRise(double n) { 1573 | return cpdf_drawRise(n); 1574 | } 1575 | 1576 | void pycpdf_drawNL() { 1577 | return cpdf_drawNL(); 1578 | } 1579 | 1580 | void pycpdf_drawNewPage() { 1581 | return cpdf_drawNewPage(); 1582 | } 1583 | 1584 | 1585 | /* CHAPTER 19. Miscellaneous */ 1586 | 1587 | void pycpdf_draft(int pdf, int r, int boxes) { 1588 | return cpdf_draft(pdf, r, boxes); 1589 | } 1590 | 1591 | void pycpdf_removeAllText(int pdf, int r) { 1592 | return cpdf_removeAllText(pdf, r); 1593 | } 1594 | 1595 | void pycpdf_blackText(int pdf, int r) { 1596 | return cpdf_blackText(pdf, r); 1597 | } 1598 | 1599 | void pycpdf_blackLines(int pdf, int r) { 1600 | return cpdf_blackLines(pdf, r); 1601 | } 1602 | 1603 | void pycpdf_blackFills(int pdf, int r) { 1604 | return cpdf_blackFills(pdf, r); 1605 | } 1606 | 1607 | void pycpdf_thinLines(int pdf, int r, double linewidth) { 1608 | return cpdf_thinLines(pdf, r, linewidth); 1609 | } 1610 | 1611 | void pycpdf_copyId(int pdf, int pdf2) { 1612 | return cpdf_copyId(pdf, pdf2); 1613 | } 1614 | 1615 | void pycpdf_removeId(int pdf) { 1616 | return cpdf_removeId(pdf); 1617 | } 1618 | 1619 | void pycpdf_setVersion(int pdf, int version) { 1620 | return cpdf_setVersion(pdf, version); 1621 | } 1622 | 1623 | void pycpdf_setFullVersion(int pdf, int major, int minor) { 1624 | return cpdf_setFullVersion(pdf, major, minor); 1625 | } 1626 | 1627 | void pycpdf_removeDictEntry(int pdf, char *key) { 1628 | return cpdf_removeDictEntry(pdf, key); 1629 | } 1630 | 1631 | void pycpdf_removeDictEntrySearch(int pdf, char *key, char *searchterm) { 1632 | return cpdf_removeDictEntrySearch(pdf, key, searchterm); 1633 | } 1634 | 1635 | void pycpdf_replaceDictEntry(int pdf, char *key, char *newvalue) { 1636 | return cpdf_replaceDictEntry(pdf, key, newvalue); 1637 | } 1638 | 1639 | void pycpdf_replaceDictEntrySearch(int pdf, char *key, char *newvalue, char *searchterm) { 1640 | return cpdf_replaceDictEntrySearch(pdf, key, newvalue, searchterm); 1641 | } 1642 | 1643 | void pycpdf_removeClipping(int pdf, int r) { 1644 | return cpdf_removeClipping(pdf, r); 1645 | } 1646 | 1647 | 1648 | void *getDictEntriesData; 1649 | 1650 | void *pycpdf_getDictEntries(int pdf, char *key, int *length) { 1651 | getDictEntriesData = cpdf_getDictEntries(pdf, key, length); 1652 | return getDictEntriesData; 1653 | } 1654 | 1655 | void pycpdf_getDictEntriesFree(void) { 1656 | free(getDictEntriesData); 1657 | return; 1658 | } 1659 | --------------------------------------------------------------------------------