wkhtmltopdf-0.9.9.orig/0000755000000000000000000000000011376515611011727 5ustar wkhtmltopdf-0.9.9.orig/.gitignore0000644000000000000000000000011711376515611013716 0ustar # ignore mac build files build/ *.plist wkhtmltopdf.app/ wkhtmltopdf.xcodeproj/wkhtmltopdf-0.9.9.orig/static_qt_conf_osx0000644000000000000000000000161711376515611015550 0ustar # This file is part of wkhtmltopdf. # # wkhtmltopdf is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # wkhtmltopdf is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with wkhtmltopdf. If not, see . -largefile -rpath -no-nis -no-cups -no-iconv -no-pch -no-gtkstyle -no-nas-sound -no-sm -no-xshape -no-xinerama -no-xfixes -no-xrandr -no-xrender -no-mitshm -no-xinput -no-xkb -no-glib -no-openvg -no-opengl -no-xsync -no-javascript-jit -no-svg wkhtmltopdf-0.9.9.orig/wkhtmltopdf.pro0000644000000000000000000000422711376515611015021 0ustar # This file is part of wkhtmltopdf. # # wkhtmltopdf is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # wkhtmltopdf is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with wkhtmltopdf. If not, see . DEFINES += MAJOR_VERSION=0 MINOR_VERSION=9 PATCH_VERSION=9 BUILD="" TEMP = $$[QT_INSTALL_LIBS] libQtGui.prl PRL = $$[QT_INSTALL_LIBS] QtGui.framework/QtGui.prl include($$join(TEMP, "/")) include($$join(PRL, "/")) contains(QMAKE_PRL_CONFIG, shared) { DEFINES += QT_SHARED } else { DEFINES += QT_STATIC QTPLUGIN += qjpeg qgif qtiff qmng } TEMPLATE = app TARGET = DEPENDPATH += . src INCLUDEPATH += . src MOC_DIR = build OBJECTS_DIR = build UI_DIR = build readme.target=README readme.commands=./wkhtmltopdf --readme > README readme.depends=wkhtmltopdf QMAKE_EXTRA_UNIX_TARGETS += readme unix { man.target=wkhtmltopdf.1.gz man.commands=./wkhtmltopdf --manpage | gzip > $@ man.depends=wkhtmltopdf manins.target=manins manins.depends=man manins.files=wkhtmltopdf.1.gz manins.path=$$INSTALLBASE/share/man/man1 QMAKE_EXTRA_UNIX_TARGETS += manins man INSTALLS += manins } win32 { CONFIG += console } INSTALLS += target target.path=$$INSTALLBASE/bin QT += webkit network # Input HEADERS += src/pageconverter_p.hh src/pageconverter.hh \ src/multipageloader_p.hh src/multipageloader.hh src/progressfeedback.hh SOURCES += src/wkhtmltopdf.cc src/arguments.cc src/commandlineparser.cc \ src/docparts.cc src/outputter.cc src/manoutputter.cc src/settings.cc \ src/htmloutputter.cc src/textoutputter.cc src/tempfile.cc \ src/multipageloader.cc src/pageconverter.cc src/progressfeedback.cc \ src/outline.cc src/tocprinter.cc wkhtmltopdf-0.9.9.orig/Doxyfile0000644000000000000000000017364611376515611013456 0ustar # Doxyfile 1.6.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "Wkhtmltopdf" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doc/ # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.cc *.inc *.hh # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */static-build/* */.git/* */release-* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list. USE_INLINE_TREES = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # When the SEARCHENGINE tag is enable doxygen will generate a search box for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) # there is already a search function so this one should typically # be disabled. SEARCHENGINE = YES #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = __EXTENSIVE_WKHTMLTOPDF_QT_HACK__= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES wkhtmltopdf-0.9.9.orig/src/0000755000000000000000000000000011376515611012516 5ustar wkhtmltopdf-0.9.9.orig/src/multipageloader.cc0000644000000000000000000004065311376515611016213 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "multipageloader_p.hh" #include #include #include #include #include /*! \file multipageloader.hh \brief Defines the MultiPageLoader class */ /*! \file multipageloader_p.hh \brief Defines the MultiPageLoaderPrivate class */ MyNetworkAccessManager::MyNetworkAccessManager(bool block): blockAccess(block) {} void MyNetworkAccessManager::allow(QString path) { QString x = QFileInfo(path).canonicalFilePath(); if (x.isEmpty()) return; allowed.insert(x); } QNetworkReply * MyNetworkAccessManager::createRequest(Operation op, const QNetworkRequest & req, QIODevice * outgoingData) { if (req.url().scheme() == "file" && blockAccess) { bool ok=false; QString path = QFileInfo(req.url().toLocalFile()).canonicalFilePath(); QString old = ""; while(path != old) { if (allowed.contains(path)) { ok=true; break; } old = path; path = QFileInfo(path).path(); } if (!ok) { QNetworkRequest r2 = req; emit warning(QString("Blocked access to file %1").arg(QFileInfo(req.url().toLocalFile()).canonicalFilePath())); r2.setUrl(QUrl("about:blank")); return QNetworkAccessManager::createRequest(op, r2, outgoingData); } } return QNetworkAccessManager::createRequest(op, req, outgoingData); } MyQWebPage::MyQWebPage(MultiPageLoader & mpl, Settings & s): settings(s), multiPageLoader(mpl) {}; bool MyQWebPage::shouldInterruptJavaScript() { if (settings.stopSlowScripts) { multiPageLoader.warning("A slow script was stopped"); return true; } return false; } void MyQWebPage::javaScriptAlert(QWebFrame *, const QString & msg) { multiPageLoader.warning(QString("Javascript alert: %1").arg(msg)); } bool MyQWebPage::javaScriptConfirm(QWebFrame *, const QString & msg) { multiPageLoader.warning(QString("Javascript confirm: %1 (answered yes)").arg(msg)); return true; } bool MyQWebPage::javaScriptPrompt(QWebFrame *, const QString & msg, const QString & defaultValue, QString * result) { multiPageLoader.warning(QString("Javascript prompt: %1 (answered %2)").arg(msg,defaultValue)); result = (QString*)&defaultValue; return true; } void MyQWebPage::javaScriptConsoleMessage(const QString & message, int lineNumber, const QString & sourceID) { if (settings.debugJavascript) multiPageLoader.warning(QString("%1:%2 %3").arg(sourceID).arg(lineNumber).arg(message)); } void MyCookieJar::addGlobalCookie(const QString & name, const QString & value) { globalCookies.append(QNetworkCookie(name.toUtf8(), value.toUtf8())); } QList MyCookieJar::cookiesForUrl(const QUrl & url) const { QList list = QNetworkCookieJar::cookiesForUrl(url); list.append(globalCookies); return list; } void MyCookieJar::loadFromFile(const QString & path) { QFile cookieJar(path); if (cookieJar.open(QIODevice::ReadOnly | QIODevice::Text) ) setAllCookies(QNetworkCookie::parseCookies(cookieJar.readAll())); } void MyCookieJar::saveToFile(const QString & path) { QFile cookieJar(path); if (cookieJar.open(QIODevice::WriteOnly | QIODevice::Text) ) foreach (const QNetworkCookie & cookie, allCookies()) { cookieJar.write(cookie.toRawForm()); cookieJar.write(";\n"); } } /*! * Track and handle network errors * \param reply The networkreply that has finished */ void MultiPageLoaderPrivate::amfinished(QNetworkReply * reply) { int error = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (error > 399 && httpErrorCode == 0) httpErrorCode = error; } /*! * Called when the page requires authentication, filles in the username * and password supplied on the command line */ void MultiPageLoaderPrivate::authenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator) { if (settings.username.isEmpty()) { //If no username is given, complain the such is required emit outer.error("Authentication Required"); reply->abort(); fail(); } else if (loginTry >= 2) { //If the login has failed a sufficient number of times, //the username or password must be wrong emit outer.error("Invalid username or password"); reply->abort(); fail(); } else { authenticator->setUser(settings.username); authenticator->setPassword(settings.password); ++loginTry; } } /*! * Copy a file from some place to another * \param src The source to copy from * \param dst The destination to copy to */ bool MultiPageLoader::copyFile(QFile & src, QFile & dst) { // TODO enable again when // http://bugreports.qt.nokia.com/browse/QTBUG-6894 // is fixed // QByteArray buf(1024*1024*5,0); // while ( qint64 r=src.read(buf.data(),buf.size())) { // if (r == -1) return false; // if (dst.write(buf.data(),r) != r) return false; // } if (dst.write( src.readAll() ) == -1) return false; src.close(); dst.close(); return true; } /*! * Handel any ssl error by ignoring */ void MultiPageLoaderPrivate::sslErrors(QNetworkReply *reply, const QList &) { //We ignore any ssl error, as it is next to impossible to send or receive //any private information with wkhtmltopdf anyhow, seeing as you cannot authenticate reply->ignoreSslErrors(); emit outer.warning("SSL error ignored"); } MultiPageLoaderPrivate::MultiPageLoaderPrivate(Settings & s, MultiPageLoader & o): outer(o), settings(s), networkAccessManager(s.blockLocalFileAccess) { foreach(const QString & path, s.allowed) networkAccessManager.allow(path); //If some ssl error occures we want sslErrors to be called, so the we can ignore it connect(&networkAccessManager, SIGNAL(sslErrors(QNetworkReply*, const QList&)),this, SLOT(sslErrors(QNetworkReply*, const QList&))); connect(&networkAccessManager, SIGNAL(finished (QNetworkReply *)), this, SLOT(amfinished (QNetworkReply *) ) ); connect(&networkAccessManager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator *)),this, SLOT(authenticationRequired(QNetworkReply *, QAuthenticator *))); connect(&networkAccessManager, SIGNAL(warning(const QString &)), this, SLOT(warning(const QString &))); cookieJar = new MyCookieJar(); networkAccessManager.setCookieJar(cookieJar); if (!settings.cookieJar.isEmpty()) cookieJar->loadFromFile(settings.cookieJar); typedef QPair SSP; foreach (const SSP & pair, settings.cookies) cookieJar->addGlobalCookie(pair.first, pair.second); //If we must use a proxy, create a host of objects if (!settings.proxy.host.isEmpty()) { QNetworkProxy proxy; proxy.setHostName(settings.proxy.host); proxy.setPort(settings.proxy.port); proxy.setType(settings.proxy.type); // to retrieve a web page, it's not needed to use a fully transparent // http proxy. Moreover, the CONNECT() method is frequently disabled // by proxies administrators. #if QT_VERSION >= 0x040500 if (settings.proxy.type == QNetworkProxy::HttpProxy) proxy.setCapabilities(QNetworkProxy::CachingCapability); #endif if (!settings.proxy.user.isEmpty()) proxy.setUser(settings.proxy.user); if (!settings.proxy.password.isEmpty()) proxy.setPassword(settings.proxy.password); networkAccessManager.setProxy(proxy); } } MultiPageLoaderPrivate::~MultiPageLoaderPrivate() { clearResources(); } QWebPage * MultiPageLoaderPrivate::addResource(const QUrl & url) { if (url.scheme() == "file") networkAccessManager.allow(url.toLocalFile()); QWebPage * page = new MyQWebPage(outer, settings); pages.push_back(page); urls.push_back(url); page->setNetworkAccessManager(&networkAccessManager); page->mainFrame()->setZoomFactor(settings.zoomFactor); pageToIndex[page] = pages.size()-1; connect(page, SIGNAL(loadStarted()), this, SLOT(loadStarted())); connect(page, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int))); connect(page, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); connect(page, SIGNAL(printRequested(QWebFrame*)), this, SLOT(printRequested(QWebFrame*))); progressList.push_back(0); finishedList.push_back(false); signalPrintList.push_back(false); return page; } void MultiPageLoaderPrivate::load() { httpErrorCode = 0; loginTry = 0; progressSum=0; finishedSum=0; signalPrintSum=0; loadStartedEmitted=false; error=false; loadingPages=0; QString boundary = QUuid::createUuid().toString().remove('-').remove('{').remove('}'); QByteArray postData; foreach (const Settings::PostItem & pi, settings.post) { //TODO escape values here postData.append("--"); postData.append(boundary); postData.append("\ncontent-disposition: form-data; name=\""); postData.append(pi.name); postData.append('\"'); if (pi.file) { QFile f(pi.value); if (!f.open(QIODevice::ReadOnly) ) { emit outer.error(QString("Unable to open file ")+pi.value); fail(); } postData.append("; filename=\""); postData.append( QFileInfo(pi.value).fileName()); postData.append("\"\n\n"); postData.append( f.readAll() ); //TODO ADD MIME TYPE } else { postData.append("\n\n"); postData.append(pi.value); } postData.append('\n'); } if (!postData.isEmpty()) { postData.append("--"); postData.append(boundary); postData.append("--\n"); } for (int i=0; i < pages.size(); ++i) { QNetworkRequest r = QNetworkRequest(urls[i]); typedef QPair HT; foreach (const HT & j, settings.customHeaders) r.setRawHeader(j.first.toAscii(), j.second.toAscii()); if (postData.isEmpty()) pages[i]->mainFrame()->load(r); else { r.setHeader(QNetworkRequest::ContentTypeHeader, QString("multipart/form-data, boundary=")+boundary); pages[i]->mainFrame()->load(r, QNetworkAccessManager::PostOperation, postData); } } } void MultiPageLoaderPrivate::clearResources() { pages.clear(); urls.clear(); progressList.clear(); finishedList.clear(); tempIn.remove(); } void MultiPageLoaderPrivate::cancel() { foreach (QWebPage * page, pages) page->triggerAction(QWebPage::Stop); } void MultiPageLoaderPrivate::fail() { error = true; cancel(); clearResources(); } /*! * Once loading starting, this is called */ void MultiPageLoaderPrivate::loadStarted() { loadingPages++; if (loadStartedEmitted) return; loadStartedEmitted=true; emit outer.loadStarted(); } /*! * Called when the page is loading, display some progress to the using * \param progress the loading progress in percent */ void MultiPageLoaderPrivate::loadProgress(int progress) { if (!pageToIndex.count(QObject::sender())) return; int idx=pageToIndex[QObject::sender()]; progressSum -= progressList[idx]; progressList[idx] = progress; progressSum += progressList[idx]; emit outer.loadProgress(progressSum / progressList.size()); } void MultiPageLoaderPrivate::loadFinished(bool ok) { loadingPages--; error = error || (!ok && !settings.ignoreLoadErrors); if (!pageToIndex.count(QObject::sender())) return; int idx=pageToIndex[QObject::sender()]; if (!ok) { if (!settings.ignoreLoadErrors) emit outer.error(QString("Failed loading page ") + urls[idx].toString()+" (sometimes it will work just to ignore this error with --ignore-load-errors)"); else emit outer.warning(QString("Failed loading page ") + urls[idx].toString()+" (ignored)"); } if (!finishedList[idx]) { finishedList[idx] = true; finishedSum += 1; } if (signalPrintSum == signalPrintList.size()) timedFinished(); else if (finishedSum == finishedList.size()) QTimer::singleShot(settings.jsredirectwait, this, SLOT(timedFinished())); } void MultiPageLoaderPrivate::printRequested(QWebFrame *) { if (!pageToIndex.count(QObject::sender())) return; int idx=pageToIndex[QObject::sender()]; if (!signalPrintList[idx]) { signalPrintList[idx] = true; signalPrintSum += 1; } if (signalPrintSum == signalPrintList.size()) timedFinished(); } void MultiPageLoaderPrivate::timedFinished() { if(loadingPages == 0) { if (!settings.cookieJar.isEmpty()) cookieJar->saveToFile(settings.cookieJar); emit outer.loadFinished(!error); } } void MultiPageLoaderPrivate::warning(const QString & msg) { emit outer.warning(msg); } /*! \brief Construct a multipage loader object, load settings read from the supplied settings \param s The settings to be used while loading pages */ MultiPageLoader::MultiPageLoader(Settings & s): d(new MultiPageLoaderPrivate(s, *this)) { } MultiPageLoader::~MultiPageLoader() { delete d; } /*! \brief Add a resource, to be loaded described by a string @param string Url describing the resource to load */ QWebPage * MultiPageLoader::addResource(const QString & string) { QString url=string; if (url == "-") { QFile in; in.open(stdin,QIODevice::ReadOnly); url = d->tempIn.create(".html"); QFile tmp(url); if(!tmp.open(QIODevice::WriteOnly) || !copyFile(in, tmp)) { emit error("Unable to create temporery file"); return NULL; } } return addResource(guessUrlFromString(url)); } /*! \brief Add a page to be loaded @param url Url of the page to load */ QWebPage * MultiPageLoader::addResource(const QUrl & url) { return d->addResource(url); } /*! \brief Guess a url, by looking at a string (shamelessly copied from Arora Project) \param string The string the is suppose to be some kind of url */ QUrl MultiPageLoader::guessUrlFromString(const QString &string) { QString urlStr = string.trimmed(); // check if the string is just a host with a port QRegExp hostWithPort(QLatin1String("^[a-zA-Z\\.]+\\:[0-9]*$")); if (hostWithPort.exactMatch(urlStr)) urlStr = QLatin1String("http://") + urlStr; // Check if it looks like a qualified URL. Try parsing it and see. QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*")); bool hasSchema = test.exactMatch(urlStr); if (hasSchema) { bool isAscii = true; foreach (const QChar &c, urlStr) { if (c >= 0x80) { isAscii = false; break; } } QUrl url; if (isAscii) { url = QUrl::fromEncoded(urlStr.toAscii(), QUrl::TolerantMode); } else { url = QUrl(urlStr, QUrl::TolerantMode); } if (url.isValid()) return url; } // Might be a file. if (QFile::exists(urlStr)) { QFileInfo info(urlStr); return QUrl::fromLocalFile(info.absoluteFilePath()); } // Might be a shorturl - try to detect the schema. if (!hasSchema) { int dotIndex = urlStr.indexOf(QLatin1Char('.')); if (dotIndex != -1) { QString prefix = urlStr.left(dotIndex).toLower(); QString schema = (prefix == QLatin1String("ftp")) ? prefix : QLatin1String("http"); QUrl url(schema + QLatin1String("://") + urlStr, QUrl::TolerantMode); if (url.isValid()) return url; } } // Fall back to QUrl's own tolerant parser. QUrl url = QUrl(string, QUrl::TolerantMode); // finally for cases where the user just types in a hostname add http if (url.scheme().isEmpty()) url = QUrl(QLatin1String("http://") + string, QUrl::TolerantMode); return url; } /*! \brief Return the most severe http error code returned during loading */ int MultiPageLoader::httpErrorCode() { return d->httpErrorCode; } /*! \brief Begin loading all the resources added */ void MultiPageLoader::load() { d->load(); } /*! \brief Clear all the resources */ void MultiPageLoader::clearResources() { d->clearResources(); } /*! \brief Cancel the loading of the pages */ void MultiPageLoader::cancel() { d->cancel(); } /*! \fn MultiPageLoader::loadFinished(bool ok) \brief Signal emmited when all pages have been loaded \param ok True if all the pages have been loaded sucessfully */ /*! \fn MultiPageLoader::loadProgress(int progress) \brief Signal emmited once load has progressed \param progress Progress in percent */ /*! \fn MultiPageLoader::loadStarted() \brief Signal emmited when loading has started */ /*! \fn void MultiPageLoader::warning(QString text) \brief Signal emmitted when a none fatal warning has occured \param text A string descripting the warning */ /*! \fn void MultiPageLoader::error(QString text) \brief Signal emmitted when a fatel error has occured \param text A string describing the error */ wkhtmltopdf-0.9.9.orig/src/tempfile.hh0000644000000000000000000000174211376515611014650 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __TEMPFILE_HH__ #define __TEMPFILE_HH__ #include class TempFile { private: QString path; public: TempFile(); ~TempFile(); QString create(const QString & ext); void remove(); }; #endif //__TEMPFILE_HH__ wkhtmltopdf-0.9.9.orig/src/settings.hh0000644000000000000000000001500011376515611014673 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __SETTINGS_HH__ #define __SETTINGS_HH__ #include #include #include /*! \brief Class holding all user setting. This class holds all the user settings, settings can be filled in by hand, or with other methods. \sa CommandLineParser::parse() */ struct Settings { /*! \brief Settings considdirng the table of content */ struct TOCSettings { static const uint levels = 7; //! Should we print dots between the name and the page number? bool useDots; //! Maximal depth used in the table of content int depth; //! Font used for printing the TOC QString fontName; //! Font used for printing the TOC caption QString captionFontName; //! Indentation used on a given level int indentation[levels]; //! Font size used on a given level int fontSize[levels]; //! Font size used for print the TOC caption int captionFontSize; //! Name af the TOC QString captionText; //! Link from TOC to section headers bool forwardLinks; //! Link from section headers to TOC bool backLinks; }; /*! \brief Settings considering headers and footers */ struct HeaderFooterSettings { //! Size of the font used to render the text int fontSize; //! Name of font used to render text QString fontName; //! Text to render at the left QString left; //! Text to render at the right QString right; //! Text to render at the center QString center; //! Should a line seperate the header/footer and the document bool line; //! Url of the document the html document that should be used as a header/footer QString htmlUrl; //! Spacing float spacing; }; /*! \brief Settings consdering proxy */ struct ProxySettings { //! Type of proxy to use QNetworkProxy::ProxyType type; //! The port of the proxy to use int port; //! The host name of the proxy to use or NULL QString host; //! Username for the said proxy or NULL QString user; //! Password for the said proxy or NULL QString password; }; struct PostItem { QString name; QString value; bool file; }; /*! \brief Settings consdering margins */ struct MarginSettings { //!Margin applied to the top of the page QPair top; //!Margin applied to the right of the page QPair right; //!Margin applied to the bottom of the page QPair bottom; //!Margin applied to the leftp of the page QPair left; }; /*! \brief Settings considering page size */ struct SizeSettings { //! What size paper should we use QPrinter::PageSize pageSize; //!Height of the page QPair height; //!Width of the page QPair width; }; //! Proxy related settings ProxySettings proxy; //! Header related settings HeaderFooterSettings header; //! Header related settings HeaderFooterSettings footer; //! Margin related settings MarginSettings margin; //! Size related settings SizeSettings size; //! Settings regarding the TOC TOCSettings toc; //! Username used for http auth login QString username; //! Password used for http auth login QString password; //! Be less verbose bool quiet; //! Should we print background images bool background; //! Should we print a table of content bool printToc; //! Should plugins be allowed bool enablePlugins; //! Should we use the graphics system bool useGraphics; //! Should external links be links in the PDF bool useExternalLinks; //! Should internal links be links in the PDF bool useLocalLinks; //! Should we enable Java Script bool enableJavascript; //! Should the horrible intelligent shrking feature be enabled? bool enableIntelligentShrinking; //! How many milliseconds should we wait for a javascrit redirect int jsredirectwait; //! Should we orientate in landscape or portrate QPrinter::Orientation orientation; //! Color or grayscale QPrinter::ColorMode colorMode; //! What overall resolution should we use QPrinter::PrinterMode resolution; //! What dpi should be used when printing int dpi; //! When pagenumbers are printed, apply this offset to them all int pageOffset; //! How many copies do we wan to print int copies; //! Should be print a whole copy before beginnig the next bool collate; //! What zoom fator should we apply when printing float zoomFactor; //! Minimum font size int minimumFontSize; //! Should we used the print or the screen mediatype bool printMediaType; //! Encoding used to enterpit a document with do supplied encoding QString defaultEncoding; //! Stylesheet supplied by the user QString userStyleSheet; //! Url of document to use as cover QString cover; //! Should we generate an outline and put it into the pdf file bool outline; //! Maximal depth of the generated outline int outlineDepth; //! dump outline to this filename QString dumpOutline; //! List of input files QList in; //! The file where in to store the output QString out; //! Map of custum header valiabels QList< QPair > customHeaders; //! Should we read arguments from stdin bool readArgsFromStdin; //! Map of cookies QList< QPair > cookies; //! Replacements QList< QPair > replacements; //! Path of the cookie jar file QString cookieJar; QList< PostItem > post; QString documentTitle; bool stopSlowScripts; bool debugJavascript; bool blockLocalFileAccess; QList< QString > allowed; bool useCompression; bool produceForms; bool ignoreLoadErrors; static QPrinter::PageSize strToPageSize(const char * s, bool * ok=0); static QPair strToUnitReal(const char * s, bool * ok=0); static ProxySettings strToProxy(const char * s, bool * ok=0); static QPrinter::Orientation strToOrientation(const char * s, bool * ok=0); }; #endif //__SETTINGS_HH__ wkhtmltopdf-0.9.9.orig/src/progressfeedback.hh0000644000000000000000000000225011376515611016347 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __PROGRESSFEEDBACK_HH__ #define __PROGRESSFEEDBACK_HH__ #include "pageconverter.hh" class ProgressFeedback: public QObject { Q_OBJECT public: PageConverter & pageConverter; int lw; public slots: void warning(const QString &message); void error(const QString &message); void phaseChanged(); void progressChanged(int progress); public: ProgressFeedback(PageConverter & _); }; #endif //__PROGRESSFEEDBACK_HH__ wkhtmltopdf-0.9.9.orig/src/settings.cc0000644000000000000000000001401311376515611014664 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include /*! \file settings.hh \brief Defines the Settings class */ /*! Convert a string to a paper size, basically all thinkable values are allowed. if a unknown value is given A4 is returned \param s The string to convert \param ok If supplied indicates if the conversion was successful */ QPrinter::PageSize Settings::strToPageSize(const char * s, bool * ok) { if (ok) *ok=true; if (!strcasecmp("A0", s)) return QPrinter::A0; if (!strcasecmp("A1", s)) return QPrinter::A1; if (!strcasecmp("A2", s)) return QPrinter::A2; if (!strcasecmp("A3", s)) return QPrinter::A3; if (!strcasecmp("A4", s)) return QPrinter::A4; if (!strcasecmp("A5", s)) return QPrinter::A5; if (!strcasecmp("A6", s)) return QPrinter::A6; if (!strcasecmp("A7", s)) return QPrinter::A7; if (!strcasecmp("A8", s)) return QPrinter::A8; if (!strcasecmp("A9", s)) return QPrinter::A9; if (!strcasecmp("B0", s)) return QPrinter::B0; if (!strcasecmp("B1", s)) return QPrinter::B1; if (!strcasecmp("B10", s)) return QPrinter::B10; if (!strcasecmp("B2", s)) return QPrinter::B2; if (!strcasecmp("B3", s)) return QPrinter::B3; if (!strcasecmp("B4", s)) return QPrinter::B4; if (!strcasecmp("B5", s)) return QPrinter::B5; if (!strcasecmp("B6", s)) return QPrinter::B6; if (!strcasecmp("B7", s)) return QPrinter::B7; if (!strcasecmp("B8", s)) return QPrinter::B8; if (!strcasecmp("B9", s)) return QPrinter::B9; if (!strcasecmp("C5E", s)) return QPrinter::C5E; if (!strcasecmp("Comm10E", s)) return QPrinter::Comm10E; if (!strcasecmp("DLE", s)) return QPrinter::DLE; if (!strcasecmp("Executive", s)) return QPrinter::Executive; if (!strcasecmp("Folio", s)) return QPrinter::Folio; if (!strcasecmp("Ledger", s)) return QPrinter::Ledger; if (!strcasecmp("Legal", s)) return QPrinter::Legal; if (!strcasecmp("Letter", s)) return QPrinter::Letter; if (!strcasecmp("Tabloid", s)) return QPrinter::Tabloid; if (ok) *ok = false; return QPrinter::A4; } /*! Read orientation from a string, possible values are landscape and portrait (case insensitive) \param s The string containing the orientation \param ok If supplied indicates whether the s was valid */ QPrinter::Orientation Settings::strToOrientation(const char * s, bool * ok) { if (ok) *ok = true; if (!strcasecmp(s,"Landscape")) return QPrinter::Landscape; if (!strcasecmp(s,"Portrait")) return QPrinter::Portrait; if (ok) *ok = false; return QPrinter::Portrait; } /*! Parse a string describing a distance, into a real number and a unit. \param o Tho string describing the distance \param ok If supplied indicates whether the s was valid */ QPair Settings::strToUnitReal(const char * o, bool * ok) { qreal s=1.0; //Since not all units are provided by qt, we use this variable to scale //Them into units that are. QPrinter::Unit u=QPrinter::Millimeter; //Skip the real number part int i=0; while ('0' <= o[i] && o[i] <= '9') ++i; if (o[i] == '.' || o[i] == '.') ++i; while ('0' <= o[i] && o[i] <= '9') ++i; //Try to match the unit used if (!strcasecmp(o+i,"") || !strcasecmp(o+i,"mm") || !strcasecmp(o+i,"millimeter")) { u=QPrinter::Millimeter; } else if (!strcasecmp(o+i,"cm") || !strcasecmp(o+i,"centimeter")) { u=QPrinter::Millimeter; s=10.0; //1cm=10mm } else if (!strcasecmp(o+i,"m") || !strcasecmp(o+i,"meter")) { u=QPrinter::Millimeter; s=1000.0; //1m=1000m } else if (!strcasecmp(o+i,"didot")) u=QPrinter::Didot; //Todo is there a short for didot?? else if (!strcasecmp(o+i,"inch") || !strcasecmp(o+i,"in")) u=QPrinter::Inch; else if (!strcasecmp(o+i,"pica") || !strcasecmp(o+i,"pc")) u=QPrinter::Pica; else if (!strcasecmp(o+i,"cicero")) u=QPrinter::Cicero; else if (!strcasecmp(o+i,"pixel") || !strcasecmp(o+i,"px")) u=QPrinter::DevicePixel; else if (!strcasecmp(o+i,"point") || !strcasecmp(o+i,"pt")) u=QPrinter::Point; else { if(ok) ok=false; return qMakePair((qreal)QString(o).left(i).toDouble()*s, u); } return qMakePair((qreal)QString(o).left(i).toDouble(ok)*s, u); } /*! Read proxy settings from a string, the grammar is described in the manual \param proxy the proxy string to parse \param ok If supplied indicates whether the proxy was valid */ Settings::ProxySettings Settings::strToProxy(const char * proxy, bool * ok) { Settings::ProxySettings p; if(ok) *ok=true; //Allow users to use no proxy, even if one is specified in the env if (!strcmp(proxy,"none")) { p.host = ""; return p; } p.type = QNetworkProxy::HttpProxy; //Read proxy type bit "http://" or "socks5://" if (!strncmp(proxy,"http://",7)) { proxy += 7; } else if (!strncmp(proxy,"socks5://",9)) { p.type = QNetworkProxy::Socks5Proxy; proxy += 9; } //Read username and password char * val = (char *) strchr(proxy,'@'); p.user = p.password = ""; if (val != NULL) { p.user = QString(proxy).left(val-proxy); proxy = val+1; int idx = p.user.indexOf(':'); if(idx != -1) { p.password = p.user.mid(idx+1); p.user = p.user.left(idx); } } //Read hostname and port val = (char *) strchr(proxy,':'); p.port = 1080; //Default proxy port if (val == NULL) p.host = proxy; else { p.port = QString(val+1).toInt(ok); if(p.port < 0 || p.port > 65535) { p.port = 1080; *ok = false; } p.host = QString(proxy).left(val-proxy); } if(ok && p.host.size() == 0) *ok = false; return p; } wkhtmltopdf-0.9.9.orig/src/commandlineparser.cc0000644000000000000000000002171711376515611016540 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "commandlineparser_p.hh" #include /*! \file commandlineparser.hh \brief Defines the CommandLineParser class */ /*! \file commandlineparser_p.hh \brief Defines the CommandLineParserPrivate, ArgHandler and Outputter class */ bool ahsort(const ArgHandler * a, const ArgHandler * b) { return a->longName < b->longName; } /*! Output description of switches to an outputter \param o The outputter to output to \param extended Should we also output extended arguments \param doc Indicate to the outputter that it is writing documentation */ void CommandLineParserPrivate::outputSwitches(Outputter * o, bool extended, bool doc) const { foreach(const QString & section, sections) { QList display; foreach(const ArgHandler * handler, sectionArgumentHandles[section]) { #ifndef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ if(!doc && handler->qthack) continue; #else Q_UNUSED(doc); #endif if(!extended && handler->extended) continue; display.push_back(handler); } qSort(display.begin(), display.end(), ahsort); if(display.size() == 0) continue; o->beginSection(section); if(!sectionDesc[section].isEmpty()) { o->beginParagraph(); o->text(sectionDesc[section]); o->endParagraph(); } o->beginSwitch(); foreach(const ArgHandler * handler, display) o->cswitch(handler); o->endSwitch(); o->endSection(); } } /*! Output the man page to a given file \param fd The file to store the man page */ void CommandLineParserPrivate::manpage(FILE * fd) const { Outputter * o = Outputter::man(fd); outputManName(o); outputSynopsis(o); outputDescripton(o); outputSwitches(o, true, false); #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ outputProxyDoc(o); outputHeaderFooterDoc(o); outputOutlineDoc(o); #else outputNotPatched(o,true); #endif outputPageSizes(o); outputArgsFromStdin(o); outputPageBreakDoc(o); outputContact(o); outputAuthors(o); delete o; } /*! Output usage information aka. --help \param fd The file to output the information to \param extended Should we show extended arguments */ void CommandLineParserPrivate::usage(FILE * fd, bool extended) const { Outputter * o = Outputter::text(fd,false); outputName(o); outputSynopsis(o); outputDescripton(o); outputSwitches(o, extended, false); #ifndef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ outputNotPatched(o, true); #endif if (extended) { outputPageSizes(o); outputArgsFromStdin(o); outputProxyDoc(o); outputHeaderFooterDoc(o); outputOutlineDoc(o); } outputContact(o); delete o; } /*! Output version information aka. --version \param fd The file to output to */ void CommandLineParserPrivate::version(FILE * fd) const { Outputter * o = Outputter::text(fd,false); outputName(o); outputLicense(o); outputAuthors(o); delete o; } /*! Output the readme/manual \param fd The file to output to \param html Do we want the html manaul, or the README */ void CommandLineParserPrivate::readme(FILE * fd, bool html) const { Outputter * o = html?Outputter::html(fd):Outputter::text(fd, true); outputDocStart(o); outputContact(o); outputNotPatched(o, false); outputLicense(o); outputAuthors(o); outputSynopsis(o); outputSwitches(o, true, true); outputProxyDoc(o); outputHeaderFooterDoc(o); outputOutlineDoc(o); outputPageBreakDoc(o); outputPageSizes(o); outputArgsFromStdin(o); outputStaticProblems(o); outputCompilation(o); outputInstallation(o); outputExampels(o); delete o; } /*! Output usage information aka. --help \param fd The file to output the information to \param extended Should we show extended arguments */ void CommandLineParser::usage(FILE * fd, bool extended) const { d->usage(fd, extended); } /*! Output version information aka. --version \param fd The file to output to */ void CommandLineParser::version(FILE * fd) const { d->version(fd); } /*! Output the man page to a given file \param fd The file to store the man page */ void CommandLineParser::manpage(FILE * fd) const { d->manpage(fd); } /*! Output the readme/manual \param fd The file to output to \param html Do we want the html manaul, or the README */ void CommandLineParser::readme(FILE * fd, bool html) const { d->readme(fd,html); } /*! Construct a commandline parser, storing its values in some settings \param s The settings to store the values in. */ CommandLineParser::CommandLineParser(Settings & s): d(new CommandLineParserPrivate(s)) { } CommandLineParser::~CommandLineParser() { delete d; } /*! * Load default arguments and put them in the settings structure */ void CommandLineParser::loadDefaults() { d->settings.in.clear(); d->settings.proxy.host = ""; foreach(ArgHandler * h, d->longToHandler) h->useDefault(*d); //Load configuration from enviornment char * val; const char * vars[] = {"proxy","all_proxy","http_proxy", NULL}; for(int i=0; vars[i]; ++i) { if ((val = getenv("proxy"))) { bool ok=false; Settings::ProxySettings p = Settings::strToProxy(val, &ok); if(ok) d->settings.proxy = p; } } } /*! * Parse command line arguments, and set settings accordingly. * \param argc the number of command line arguments * \param argv a NULL terminated list with the arguments */ void CommandLineParser::parseArguments(int argc, const char ** argv, bool final) { bool defaultMode = false; for (int i=1; i < argc; ++i) { if (argv[i][0] != '-' || argv[i][1] == '\0' || defaultMode ) { //Default arguments alwayes input or output files, //The following code is a bit of a hack, we register all //default arguments as input urls, we then later //extract the last one to use as output d->settings.in.push_back(QString::fromLocal8Bit(argv[i]) ); } else if (argv[i][1] == '-') { //We have a long style argument //After an -- apperas in the argument list all that follows is interpited as default arguments if (argv[i][2] == '0') { defaultMode=true; continue; } //Try to find a handler for this long switch QHash::iterator j = d->longToHandler.find(argv[i]+2); if (j == d->longToHandler.end()) { //Ups that argument did not exist fprintf(stderr, "Unknown long argument %s\n\n", argv[i]); d->usage(stderr, false); exit(1); } //Check to see if there is enough arguments to the switch if (argc-i < j.value()->argn.size()+1) { fprintf(stderr, "Not enough arguments parsed to %s\n\n", argv[i]); d->usage(stderr, false); exit(1); } if (!(*(j.value()))(argv+i+1, *d)) { fprintf(stderr, "Invalid argument(s) parsed to %s\n\n", argv[i]); d->usage(stderr, false); exit(1); } #ifndef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ if (j.value()->qthack) fprintf(stderr, "The switch %s, is not support using unpatched qt, and will be ignored.", argv[i]); #endif //Skip allredy handled switch arguments i += j.value()->argn.size(); } else { int c=i;//Remember the current argument we are parsing for (int j=1; argv[c][j] != '\0'; ++j) { QHash::iterator k = d->shortToHandler.find(argv[c][j]); //If the short argument is invalid print usage information and exit if (k == d->shortToHandler.end()) { fprintf(stderr, "Unknown switch -%c\n\n", argv[c][j]); d->usage(stderr, false); exit(1); } //Check to see if there is enough arguments to the switch if (argc-i < k.value()->argn.size()+1) { fprintf(stderr, "Not enough arguments parsed to -%c\n\n", argv[c][j]); d->usage(stderr, false); exit(1); } if (!(*(k.value()))(argv+i+1, *d)) { fprintf(stderr, "Invalid argument(s) parsed to -%c\n\n", argv[c][j]); d->usage(stderr, false); exit(1); } #ifndef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ if (k.value()->qthack) fprintf(stderr, "The switch -%c, is not support using unpatched qt, and will be ignored.", argv[c][j]); #endif //Skip allredy handled switch arguments i += k.value()->argn.size(); } } } if(final || ! d->settings.readArgsFromStdin) { if (d->settings.in.size() < 2) { fprintf(stderr, "You need to specify atleast one input file, and exactly one output file\nUse - for stdin or stdout\n\n"); d->usage(stderr, false); exit(1); } //The last default argument was realy the name of the output file d->settings.out = d->settings.in.back(); d->settings.in.pop_back(); } } wkhtmltopdf-0.9.9.orig/src/textoutputter.cc0000644000000000000000000000732411376515611016013 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "commandlineparser_p.hh" #include #define S(t) (doc?(t).toUtf8().constData():(t).toLocal8Bit().constData()) class TextOutputter: public Outputter { public: FILE * fd; static const int lw = 80; int w; bool doc; bool extended; bool first; int order; TextOutputter(FILE * _, bool d, bool e): fd(_), doc(d), extended(e) {} void beginSection(const QString & name) { if(doc) { int x= 80 - name.size() - 4; if(x < 6) x = 60; for(int i=0; i < x/2; ++i) fprintf(fd, "="); fprintf(fd, "> %s <", S(name) ); for(int i=0; i < (x+1)/2; ++i) fprintf(fd, "="); fprintf(fd, "\n"); } else fprintf(fd, "%s:\n", S(name) ); } void endSection() { } void beginParagraph() { first=true; if(doc) { w=0; } else { w=2; fprintf(fd," "); } } void text(const QString & t) { first=true; QStringList list = t.split(" "); foreach(const QString & s, list) { if( w + s.size() + (first?0:1) > lw) { fprintf(fd, "\n"); if(doc) { w=0; } else { w=2; fprintf(fd," "); } first=true; } if(first) first=false; else { fprintf(fd, " "); ++w; } w += s.size(); fprintf(fd, "%s", S(s)); } } void bold(const QString & t) { text("*"+t+"*"); } void italic(const QString & t) { text("_"+t+"_"); } void link(const QString & t) { text("<"+t+">"); } void endParagraph() { fprintf(fd,"\n\n"); } void verbatim(const QString & t) { if(doc) fprintf(fd,"%s\n", S(t)); else { foreach(const QString & s, t.split("\n")) fprintf(fd," %s\n",S(s)); } } void beginList(bool ordered) { order=ordered?1:-1; } void endList() { fprintf(fd,"\n"); } void listItem(const QString & s) { if (order < 0) fprintf(fd, " * "); else fprintf(fd, "%3d ", order++); fprintf(fd,"%s\n",S(s)); } void beginSwitch() {} void cswitch(const ArgHandler * h) { w=0; if(!doc) {fprintf(fd," "); w=2;} if(h->shortSwitch != 0) fprintf(fd,"-%c, ",h->shortSwitch); else fprintf(fd," "); fprintf(fd,"--%s",S(h->longName)); w+=4 + 2 + h->longName.size(); if (doc && h->qthack) { fprintf(fd, " *"); w += 2; } foreach(const QString & arg, h->argn) { fprintf(fd," <%s>",S(arg)); w+=3+arg.size(); } while(w < 37) { fprintf(fd," "); ++w; } foreach(const QString & s, h->getDesc().split(" ")) { if(w+1+s.size() > lw) { printf("\n"); w=0; while(w < 37) { fprintf(fd," "); ++w; } } fprintf(fd, " %s", S(s)); w += s.size() + 1; } fprintf(fd,"\n"); } void endSwitch() { if (doc) fprintf(fd, "\nItems marked * are only available using patched QT.\n"); printf("\n"); } }; /*! Create a raw text outputter, used for outputting --help and readme \param fd A file description to output to \param doc Ouput in readme format \param extended Output extended options */ Outputter * Outputter::text(FILE * fd, bool doc, bool extended) { return new TextOutputter(fd, doc, extended); } wkhtmltopdf-0.9.9.orig/src/wkhtmltopdf.cc0000644000000000000000000001424711376515611015400 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "commandlineparser.hh" #include "pageconverter.hh" #include "progressfeedback.hh" #include "settings.hh" #include #include #include #include #include #include #include #include #include #include #include #ifdef QT_STATIC //When doing a static build, we need to load the plugins to make images work Q_IMPORT_PLUGIN(qjpeg) Q_IMPORT_PLUGIN(qgif) Q_IMPORT_PLUGIN(qtiff) Q_IMPORT_PLUGIN(qmng) #endif /*! * State mashine driven, shell like parser. This is used for * reading commandline options from stdin * \param buff the line to parse * \param nargc on return will hold the number of arguments read * \param nargv on return will hold the argumenst read and be NULL terminated */ enum State {skip, tok, q1, q2, q1_esc, q2_esc, tok_esc}; void parseString(char * buff, int &nargc, char **nargv) { State state = skip; int write_start=0; int write=0; for (int read=0; buff[read]!='\0'; ++read) { State next_state=state; switch (state) { case skip: //Whitespace skipping state if (buff[read]!=' ' && buff[read]!='\t' && buff[read]!='\r' && buff[read]!='\n') { --read; next_state=tok; } break; case tok: //Normal toking reading state if (buff[read]=='\'') next_state=q1; else if (buff[read]=='"') next_state=q2; else if (buff[read]=='\\') next_state=tok_esc; else if (buff[read]==' ' || buff[read]=='\t' || buff[read]=='\n' || buff[read]=='\r') { next_state=skip; if (write_start != write) { buff[write++]='\0'; nargv[nargc++] = buff+write_start; if (nargc > 998) exit(1); } write_start = write; } else buff[write++] = buff[read]; break; case q1: //State parsing a single qoute argument if (buff[read]=='\'') next_state=tok; else if (buff[read]=='\\') next_state=q1_esc; else buff[write++] = buff[read]; break; case q2: //State parsing a double qoute argument if (buff[read]=='"') next_state=tok; else if (buff[read]=='\\') next_state=q2_esc; else buff[write++] = buff[read]; break; case tok_esc: //Escape one char and return to the tokan parsing state next_state=tok; buff[write++] = buff[read]; break; case q1_esc: //Espace one char and return to the single quote parsing state next_state=q1; buff[write++] = buff[read]; break; case q2_esc: //Escape one char and return to the double qoute parsing state next_state=q2; buff[write++] = buff[read]; break; } state=next_state; } //Remember the last parameter if (write_start != write) { buff[write++]='\0'; nargv[nargc++] = buff+write_start; } nargv[nargc]=NULL; } class MyLooksStyle: public QCleanlooksStyle { public: Settings & settings; typedef QCleanlooksStyle parent_t; MyLooksStyle(Settings & s): settings(s) {} void drawPrimitive( PrimitiveElement element, const QStyleOption * option, QPainter * painter, const QWidget * widget = 0 ) const { painter->setBrush(Qt::white); painter->setPen(QPen(Qt::black, 0.7)); QRect r = option->rect; if (element == QStyle::PE_PanelLineEdit) { painter->drawRect(r); } else if(element == QStyle::PE_IndicatorCheckBox) { painter->drawRect(r); if (!settings.produceForms && (option->state & QStyle::State_On)) { r.translate(r.width()*0.075, r.width()*0.075); painter->drawLine(r.topLeft(), r.bottomRight()); painter->drawLine(r.topRight(), r.bottomLeft()); } } else if(element == QStyle::PE_IndicatorRadioButton) { painter->drawEllipse(r); if (!settings.produceForms && (option->state & QStyle::State_On)) { r.translate(r.width()*0.20, r.width()*0.20); r.setWidth(r.width()*0.70); r.setHeight(r.height()*0.70); painter->setBrush(Qt::black); painter->drawEllipse(r); } } else { parent_t::drawPrimitive(element, option, painter, widget); } } }; int main(int argc, char * argv[]) { //This will store all our settings Settings settings; //Create a command line parser to parse commandline arguments CommandLineParser parser(settings); //Setup default values in settings parser.loadDefaults(); //Parse the arguments parser.parseArguments(argc, (const char**)argv); //Construct QApplication required for printing bool use_graphics=true; #ifdef Q_WS_X11 #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ use_graphics=settings.useGraphics; if (!use_graphics) QApplication::setGraphicsSystem("raster"); #endif #endif QApplication a(argc, argv, use_graphics); a.setStyle(new MyLooksStyle(settings)); if (settings.readArgsFromStdin) { char buff[20400]; char *nargv[1000]; nargv[0] = argv[0]; while (fgets(buff,20398,stdin)) { //x.resetPages(); int nargc=1; parseString(buff,nargc,nargv); CommandLineParser parser(settings); //Setup default values in settings parser.loadDefaults(); //Parse the arguments parser.parseArguments(argc, (const char**)argv); parser.parseArguments(nargc, (const char**)nargv, true); PageConverter converter(settings); ProgressFeedback feedback(converter); if (!converter.convert()) exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); } //Create the actual page converter to convert the pages PageConverter converter(settings); ProgressFeedback feedback(converter); if (!converter.convert()) return EXIT_FAILURE; switch(converter.httpErrorCode()) { case 401: return 3; case 404: return 2; case 0: return EXIT_SUCCESS; default: return EXIT_FAILURE; } } wkhtmltopdf-0.9.9.orig/src/progressfeedback.cc0000644000000000000000000000610111376515611016334 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "progressfeedback.hh" /*! \file progressfeedback.hh \brief Define the ProgressFeedback class */ /*! \class ProgressFeedback \brief Produce progress feedback on the terminal */ #define S(t) ((t).toLocal8Bit().constData()) /*! \brief Write out a warning message \param message The warning message */ void ProgressFeedback::warning(const QString &message) { if (pageConverter.settings().quiet) return; fprintf(stderr, "Warning: %s",S(message)); for(int l = 9 + message.size(); l < lw; ++l) fprintf(stderr, " "); fprintf(stderr, "\n"); lw = 0; } /*! \brief Write out an error message \param message The error message */ void ProgressFeedback::error(const QString &message) { fprintf(stderr, "Error: %s",S(message)); for(int l = 7 + message.size(); l < lw; ++l) fprintf(stderr, " "); fprintf(stderr, "\n"); lw = 0; } /*! \brief Write out the name of the next phase */ void ProgressFeedback::phaseChanged() { if (pageConverter.settings().quiet) return; QString desc=pageConverter.phaseDescription(); fprintf(stderr, "%s", S(desc)); int l = desc.size(); if(pageConverter.currentPhase() < pageConverter.phaseCount() -1) l += fprintf(stderr," (%d/%d)",pageConverter.currentPhase()+1,pageConverter.phaseCount()-1); for(; l < lw; ++l) fprintf(stderr, " "); fprintf(stderr, "\n"); lw = 0; } /*! \brief Update progress bar */ void ProgressFeedback::progressChanged(int progress) { if (pageConverter.settings().quiet) return; fprintf(stderr, "["); int w=60; progress *= w; progress /= 100; for (int i=0; i < w; ++i) { if (i < progress) fprintf(stderr, "="); else if (i == progress) fprintf(stderr, ">"); else fprintf(stderr, " "); } fprintf(stderr, "]"); fprintf(stderr, " %s", S(pageConverter.progressString())); int l=1+w+2+pageConverter.progressString().size(); for(int i=l; i < lw; ++i) fprintf(stderr, " "); lw = l; fprintf(stderr, "\r"); } ProgressFeedback::ProgressFeedback(PageConverter & _): pageConverter(_), lw(0) { connect(&pageConverter, SIGNAL(warning(const QString &)), this, SLOT(warning(const QString &))); connect(&pageConverter, SIGNAL(error(const QString &)), this, SLOT(error(const QString &))); connect(&pageConverter, SIGNAL(phaseChanged()), this, SLOT(phaseChanged())); connect(&pageConverter, SIGNAL(progressChanged(int)), this, SLOT(progressChanged(int))); } wkhtmltopdf-0.9.9.orig/src/pageconverter_p.hh0000644000000000000000000000557111376515611016232 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __TEXTUALFEEDBACK_P_HH__ #define __TEXTUALFEEDBACK_P_HH__ #include "multipageloader.hh" #include "outline.hh" #include "pageconverter.hh" #include "tempfile.hh" #include "tocprinter.hh" #include #include #include #include #include #include #include #include #include #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ #include #endif class PageConverterPrivate: public QObject { Q_OBJECT public: PageConverterPrivate(Settings & s, PageConverter & o); ~PageConverterPrivate(); void copyFile(QFile & src, QFile & dst); QList phaseDescriptions; int currentPhase; Settings & settings; MultiPageLoader pageLoader; QString progressString; private: PageConverter & outer; void clearResources(); TempFile tempOut; bool error; QList pages; QPrinter * printer; QPainter * painter; QString lout; int logicalPages; int logicalPage; int actualPages; int tocPages; bool convertionDone; #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ MultiPageLoader hfLoader; QHash > anchors; QHash > > localLinks; QHash > > externalLinks; QHash urlToDoc; QList headers; QList footers; Outline * outline; TocPrinter * tocPrinter; void findLinks(QWebFrame * frame, QVector > & local, QVector > & external); void beginPage(int & actualPage, bool & first); void endPage(bool actual, bool hasHeaderFooter); void fillParms(QHash & parms, int page); QString hfreplace(const QString & q, const QHash & parms); QWebPage * loadHeaderFooter(QString url, const QHash & parms); #endif void fail(); public slots: void loadProgress(int progress); void preparePrint(bool ok); void printPage(bool ok); void beginConvert(); void cancel(); bool convert(); void forwardError(QString error); void forwardWarning(QString warning); }; #endif //__TEXTUALFEEDBACK_P_HH__ wkhtmltopdf-0.9.9.orig/src/commandlineparser_p.hh0000644000000000000000000000750211376515611017065 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __COMMMAND_LINE_PARSER_P_HH__ #define __COMMMAND_LINE_PARSER_P_HH__ #include #include #include "commandlineparser.hh" #include "settings.hh" class CommandLineParserPrivate; class ArgHandler { public: QString longName; QString desc; char shortSwitch; QVector argn; bool display; bool extended; bool qthack; virtual bool operator() (const char ** args, CommandLineParserPrivate & parser) = 0; virtual void useDefault(CommandLineParserPrivate & parser); virtual QString getDesc() const; virtual ~ArgHandler(); }; class Outputter { public: virtual ~Outputter() {} virtual void beginSection(const QString & name) = 0; virtual void endSection() = 0; virtual void beginParagraph() = 0; virtual void text(const QString & t) = 0; virtual void bold(const QString & t) = 0; virtual void italic(const QString & t) = 0; virtual void link(const QString & l) = 0; virtual void endParagraph() = 0; virtual void verbatim(const QString & t) = 0; virtual void beginList(bool ordered=false) = 0; virtual void endList() = 0; virtual void listItem(const QString & t) = 0; virtual void beginSwitch() = 0; virtual void cswitch(const ArgHandler * h) = 0; virtual void endSwitch() = 0; void paragraph(const QString & t); static Outputter * text(FILE * fd, bool doc=false, bool extended=false); static Outputter * man(FILE * fd); static Outputter * html(FILE * fd); }; class CommandLineParserPrivate { public: QString currentSection; Settings & settings; bool currentExtended; bool currentHack; QList sections; QHash longToHandler; QHash shortToHandler; QHash > sectionArgumentHandles; QHash sectionDesc; //arguments.cc CommandLineParserPrivate(Settings & s); void section(QString s, QString desc=""); void qthack(bool); void extended(bool); void addarg(QString, char, QString, ArgHandler * h, bool display=true); //docparts.cc void outputManName(Outputter * o) const; void outputName(Outputter * o) const; void outputLicense(Outputter * o) const; void outputAuthors(Outputter * o) const; void outputSynopsis(Outputter * o) const; void outputDescripton(Outputter * o) const; void outputProxyDoc(Outputter * o) const; void outputPageSizes(Outputter * o) const; void outputArgsFromStdin(Outputter * o) const; void outputHeaderFooterDoc(Outputter * o) const; void outputOutlineDoc(Outputter * o) const; void outputNotPatched(Outputter * o, bool sure) const; void outputPageBreakDoc(Outputter * o) const; void outputContact(Outputter * o) const; void outputDocStart(Outputter * o) const; void outputCompilation(Outputter * o) const; void outputInstallation(Outputter * o) const; void outputExampels(Outputter * o) const; void outputStaticProblems(Outputter * o) const; //commandlineparser.cc void outputSwitches(Outputter * o, bool extended, bool doc) const; void version(FILE * fd) const; void usage(FILE * fd, bool extended) const; void manpage(FILE * fd) const; void readme(FILE * fd, bool html) const; }; #endif //__COMMMAND_LINE_PARSER_P_HH__ wkhtmltopdf-0.9.9.orig/src/multipageloader_p.hh0000644000000000000000000000653611376515611016546 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "multipageloader.hh" #include "tempfile.hh" #include #include #include #include #include #include #include #include class MyNetworkAccessManager: public QNetworkAccessManager { Q_OBJECT private: bool blockAccess; QSet allowed; public: void allow(QString path); MyNetworkAccessManager(bool block); QNetworkReply * createRequest(Operation op, const QNetworkRequest & req, QIODevice * outgoingData = 0); signals: void warning(const QString & text); }; class MyQWebPage: public QWebPage { Q_OBJECT ; private: Settings & settings; MultiPageLoader & multiPageLoader; public: MyQWebPage(MultiPageLoader & mpl, Settings & s); virtual void javaScriptAlert(QWebFrame * frame, const QString & msg); virtual bool javaScriptConfirm(QWebFrame * frame, const QString & msg); virtual bool javaScriptPrompt(QWebFrame * frame, const QString & msg, const QString & defaultValue, QString * result); virtual void javaScriptConsoleMessage(const QString & message, int lineNumber, const QString & sourceID); public slots: bool shouldInterruptJavaScript(); }; class MyCookieJar: public QNetworkCookieJar { private: QList globalCookies; public: void addGlobalCookie(const QString & name, const QString & value); QList cookiesForUrl(const QUrl & url) const; void loadFromFile(const QString & path); void saveToFile(const QString & path); }; class MultiPageLoaderPrivate: public QObject { Q_OBJECT public: MyCookieJar * cookieJar; MultiPageLoader & outer; Settings & settings; int httpErrorCode; QList pages; QList urls; QList temporaryFiles; int loginTry; MyNetworkAccessManager networkAccessManager; QHash pageToIndex; QList progressList; QList finishedList; QList signalPrintList; int signalPrintSum; int progressSum; int finishedSum; bool loadStartedEmitted; bool error; int loadingPages; TempFile tempIn; MultiPageLoaderPrivate(Settings & s, MultiPageLoader & o); ~MultiPageLoaderPrivate(); QWebPage * addResource(const QUrl & url); void load(); void clearResources(); void cancel(); void fail(); public slots: void warning(const QString & msg); void loadStarted(); void loadProgress(int progress); void loadFinished(bool ok); void timedFinished(); void sslErrors(QNetworkReply *reply, const QList &); void amfinished(QNetworkReply * reply); void authenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator); void printRequested(QWebFrame * frame); }; wkhtmltopdf-0.9.9.orig/src/commandlineparser.hh0000644000000000000000000000260311376515611016543 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __COMMMAND_LINE_PARSER_HH__ #define __COMMMAND_LINE_PARSER_HH__ #include "settings.hh" #include class CommandLineParserPrivate; /*! \brief The class is responcible for parsing command line information */ class CommandLineParser { public: CommandLineParser(Settings & settings); ~CommandLineParser(); void version(FILE * fd) const; void usage(FILE * fd, bool extended) const; void manpage(FILE * fd) const; void readme(FILE * fd, bool html) const; void loadDefaults(); void parseArguments(int argc, const char ** argv, bool final=false); private: CommandLineParserPrivate * d; }; #endif //__COMMMAND_LINE_PARSER_HH__ wkhtmltopdf-0.9.9.orig/src/outputter.cc0000644000000000000000000000503611376515611015104 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include /*! \class Outputter \brief Interface for classes used to output documentation */ /*! \fn Outputter::beginSection(const QString & name) Add a new section to the output \param name The name of the section */ /*! \fn Outputter::endSection() End the current section */ /*! \fn Outputter::beginParagraph() Begin a text paragraph */ /*! \fn Outputter::text(const QString & t) Add some text to the current paragraph \param t The text to add */ /*! \fn Outputter::bold(const QString & t) = 0; Add some bold text to the current paragraph \param t The text to add */ /*! \fn Outputter::italic(const QString & t) Add some italic text tho the current paragraph \param t The text to add */ /*! \fn Outputter::link(const QString & l) Add a hyperlink to somewhere \param l The url to link to */ /*! \fn Outputter::endParagraph() End the current paragraph */ /*! \fn Outputter::verbatim(const QString & t) Add a pice of code or verbatime text \param t The text to add */ /*! \fn Outputter::beginList(bool ordered=false) Begin a ordered or unordered listing \param ordered Should the list be ordered */ /*! \fn Outputter::endList() End the current listing */ /*! \fn Outputter::listItem(QString & t) Add an item to the current listing \param t The text to add */ /*! \fn Outputter::beginSwitch() Begin a section with command line switches */ /*! \fn Outputter::cswitch(const ArgHandler * h, bool doc) Output a switch description \param h The switch to add \param doc Are we outputting to documentation */ /*! \fn Outputter::endSwitch() End a switch section */ /*! Output a paragraph of simple text */ void Outputter::paragraph(const QString & t) { beginParagraph(); text(t); endParagraph(); } wkhtmltopdf-0.9.9.orig/src/outline.cc0000644000000000000000000001632211376515611014510 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "outline_p.hh" #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ /*! \file outline_p.hh \brief Defines the classes OutlinePrivate and OutlineItem */ /*! \class OutlineItem \brief Class describing an item in the outline */ OutlineItem::OutlineItem(): parent(NULL), page(-1) {} /*! \brief Recursivily delete the subtree */ OutlineItem::~OutlineItem() { foreach (OutlineItem * i, children) delete i; } /*! \class OutlinePrivate \brief Class providing implemenation details of Outline */ OutlinePrivate::OutlinePrivate(const Settings & s): settings(s), pageCount(s.pageOffset-1), anchorCounter(0) { } OutlinePrivate::~OutlinePrivate() { foreach (OutlineItem * i, documentOutlines) delete i; } void OutlinePrivate::fillChildAnchors(OutlineItem * item, QHash & anchors) { foreach (OutlineItem * i, item->children) { if (i->anchor.isEmpty()) continue; anchors[i->anchor] = i->element; fillChildAnchors(i, anchors); } } #include #include using namespace std; void OutlinePrivate::outlineChildren(OutlineItem * item, QPrinter * printer, int level) { if (level + 1 > settings.outlineDepth) return; foreach (OutlineItem * i, item->children) { printer->beginSectionOutline(i->value, i->anchor); outlineChildren(i, printer, level+1); printer->endSectionOutline(); } } /* dump outline */ void OutlinePrivate::dumpOutlineChildren(OutlineItem * item, ofstream &dumpfile, int level) { if (level){ dumpfile << "Level: " << level << " "; dumpfile << "Page: " << item->page << " "; dumpfile << "Title: " << item->value.toUtf8().toPercentEncoding().data(); //dumpfile << item->anchor.toUtf8().toPercentEncoding() << " "; dumpfile << "\n"; } if (level + 1 <= settings.outlineDepth){ foreach (OutlineItem * i, item->children) { dumpOutlineChildren(i, dumpfile, level + 1); } } } void Outline::dumpOutline() { if (d->settings.dumpOutline.isEmpty()) return; char * filename = d->settings.dumpOutline.toUtf8().data(); ofstream dumpfile(filename, ios::out); dumpfile << "Pages: " << pageCount() << "\n"; foreach(OutlineItem * i, d->documentOutlines){ d->dumpOutlineChildren(i, dumpfile, 0); } dumpfile.close(); } /*! \file outline.hh \brief Defiens the Outline class */ /*! \class Outline \brief Class responcible for building and keeping an outline of a document. */ /*! \brief Construct a new outline class \param settings The settings to use */ Outline::Outline(const Settings & settings): d(new OutlinePrivate(settings)) {} Outline::~Outline() {delete d;} /*! \brief Add a new webpage to the outline \param name The name of the webpage \param wp A webprinter for the page \param frame The frame containing the webpage */ void Outline::addWebPage(const QString & name, QWebPrinter & wp, QWebFrame * frame) { Q_UNUSED(name); QMap< QPair >, QWebElement> headings; foreach(const QWebElement & e, frame->findAllElements("h1,h2,h3,h4,h5,h6,h7,h8,h9")) { QPair location = wp.elementLocation(e); headings[ qMakePair(location.first, qMakePair(location.second.y(), location.second.x()) ) ] = e; } //This huristic is a little strange, it tries to create a real tree, //even though someone puts a h5 below a h1 or stuff like that //The way this is handled is having a level stack, indicating what h-tags //a level level in the tree currently represents QVector levelStack; levelStack.push_back(0); OutlineItem * root = new OutlineItem(); OutlineItem * old = root; for(QMap< QPair >, QWebElement>::iterator i = headings.begin(); i != headings.end(); ++i) { const QWebElement & element = i.value(); uint level = element.tagName().mid(1).toInt(); OutlineItem * item = new OutlineItem(); item->page = d->pageCount + i.key().first; item->value = element.toPlainText().replace("\n", " "); item->element = element; item->anchor = QString("__WKANCHOR_")+QString::number(d->anchorCounter++,36); while(levelStack.back() >= level) { old = old->parent; levelStack.pop_back(); } item->parent = old; old->children.push_back(item); old = item; levelStack.push_back(level); } d->documentOutlines.push_back(root); d->pageCount += wp.pageCount(); } void OutlinePrivate::buildHFCache(OutlineItem * i, int level) { if (level >= hfCache.size()) return; foreach (OutlineItem * j, i->children) { while (hfCache[level].size() < (int)j->page) hfCache[level].push_back(hfCache[level].back()); if (hfCache[level].size() == (int)j->page) hfCache[level].push_back(j); buildHFCache(j, level+1); } } /*! \brief Fill in header footer parameters for a given page \param page The page to fill in for \param parms The structure to fill */ void Outline::fillHeaderFooterParms(int page, QHash & parms) { //Build hfcache if (d->hfCache.size() == 0) { for (int i=0; i < 3; ++i) { QList< OutlineItem *> x; x.push_back(NULL); d->hfCache.push_back(x); } foreach (OutlineItem * i, d->documentOutlines) d->buildHFCache(i, 0); } for (int i=0; i < 3; ++i) while (d->hfCache[i].size() <= page) d->hfCache[i].push_back(d->hfCache[i].back()); int off = d->settings.pageOffset; typedef QPair SP; foreach (const SP & rep, d->settings.replacements) parms[rep.first] = rep.second; parms["frompage"] = QString::number(off); parms["topage"] = QString::number(off+d->pageCount-1); parms["page" ] = QString::number(page+off-1); parms["webpage"] = "foobar"; parms["section" ] = d->hfCache[0][page]?d->hfCache[0][page]->value:QString(""); parms["subsection" ] = d->hfCache[1][page]?d->hfCache[1][page]->value:QString(""); parms["subsubsection" ] = d->hfCache[2][page]?d->hfCache[2][page]->value:QString(""); } /*! \brief Fill in anchor as to add to a given document \param doc The 0 indexed document number (in order of addWebPage) \param anchors The structure to fill */ void Outline::fillAnchors(int doc, QHash & anchors) { if (doc < 0 || doc >= d->documentOutlines.size()) return; d->fillChildAnchors( d->documentOutlines[doc], anchors ); } /*! \brief return the number of pages in the outlined document */ int Outline::pageCount() { return d->pageCount; } /*! \brief Print the document outline to a given printer \param printer The printer to print to */ void Outline::printOutline(QPrinter * printer) { if (!d->settings.outline) return; foreach(OutlineItem * i, d->documentOutlines) d->outlineChildren(i, printer, 0); } #endif //__EXTENSIVE_WKHTMLTOPDF_QT_HACK__ wkhtmltopdf-0.9.9.orig/src/arguments.cc0000644000000000000000000005276211376515611015046 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "commandlineparser_p.hh" #include /*! \class ArgHandler \brief Class responsible for handling an argument */ /*! \var ArgHandler::longName \brief The long name of the argument, e.g. "help" for "--help" */ /*! \var ArgHandler::desc \brief A descriptive text of the argument */ /*! \var ArgHandler::shortSwitch \brief Sort name, e.g. 'h' for '-h', if 0 there is no short name */ /*! \var ArgHandler::argn \brief The names of the arguments to the switch */ /*! \var ArgHandler::display \brief Indicate that the argument is not hidden */ /*! \var ArgHandler::extended \brief Indicate if the argument is an extended argument */ /*! \var ArgHandler::qthack \brief Indicate that the argument is only available with hacked qt */ /*! \fn ArgHandler::operator()(const char ** args, CommandLineParserPrivate & parser) Callend when the switch was specified \param args The arguments to the switch, guarantied to have size of argn \param settings The settings to store the information in */ /*! \fn ArgHandler::useDefault(CommandLineParserPrivate & parser) Set give settings its default value This is a NOOP for ArgHandler \param parser The parser giving the request */ void ArgHandler::useDefault(CommandLineParserPrivate & parser) { Q_UNUSED(parser); } /*! \fn ArgHandler::getDesc() const Get the description of this switch */ QString ArgHandler::getDesc() const { return desc; } /*! \fn ArgHandler::~ArgHandler() Dummy virtual destructor */ ArgHandler::~ArgHandler() {} /*! \class CommandLineParserPrivate Implementation details for CommandLineParser */ /*! Sets a variable to some constant */ template class ConstSetter: public ArgHandler { public: T & dst; const T src; const T def; ConstSetter(T & arg, const T s, const T d): dst(arg), src(s), def(d) {}; bool operator() (const char **, CommandLineParserPrivate &) { dst=src; return true; } virtual void useDefault(CommandLineParserPrivate &) { dst=def; } }; struct StringPairCreator { typedef QPair T; inline T operator()(const QString & key, const QString & value) const { return T(key, value); } }; template struct PostItemCreator { typedef typename Settings::PostItem T; inline T operator()(const QString & key, const QString & value) const { T p; p.name = key; p.value = value; p.file = file; return p; } }; struct StringListSetter: public ArgHandler { QList & dst; StringListSetter(QList & a, QString valueName) : dst(a) { argn.push_back(valueName); } virtual bool operator() (const char ** args, CommandLineParserPrivate &) { dst.append( args[0] ); return true; } virtual void useDefault() { dst.clear(); } }; /*! Putting values into a map */ template struct MapSetter: public ArgHandler { QList< typename T::T > & dst; MapSetter(QList & a, QString keyName, QString valueName) : dst(a) { argn.push_back(keyName); argn.push_back(valueName); } virtual bool operator() (const char ** args, CommandLineParserPrivate &) { dst.append( T()(args[0], args[1]) ); return true; } virtual void useDefault() { dst.clear(); } }; /*! SomeSetter template method base */ template struct SomeSetterTM { typedef TT T; //T strToT(const char * val, bool & ok); static QString TToStr(const T &, bool & ok) {ok=false; return "";} }; /*! TemplateMethod class used to set a single variable of some type TT::T */ template struct SomeSetter: public ArgHandler { typedef typename TT::T T; T & val; T def; bool hasDef; SomeSetter(T & a, QString an, T d): val(a), def(d), hasDef(true) { argn.push_back(an); } SomeSetter(T & a, QString an): val(a), hasDef(false) { argn.push_back(an); } virtual void useDefault(CommandLineParserPrivate &) { if (hasDef) val=def; } bool operator() (const char ** vals, CommandLineParserPrivate &) { bool ok; val = TT::strToT(vals[0], ok); return ok; } virtual QString getDesc() const { if (!hasDef) return desc; bool ok; QString x = TT::TToStr(def,ok); if (!ok) return desc; return desc + " (default " + x + ")"; } }; struct IntTM: public SomeSetterTM { static int strToT(const char * val, bool & ok) { return QString(val).toInt(&ok); } static QString TToStr(const int & t, bool & ok) { ok=(t!=-1); return QString::number(t); } }; /*! Argument handler setting an int variable */ typedef SomeSetter IntSetter; struct FloatTM: public SomeSetterTM { static float strToT(const char * val, bool & ok) { return QString(val).toFloat(&ok); } static QString TToStr(const float & t, bool & ok) { ok=(t!=-1); return QString::number(t); } }; /*! Argument handler setting an float variable */ typedef SomeSetter FloatSetter; struct StrTM: public SomeSetterTM { static const char * strToT(const char * val, bool & ok) { ok=true; return val; } static QString TToStr(const char * t, bool & ok) { ok = (t[0] != '\0'); return QString(t); } }; /*! Argument handler setting a string variable */ typedef SomeSetter StrSetter; struct QStrTM: public SomeSetterTM { static QString strToT(const char * val, bool & ok) { ok=true; return QString::fromLocal8Bit(val); } static QString TToStr(QString t, bool & ok) { ok=!t.isEmpty(); return t; } }; /*! Argument handler setting a string variable */ typedef SomeSetter QStrSetter; struct UnitRealTM: public SomeSetterTM > { static QPair strToT(const char * val, bool &ok) { return Settings::strToUnitReal(val, &ok); } }; /*! Argument handler setting a real-number/unit combo variable */ typedef SomeSetter UnitRealSetter; struct PageSizeTM: public SomeSetterTM { static QPrinter::PageSize strToT(const char * val, bool &ok) { return Settings::strToPageSize(val, &ok); } }; /*! Argument handler setting a page size variable */ typedef SomeSetter PageSizeSetter; struct ProxyTM: public SomeSetterTM { static Settings::ProxySettings strToT(const char * val, bool &ok) { return Settings::strToProxy(val, &ok); } }; /*! Argument handler setting a proxy variable */ typedef SomeSetter ProxySetter; struct OrientationTM: public SomeSetterTM { static QPrinter::Orientation strToT(const char * val, bool &ok) { return Settings::strToOrientation(val, &ok); } }; /*! Argument handler setting a orientation variable */ typedef SomeSetter OrientationSetter; /*! Argument handler responsible for calling a function */ template struct Caller: public ArgHandler { Caller() {} Caller(QString a1) { argn.push_back(a1); } bool operator() (const char **vals, CommandLineParserPrivate & s) { return T()(vals,s); } }; //All these function would have been lambda function, had C++ supported them, now we are forced to write them here /*! Lambda: Call the usage method */ template struct HelpFunc { bool operator()(const char **, CommandLineParserPrivate & p) { p.usage(stdout,v); exit(0); } }; /*! Lambda: Call the man method */ struct ManPageFunc { bool operator()(const char **, CommandLineParserPrivate & p) { p.manpage(stdout); exit(0); } }; /*! Lambda: Call the man method */ template struct ReadmeFunc { bool operator()(const char **, CommandLineParserPrivate & p) { p.readme(stdout, T); exit(0); } }; /*! Lambda: Call the version method */ struct VersionFunc { bool operator()(const char **, CommandLineParserPrivate & p) { p.version(stdout); exit(0); } }; /*! Set the default header */ struct DefaultHeaderFunc { bool operator()(const char **, CommandLineParserPrivate & p) { p.settings.header.left="[webpage]"; p.settings.header.right="[page]/[toPage]"; p.settings.header.line=true; p.settings.margin.top = Settings::strToUnitReal("2cm"); return true; } }; /*! Setup default book mode */ struct BookFunc { bool operator()(const char **, CommandLineParserPrivate & p) { p.settings.header.left="[section]"; p.settings.header.right="[page]/[toPage]"; p.settings.header.line=true; p.settings.outline = true; p.settings.printToc = true; p.settings.margin.top = Settings::strToUnitReal("2cm"); return true; } }; /*! The next arguments we add will belong to this section /param s The name of the section /param desc A description of the section */ void CommandLineParserPrivate::section(QString s, QString desc) { currentSection = s; sectionDesc[s] = desc; sections.push_back(s); } /*! Indicate whether the next arguments we add require a patched qt to work /param h Do we require a patch */ void CommandLineParserPrivate::qthack(bool h) { currentHack = h; } /*! Indicate whether the next arguments we add are "extended" and should not be shown in a simple --help \param e Are the arguments extended */ void CommandLineParserPrivate::extended(bool e) { currentExtended = e; } /*! Add an argument to the list of arguments \param l The long "--" name of the argument \param s The short '-' name of the argument or 0 if unspecified \param d Description of the argument \param h The handler for the argument \param display Is the argument hidden */ void CommandLineParserPrivate::addarg(QString l, char s, QString d, ArgHandler * h, bool display) { h->desc = d; h->longName = l; h->shortSwitch = s; h->display = display; h->qthack = currentHack; h->extended = currentExtended; longToHandler[l] = h; if(s) shortToHandler[s] = h; sectionArgumentHandles[currentSection].push_back(h); } /*! Construct the commandline parser adding all the arguments \param s The settings to store values in */ CommandLineParserPrivate::CommandLineParserPrivate(Settings & s): settings(s) { section("General Options"); extended(false); qthack(false); addarg("help",'h',"Display help",new Caller >()); addarg("quiet",'q',"Be less verbose",new ConstSetter(s.quiet,true,false)); addarg("version",'V',"Output version information an exit", new Caller()); addarg("extended-help",0,"Display more extensive help, detailing less common command switches", new Caller >()); addarg("collate", 0, "Collate when printing multiple copies", new ConstSetter(s.collate,true,false)); addarg("copies", 0, "Number of copies to print into the pdf file", new IntSetter(s.copies, "number", 1)); addarg("orientation",'O',"Set orientation to Landscape or Portrait", new OrientationSetter(s.orientation, "orientation", QPrinter::Portrait)); addarg("page-size",'s',"Set paper size to: A4, Letter, etc.", new PageSizeSetter(s.size.pageSize, "size", QPrinter::A4)); addarg("proxy",'p',"Use a proxy", new ProxySetter(s.proxy, "proxy")); addarg("username",0,"HTTP Authentication username", new QStrSetter(s.username, "username","")); addarg("password",0,"HTTP Authentication password", new QStrSetter(s.password, "password","")); qthack(true); addarg("book",'b',"Set the options one would usually set when printing a book", new Caller()); addarg("cover",0,"Use html document as cover. It will be inserted before the toc with no headers and footers",new QStrSetter(s.cover,"url","")); addarg("default-header",'H',"Add a default header, with the name of the page to the left, and the page number to the right, this is short for: --header-left='[webpage]' --header-right='[page]/[toPage]' --top 2cm --header-line", new Caller()); addarg("toc",'t',"Insert a table of content in the beginning of the document", new ConstSetter(s.printToc,true,false)); qthack(false); extended(true); addarg("ignore-load-errors", 0, "Ignore pages that claimes to have encountered an error during loading", new ConstSetter(s.ignoreLoadErrors, true, false)); addarg("custom-header",0,"Set an additional HTTP header (repeatable)", new MapSetter<>(s.customHeaders, "name", "value")); addarg("manpage", 0, "Output program man page", new Caller()); addarg("htmldoc", 0, "Output program html help", new Caller >()); addarg("readme", 0, "Output program readme", new Caller >()); addarg("dpi",'d',"Change the dpi explicitly (this has no effect on X11 based systems)", new IntSetter(s.dpi,"dpi",-1)); addarg("page-height", 0, "Page height (default unit millimeter)", new UnitRealSetter(s.size.height,"unitreal",QPair(-1,QPrinter::Millimeter))); addarg("page-width", 0, "Page width (default unit millimeter)", new UnitRealSetter(s.size.width,"unitreal",QPair(-1,QPrinter::Millimeter))); addarg("disable-javascript",'n',"Do not allow web pages to run javascript", new ConstSetter(s.enableJavascript,false,true)); addarg("grayscale",'g',"PDF will be generated in grayscale", new ConstSetter(s.colorMode,QPrinter::GrayScale,QPrinter::Color)); addarg("lowquality",'l',"Generates lower quality pdf/ps. Useful to shrink the result document space", new ConstSetter(s.resolution,QPrinter::ScreenResolution,QPrinter::HighResolution)); addarg("margin-bottom",'B',"Set the page bottom margin (default 10mm)", new UnitRealSetter(s.margin.bottom,"unitreal",QPair(10,QPrinter::Millimeter))); addarg("margin-left",'L',"Set the page left margin (default 10mm)", new UnitRealSetter(s.margin.left,"unitreal",QPair(10,QPrinter::Millimeter))); addarg("margin-right",'R',"Set the page right margin (default 10mm)", new UnitRealSetter(s.margin.right,"unitreal",QPair(10,QPrinter::Millimeter))); addarg("margin-top",'T',"Set the page top margin (default 10mm)", new UnitRealSetter(s.margin.top,"unitreal",QPair(10,QPrinter::Millimeter))); addarg("redirect-delay",0,"Wait some milliseconds for js-redirects", new IntSetter(s.jsredirectwait,"msec",200)); addarg("enable-plugins",0,"Enable installed plugins (such as flash", new ConstSetter(s.enablePlugins,true,false)); addarg("zoom",0,"Use this zoom factor", new FloatSetter(s.zoomFactor,"float",1.0)); addarg("minimum-font-size",0,"Minimum font size", new IntSetter(s.minimumFontSize,"int",5)); addarg("read-args-from-stdin",0,"Read command line arguments from stdin", new ConstSetter(s.readArgsFromStdin,true,false)); addarg("cookie-jar", 0, "Read and write cookies from and to the supplied cookie jar file", new QStrSetter(s.cookieJar, "path", "") ); addarg("cookie",0,"Set an additional cookie (repeatable)", new MapSetter<>(s.cookies, "name", "value")); addarg("post", 0, "Add an additional post field (repeatable)", new MapSetter >(s.post, "name", "value")); addarg("post-file", 0, "Post an aditional file (repeatable)", new MapSetter >(s.post, "name", "path")); addarg("title", 0, "The title of the generated pdf file (The title of the first document is used if not specified)", new QStrSetter(s.documentTitle,"text","")); addarg("disallow-local-file-access", 0, "Do not allowed conversion of a local file to read in other local files, unless explecitily allowed with --allow", new ConstSetter(s.blockLocalFileAccess, true, false)); addarg("allow", 0, "Allow the file or files from the specified folder to be loaded (repeatable)", new StringListSetter(s.allowed,"path")); qthack(true); addarg("forms", 0, "Turn HTML form fields into pdf form fields", new ConstSetter(s.produceForms, true, false)); addarg("disable-internal-links",0,"Do no make local links", new ConstSetter(s.useLocalLinks,false,true)); addarg("disable-external-links",0,"Do no make links to remote web pages", new ConstSetter(s.useExternalLinks,false,true)); addarg("print-media-type",0,"Use print media-type instead of screen", new ConstSetter(s.printMediaType,true,false)); addarg("page-offset",0,"Set the starting page number", new IntSetter(s.pageOffset,"offset",1)); addarg("disable-smart-shrinking", 0, "Disable the intelligent shrinking strategy used by WebKit that makes the pixel/dpi ratio none constant",new ConstSetter(s.enableIntelligentShrinking, false, true)); addarg("replace",0, "Replace [name] with value in header and footer (repeatable)", new MapSetter<>(s.replacements, "name", "value")); addarg("disable-pdf-compression", 0 , "Do not use lossless compression on pdf objects", new ConstSetter(s.useCompression,false,true)); #ifdef Q_WS_X11 addarg("use-xserver",0,"Use the X server (some plugins and other stuff might not work without X11)", new ConstSetter(s.useGraphics,true,false)); #endif #if QT_VERSION >= 0x040600 qthack(false); #endif addarg("encoding",0,"Set the default text encoding, for input", new QStrSetter(s.defaultEncoding,"encoding","")); qthack(false); #if QT_VERSION >= 0x040500 //Not printing the background was added in QT4.5 addarg("no-background",0,"Do not print background", new ConstSetter(s.background,false,true)); addarg("user-style-sheet",0,"Specify a user style sheet, to load with every page", new QStrSetter(s.userStyleSheet,"url","")); #endif addarg("debug-javascript", 0,"Show javascript debugging output", new ConstSetter(s.debugJavascript, true, false)); #if QT_VERSION >= 0x040600 addarg("stop-slow-scripts", 0, "Stop slow running javascripts", new ConstSetter(s.stopSlowScripts, true, false)); #endif extended(false); section("Headers And Footer Options"); qthack(true); extended(true); addarg("footer-center",0,"Centered footer text", new QStrSetter(s.footer.center,"text","")); addarg("footer-font-name",0,"Set footer font name", new QStrSetter(s.footer.fontName,"name","Arial"));; addarg("footer-font-size",0,"Set footer font size", new IntSetter(s.footer.fontSize,"size",11)); addarg("footer-left",0,"Left aligned footer text", new QStrSetter(s.footer.left,"text","")); addarg("footer-line",0,"Display line above the footer", new ConstSetter(s.footer.line,true,false)); addarg("footer-right",0,"Right aligned footer text", new QStrSetter(s.footer.right,"text","")); addarg("footer-spacing",0,"Spacing between footer and content in mm", new FloatSetter(s.footer.spacing,"real",0.0)); addarg("footer-html",0,"Adds a html footer", new QStrSetter(s.footer.htmlUrl,"url","")); addarg("header-center",0,"Centered header text", new QStrSetter(s.header.center,"text","")); addarg("header-font-name",0,"Set header font name", new QStrSetter(s.header.fontName,"name","Arial")); addarg("header-font-size",0,"Set header font size", new IntSetter(s.header.fontSize,"size",11)); addarg("header-left",0,"Left aligned header text", new QStrSetter(s.header.left,"text","")); addarg("header-line",0,"Display line below the header", new ConstSetter(s.header.line,true,false)); addarg("header-right",0,"Right aligned header text", new QStrSetter(s.header.right,"text","")); addarg("header-spacing",0,"Spacing between header and content in mm", new FloatSetter(s.header.spacing,"real",0.0)); addarg("header-html",0,"Adds a html header", new QStrSetter(s.header.htmlUrl,"url","")); extended(false); qthack(false); section("Table Of Content Options"); extended(true); qthack(true); addarg("toc-font-name",0,"Set the font used for the toc", new QStrSetter(s.toc.fontName,"name","Arial")); addarg("toc-no-dots",0,"Do not use dots, in the toc", new ConstSetter(s.toc.useDots,false,true)); addarg("toc-depth",0,"Set the depth of the toc", new IntSetter(s.toc.depth,"level",3)); addarg("toc-header-text",0,"The header text of the toc", new QStrSetter(s.toc.captionText,"text","Table Of Contents")); addarg("toc-header-font-size",0,"The font size of the toc header", new IntSetter(s.toc.captionFontSize,"size",15)); addarg("toc-header-font-name",0,"The font of the toc header (if unset use --toc-font-name)", new QStrSetter(s.toc.captionFontName,"name")); addarg("toc-disable-links",0,"Do not link from toc to sections", new ConstSetter(s.toc.forwardLinks,false, true)); addarg("toc-disable-back-links",0,"Do not link from section header to toc", new ConstSetter(s.toc.backLinks,false,true)); for (uint i=0; i < Settings::TOCSettings::levels; ++i) { addarg(QString("toc-l")+QString::number(i+1)+"-font-size",0,QString("Set the font size on level ")+QString::number(i+1)+" of the toc",new IntSetter(s.toc.fontSize[i],"size",12-2*i), i < 3); addarg(QString("toc-l")+QString::number(i+1)+"-indentation",0,QString("Set indentation on level ")+QString::number(i+1)+" of the toc",new IntSetter(s.toc.indentation[i],"num",i*20), i < 3); } qthack(true); extended(false); section("Outline Options"); extended(true); qthack(true); addarg("outline",0,"Put an outline into the pdf", new ConstSetter(s.outline,true,false)); addarg("outline-depth",0,"Set the depth of the outline", new IntSetter(s.outlineDepth,"level",4)); addarg("dump-outline",0,"Dump the outline to a file",new QStrSetter(s.dumpOutline,"file","")); qthack(true); extended(false); } wkhtmltopdf-0.9.9.orig/src/tocprinter.hh0000644000000000000000000000243411376515611015233 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __TOCPRINTER_HH__ #define __TOCPRINTER_HH__ #include #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ #include "outline.hh" #include #include class TocPrinterPrivate; class TocPrinter { public: TocPrinter(Outline * outline, QPrinter * printer, QPainter & painter); ~TocPrinter(); int pageCount(); void spoolPage(int page); void fillLinks(int doc, QVector > & links); private: TocPrinterPrivate * d; }; #endif //__EXTENSIVE_WKHTMLTOPDF_QT_HACK__ #endif //__TOCPRINTER_HH wkhtmltopdf-0.9.9.orig/src/outline.hh0000644000000000000000000000270111376515611014516 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __OUTLINE_HH__ #define __OUTLINE_HH__ #include #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ #include #include "settings.hh" class OutlinePrivate; class Outline { public: Outline(const Settings & settings); ~Outline(); void addWebPage(const QString & name, QWebPrinter & wp, QWebFrame * frame); void fillHeaderFooterParms(int page, QHash & parms); void fillAnchors(int d, QHash & anchors); int pageCount(); void printOutline(QPrinter * printer); void dumpOutline(); private: OutlinePrivate * d; friend class TocPrinter; friend class TocPrinterPrivate; }; #endif //__EXTENSIVE_WKHTMLTOPDF_QT_HACK__ #endif //__OUTLINE_HH__ wkhtmltopdf-0.9.9.orig/src/tempfile.cc0000644000000000000000000000302111376515611014626 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "tempfile.hh" #include #include #include /*! \file tempfile.hh \brief Defines the TempFile class */ /*! \class TempFile \brief Class responsible for creating and deleting temporery files */ TempFile::TempFile() { } TempFile::~TempFile() { remove(); } /*! \brief Create a new temporery file, deleteing the old if one exists \param ext The extention of the temporery file \returns Path of the new temporery file */ QString TempFile::create(const QString & ext) { remove(); path = QDir::tempPath()+"/wktemp-"+QUuid::createUuid().toString().mid(1,36)+ext; return path; } /*! \brief Remove the temporery file hold by this object it it exists */ void TempFile::remove() { if (!path.isEmpty()) QFile::remove(path); path=""; } wkhtmltopdf-0.9.9.orig/src/outline_p.hh0000644000000000000000000000322411376515611015036 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __OUTLINE_P_HH #define __OUTLINE_P_HH #include #include "outline.hh" #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ class OutlineItem { public: QList children; OutlineItem * parent; uint page; QString value; QWebElement element; QString anchor; OutlineItem(); ~OutlineItem(); }; class OutlinePrivate { public: const Settings & settings; QList documentOutlines; int pageCount; int anchorCounter; QList< QList< OutlineItem *> > hfCache; OutlinePrivate(const Settings & settings); ~OutlinePrivate(); void fillChildAnchors(OutlineItem * item, QHash & anchors); void outlineChildren(OutlineItem * item, QPrinter * printer, int level); void buildHFCache(OutlineItem * i, int level); void dumpOutlineChildren(OutlineItem * item, std::ofstream &dumpfile, int level); }; #endif //__EXTENSIVE_WKHTMLTOPDF_QT_HACK__ #endif //__OUTLINE_P_HH wkhtmltopdf-0.9.9.orig/src/tocprinter.cc0000644000000000000000000001524711376515611015227 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "tocprinter.hh" #include "outline_p.hh" #include "settings.hh" #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ typedef QPair line_t; /*! We imploy a cheep strategy of not using a render tree, insted we just store the state render state for every page start, the render state is uniquly defined by a OutlineItem, */ class TocPrinterPrivate { public: static const uint levels = Settings::TOCSettings::levels; Outline * outline; QPrinter * printer; QPainter & painter; double dw[levels]; double step[levels]; QVector pageItems; QList< QList< line_t > > pages; TocPrinterPrivate(Outline * o, QPrinter * pr, QPainter & pa); void revLinkChildren(OutlineItem * i, QVector > & links, int level); void renderPage(OutlineItem * & cur, bool first, bool dry); void layoutChildren(OutlineItem * item, double & y, int level); void incChildren(OutlineItem * item); }; void TocPrinterPrivate::incChildren(OutlineItem * item) { foreach (OutlineItem * i, item->children) { i->page += pages.size(); incChildren(i); } } void TocPrinterPrivate::layoutChildren(OutlineItem * item, double & y, int level) { const Settings::TOCSettings & s = outline->d->settings.toc; if (level >= s.depth) return; QRect pr = printer->pageRect(); foreach (OutlineItem * i, item->children) { y += step[level]; if(y > pr.height()) { pages.push_back( QList< QPair >() ); y = step[level]; } pages.back().push_back( qMakePair(level, i) ); layoutChildren(i, y, level+1); } } TocPrinterPrivate::TocPrinterPrivate(Outline * o, QPrinter * pr, QPainter & pa): outline(o), printer(pr), painter(pa) { const Settings::TOCSettings & s = outline->d->settings.toc; painter.save(); painter.resetTransform(); QRectF pageRect = printer->pageRect(); for(uint level=0; level < levels; ++level) { painter.setFont(QFont(s.fontName, s.fontSize[level])); step[level] = painter.fontMetrics().height(); dw[level] = painter.boundingRect(pageRect, Qt::AlignRight | Qt::AlignTop, ".").width(); } painter.setFont(QFont(s.fontName, s.captionFontSize)); //The height of the caption double y = painter.boundingRect(pageRect, Qt::AlignTop | Qt::AlignHCenter, s.captionText).height() * 3; painter.restore(); pages.push_back( QList< QPair >() ); OutlineItem * root = new OutlineItem(); OutlineItem * toc = new OutlineItem(); root->children.push_back(toc); toc->value = s.captionText; toc->anchor = "_WK_TOC"; toc->parent = root; toc->page = outline->d->settings.pageOffset; y += step[0]; pages.back().push_back( qMakePair(0, toc) ); foreach (OutlineItem * i, o->d->documentOutlines) layoutChildren(i, y, 0); outline->d->pageCount += pages.size(); foreach (OutlineItem * i, outline->d->documentOutlines) incChildren(i); outline->d->documentOutlines.push_front(root); } void TocPrinterPrivate::revLinkChildren(OutlineItem * i, QVector > & links, int level) { const Settings::TOCSettings & s = outline->d->settings.toc; if (level >= s.depth) return; foreach (OutlineItem * j,i->children) { links.push_back( qMakePair(j->element, j->anchor+QString("_R") ) ); revLinkChildren(j, links, level+1); } } /*! \file tocprinter.hh \brief Defines the TocPrinter class */ /*! \class TocPrinter \brief Class responsible for rendering a table of content */ TocPrinter::TocPrinter(Outline * outline, QPrinter * printer, QPainter & painter): d(new TocPrinterPrivate(outline, printer, painter)) { } TocPrinter::~TocPrinter() { delete d; } /*! \brief Return the number of pages in the table of content */ int TocPrinter::pageCount() { return d->pages.size(); } /*! \brief Output a given page to the printer \param The page to output, between 1 and pageCount() */ void TocPrinter::spoolPage(int page) { d->painter.save(); d->painter.resetTransform(); d->painter.setBackgroundMode(Qt::TransparentMode); d->painter.setBrush(QBrush(Qt::black)); double y = 0; const Settings::TOCSettings & s = d->outline->d->settings.toc; QRect pr = d->printer->pageRect(); if(page == 0) { double h = d->painter.boundingRect(pr,Qt::AlignTop | Qt::AlignHCenter, s.captionText).height(); QRect r((int)h,0,pr.width(),(int)h*3); d->painter.setFont(QFont(s.captionFontName.isEmpty()?s.fontName:s.captionFontName, s.captionFontSize)); d->painter.drawText(r, Qt::AlignVCenter | Qt::AlignHCenter, s.captionText); d->painter.addAnchor(r, "_WK_TOC"); y += r.height(); } int lvl=-1; foreach (const line_t & line, d->pages[page]) { if (line.first != lvl) { lvl = line.first; d->painter.setFont(QFont(s.fontName, s.fontSize[lvl])); } double startX = pr.width()*s.indentation[lvl]/1000.0; QRectF lineRect(startX,y,pr.width()-startX, d->step[lvl]); QRectF br; d->painter.drawText(lineRect,Qt::AlignBottom | Qt::AlignRight, QString(" ") + QString::number(line.second->page),&br); QString v = line.second->value; lineRect.setRight(br.left()); if (s.useDots) { v.append(' '); //Calculate the number of dots needed to fill the line int ndots = (lineRect.right() - d->painter.boundingRect(lineRect, Qt::AlignLeft, v).right())/d->dw[lvl]; for (int i=0; i < ndots; ++i) v.append("."); } d->painter.drawText(lineRect,Qt::AlignBottom | Qt::AlignLeft, v); QRectF r(0,y, pr.width(), d->step[lvl]); if (s.forwardLinks) d->painter.addLink(r, line.second->anchor); if (s.backLinks) d->painter.addAnchor(r, line.second->anchor+"_R"); y += d->step[lvl]; } d->painter.restore(); } /*! \brief Fill in document link structure with links linking back to the toc. \param doc The 0' indexed document to fill the structure for \param links The structure to fill */ void TocPrinter::fillLinks(int doc, QVector > & links) { if (doc < 0 || doc >= d->outline->d->documentOutlines.size()) return; d->revLinkChildren(d->outline->d->documentOutlines[doc], links, 0); } #endif //__EXTENSIVE_WKHTMLTOPDF_QT_HACK__ wkhtmltopdf-0.9.9.orig/src/pageconverter.hh0000644000000000000000000000303311376515611015702 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __PAGECONVERTER_HH__ #define __PAGECONVERTER_HH__ #include "settings.hh" #include class PageConverterPrivate; class PageConverter: public QObject { Q_OBJECT public: PageConverter(Settings & settings); ~PageConverter(); int phaseCount(); int currentPhase(); QString phaseDescription(int phase=-1); QString progressString(); int httpErrorCode(); void addResource(const QString & url); const Settings & settings() const; signals: void warning(const QString & message); void error(const QString & message); void phaseChanged(); void progressChanged(int progress); void finished(bool ok); public slots: void beginConvertion(); bool convert(); void cancel(); private: PageConverterPrivate * d; friend class PageConverterPrivate; }; #endif //__PAGECONVERTER_HH__ wkhtmltopdf-0.9.9.orig/src/docparts.cc0000644000000000000000000004354211376515611014654 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "commandlineparser_p.hh" #include #define STRINGIZE_(x) #x #define STRINGIZE(x) STRINGIZE_(x) /*! Output the name and version of the program, and also whether we are using a patched qt \param o The outputter to output to */ void CommandLineParserPrivate::outputName(Outputter * o) const { o->beginSection("Name"); o->paragraph(QString("wkhtmltopdf ")+QString::number(MAJOR_VERSION)+"."+QString::number(MINOR_VERSION)+"."+QString::number(PATCH_VERSION)+(QString(STRINGIZE(BUILD)).isEmpty()?"":" ")+STRINGIZE(BUILD)); o->endSection(); } /*! Output name and a short description \param o The outputter to output to */ void CommandLineParserPrivate::outputManName(Outputter * o) const { o->beginSection("Name"); o->paragraph("wkhtmltopdf - html to pdf converter"); o->endSection(); } /*! Output copyright stuff \param o The outputter to output to */ void CommandLineParserPrivate::outputLicense(Outputter * o) const { o->beginSection("License"); o->paragraph("Copyright (C) 2008,2009 Wkhtmltopdf Authors."); o->endParagraph(); o->beginParagraph(); o->text("License GPLv3+: GNU GPL version 3 or later "); o->link("http://gnu.org/licenses/gpl.html"); o->text(". This is free software: you are free to change and redistribute it. " "There is NO WARRANTY, to the extent permitted by law."); o->endParagraph(); } /*! Output list of authors \param o The outputter to output to */ void CommandLineParserPrivate::outputAuthors(Outputter * o) const { o->beginSection("Authors"); o->paragraph( QString::fromUtf8( "Written by Jakob Truelsen. " "Patches by Mário Silva, Benoit Garret and Emmanuel Bouthenot.")); o->endSection(); } /*! Output a short synopsis on how to call the command line program \param o The outputter to output to */ void CommandLineParserPrivate::outputSynopsis(Outputter * o) const { o->beginSection("Synopsis"); o->verbatim("wkhtmltopdf [OPTIONS]... [More input files] \n"); o->endSection(); } /*! Explain what the program does \param o The outputter to output to */ void CommandLineParserPrivate::outputDescripton(Outputter * o) const { o->beginSection("Description"); o->beginParagraph(); o->text("Converts one or more HTML pages into a PDF document, "); #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ o->text("using wkhtmltopdf patched qt."); #else o->bold("not"); o->text(" using wkhtmltopdf patched qt."); #endif o->endParagraph(); o->endSection(); } /*! Add explanation about reduced functionality without patched qt/webkit \param o The outputter to output to \param sure Is the functionality restricted in this wkhtmltopdf */ void CommandLineParserPrivate::outputNotPatched(Outputter * o, bool sure) const { o->beginSection("Reduced Functionality"); if (sure) o->paragraph("This version of wkhtmltopdf has been compiled against a version of " "QT without the wkhtmltopdf patches. Therefore some features are missing, " "if you need these features please use the static version."); else o->paragraph("Some versions of wkhtmltopdf are compiled against a version of QT " "without the wkhtmltopdf patches. These versions are missing some features, " "you can find out if your version of wkhtmltopdf is one of these by running wkhtmltopdf --version " "if your version is against an unpatched QT, you can use the static version to get all functionality."); o->paragraph("Currently the list of features only supported with patch QT includes:"); o->beginList(); o->listItem("Printing more then one HTML document into a PDF file."); o->listItem("Running without an X11 server."); o->listItem("Adding a document outline to the PDF file."); o->listItem("Adding headers and footers to the PDF file."); o->listItem("Generating a table of contents."); o->listItem("Adding links in the generated PDF file."); o->listItem("Printing using the screen media-type."); o->listItem("Disabling the smart shrink feature of webkit."); o->endList(); o->endSection(); } /*! Explain the page breaking is somewhat broken \param o The outputter to output to */ void CommandLineParserPrivate::outputPageBreakDoc(Outputter * o) const { o->beginSection("Page Breaking"); o->paragraph( "The current page breaking algorithm of WebKit leaves much to be desired. " "Basically webkit will render everything into one long page, and then cut it up " "into pages. This means that if you have two columns of text where one is " "vertically shifted by half a line. Then webkit will cut a line into to pieces " "display the top half on one page. And the bottom half on another page. " "It will also break image in two and so on. If you are using the patched version of " "QT you can use the CSS page-break-inside property to remedy this somewhat. " "There is no easy solution to this problem, until this is solved try organising " "your HTML documents such that it contains many lines on which pages can be cut " "cleanly."); o->beginParagraph(); o->text("See also: "); o->link("http://code.google.com/p/wkhtmltopdf/issues/detail?id=9"); o->text(", "); o->link("http://code.google.com/p/wkhtmltopdf/issues/detail?id=33"); o->text(" and "); o->link("http://code.google.com/p/wkhtmltopdf/issues/detail?id=57"); o->text("."); o->endParagraph(); o->endSection(); } /*! Output documentation about the proxy settings \param o The outputter to output to */ void CommandLineParserPrivate::outputProxyDoc(Outputter * o) const { o->beginSection("Specifying A Proxy"); o->paragraph( "By default proxy information will be read from the environment" " variables: proxy, all_proxy and http_proxy, proxy options can" " also by specified with the -p switch"); o->verbatim( " := \"http://\" | \"socks5://\"\n" " := (\":\" )? \"@\"\n" " := \"None\" | ? ? (\":\" )?\n"); o->paragraph("Here are some examples (In case you are unfamiliar with the BNF):"); o->verbatim("http://user:password@myproxyserver:8080\n" "socks5://myproxyserver\n" "None\n"); o->endSection(); } /*! Output documentation about headers and footers \param o The outputter to output to */ void CommandLineParserPrivate::outputHeaderFooterDoc(Outputter * o) const { o->beginSection("Footers And Headers"); o->paragraph("Headers and footers can be added to the document by the --header-* and --footer* " "arguments respectfully. In header and footer text string supplied to e.g. --header-left, " "the following variables will be substituted."); o->verbatim( " * [page] Replaced by the number of the pages currently being printed\n" " * [frompage] Replaced by the number of the first page to be printed\n" " * [topage] Replaced by the number of the last page to be printed\n" " * [webpage] Replaced by the URL of the page being printed\n" " * [section] Replaced by the name of the current section\n" " * [subsection] Replaced by the name of the current subsection\n" " * [date] Replaced by the current date in system local format\n" " * [time] Replaced by the current time in system local format\n" "\n"); o->paragraph("As an example specifying --header-right \"Page [page] of [toPage]\", " "will result in the text \"Page x of y\" where x is the number of the " "current page and y is the number of the last page, to appear in the upper " "left corner in the document."); o->paragraph("Headers and footers can also be supplied with HTML documents. As an example one " "could specify --header-html header.html, and use the following content in header.html:"); o->verbatim( "\n" "\n" " \n" " \n" " \n" " \n" "
\n" " Page of \n" "
\n" "\n" "\n" ); o->paragraph("As can be seen from the example, the arguments are sent to the header/footer html " "documents in get fashion."); o->endSection(); } /*! Output documentation about outlines \param o The outputter to output to */ void CommandLineParserPrivate::outputOutlineDoc(Outputter * o) const { o->beginSection("Outlines"); o->paragraph( "Wkhtmltopdf with patched qt has support for PDF outlines also known as " "book marks, this can be enabled by specifying the --outline switch. " "The outlines are generated based on the tags, for a in-depth " "description of how this is done see the \"Table Of Contest\" section. "); o->paragraph( "The outline tree can sometimes be very deep, if the tags where " "spread to generous in the HTML document. The --outline-depth switch can " "be used to bound this."); o->endSection(); } /*! Output contact information \param o The outputter to output to */ void CommandLineParserPrivate::outputContact(Outputter * o) const { o->beginSection("Contact"); o->beginParagraph(); o->text("If you experience bugs or want to request new features please visit "); o->link("http://code.google.com/p/wkhtmltopdf/issues/list"); o->text(", if you have any problems or comments please feel free to contact me: see "); o->link("http://www.madalgo.au.dk/~jakobt/#about"); o->endParagraph(); o->endSection(); } /*! Output beginning of the readme \param o The outputter to output to */ void CommandLineParserPrivate::outputDocStart(Outputter * o) const { o->beginSection(QString("wkhtmltopdf ")+QString::number(MAJOR_VERSION)+"."+QString::number(MINOR_VERSION)+"."+QString::number(PATCH_VERSION)+(QString(STRINGIZE(BUILD)).isEmpty()?"":" ")+STRINGIZE(BUILD) + " Manual"); o->paragraph("This file documents wkhtmltopdf, a program capable of converting html " "documents into PDF documents."); o->endSection(); } /*! Output information on how to use read-args-from-stdin \param o The outputter to output to */ void CommandLineParserPrivate::outputArgsFromStdin(Outputter * o) const { o->beginSection("Reading arguments from stdin"); o->paragraph("If you need to convert a lot of pages in a batch, and you feel that wkhtmltopdf " "is a bit to slow to start up, then you should try --read-args-from-stdin,"); o->paragraph("When --read-args-from-stdin each line of input sent to wkhtmltopdf on stdin " "will act as a separate invocation of wkhtmltopdf, with the arguments specified " "on the given line combined with the arguments given to wkhtmltopdf"); o->paragraph("For example one could do the following:"); o->verbatim("echo \"http://doc.trolltech.com/4.5/qapplication.html qapplication.pdf\" >> cmds\n" "echo \"--cover google.com http://en.wikipedia.org/wiki/Qt_(toolkit) qt.pdf\" >> cmds\n" "wkhtmltopdf --read-args-from-stdin --book < cmds\n"); o->endSection(); } /*! Output information on how to compile \param o The outputter to output to */ void CommandLineParserPrivate::outputCompilation(Outputter * o) const { o->beginSection("Compilation"); o->paragraph("It can happen that the static binary does not work for your system " "for one reason or the other, in that case you might need to compile " "wkhtmltopdf yourself."); o->beginParagraph(); o->bold("GNU/Linux:"); o->endParagraph(); o->paragraph("Before compilation you will need to install dependencies: X11, gcc, " "git and openssl. On Debian/Ubuntu this can be done as follows:"); o->verbatim("sudo apt-get build-dep libqt4-gui libqt4-network libqt4-webkit\n" "sudo apt-get install openssl build-essential xorg git-core git-doc libssl-dev\n"); o->paragraph("On other systems you must use your own package manager, the packages " "might be named differently."); o->paragraph("First you must check out the modified version of QT"); o->verbatim("git clone git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git wkhtmltopdf-qt"); o->paragraph("Next you must configure, compile and install QT, note this will take " "quite some time, depending on what arguments you use to configure qt"); o->verbatim("cd wkhtmltopdf-qt\n" "./configure -nomake tools,examples,demos,docs,translations -opensource -prefix ../wkqt\n" "make -j3\n" "make install\n" "cd ..\n"); o->paragraph("All that is needed now is, to compile wkhtmltopdf."); o->verbatim("git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf\n" "cd wkhtmltopdf\n" "../wkqt/bin/qmake\n" "make -j3\n"); o->paragraph("You show now have a binary called wkhtmltopdf in the currently folder that " "you can use, you can optionally install it by running"); o->verbatim("make install"); o->beginParagraph(); o->bold("Other operative systems and advanced features"); o->endParagraph(); o->beginParagraph(); o->text("If you want more details or want to compile under other operative systems" "other then GNU/Linux, please see"); o->link("http://code.google.com/p/wkhtmltopdf/wiki/compilation"); o->text("."); o->endParagraph(); o->endSection(); } /*! Output information on how to install \param o The outputter to output to */ void CommandLineParserPrivate::outputInstallation(Outputter * o) const { o->beginSection("Installation"); o->paragraph( "There are several ways to install wkhtmltopdf. You can download a " "already compiled binary, or you can compile wkhtmltopdf yourself. " "On windows the easiest way to install wkhtmltopdf is to download " "the latest installer. On linux you can download the latest static " "binary, however you still need to install some other pieces of " "software, to learn more about this read the static version section " "of the manual."); o->endSection(); } /*! Output documentation about page sizes \param o The outputter to output to */ void CommandLineParserPrivate::outputPageSizes(Outputter * o) const { o->beginSection("Page sizes"); o->beginParagraph(); o->text("The default page size of the rendered document is A4, but using this --page-size option" "this can be changed to almost anything else, such as: A3, Letter and Legal. " "For a full list of supported pages sizes please see "); o->link("http://doc.trolltech.com/4.6/qprinter.html#PageSize-enum"); o->text("."); o->endParagraph(); o->paragraph("For a more fine grained control over the page size the " "--page-height and --page-width options may be used"); o->endSection(); } /*! Output examples on how to use wkhtmltopdf \param o The outputter to output to */ void CommandLineParserPrivate::outputExampels(Outputter * o) const { o->beginSection("Examples"); o->paragraph("This section presents a number of examples of how to invoke wkhtmltopdf."); o->paragraph("To convert a remote HTML file to PDF:"); o->verbatim("wkhtmltopdf http://www.google.com google.pdf\n"); o->paragraph("To convert a local HTML file to PDF:"); o->verbatim("wkhtmltopdf my.html my.pdf\n"); o->paragraph("You can also convert to PS files if you like:"); o->verbatim("wkhtmltopdf my.html my.ps\n"); o->paragraph("Produce the eler2.pdf sample file:"); o->verbatim("wkhtmltopdf http://geekz.co.uk/lovesraymond/archive/eler-highlights-2008 eler2.pdf -H --outline\n"); o->endSection(); } /*! Output information on the problems with the static version \param o The outputter to output to */ void CommandLineParserPrivate::outputStaticProblems(Outputter * o) const { o->beginSection("Static version"); o->beginParagraph(); o->text("On the wkhtmltopdf website you can download a static version of wkhtmltopdf "); o->link("http://code.google.com/p/wkhtmltopdf/downloads/list"); o->text(". This static binary will work on most systems and comes with a build in patched QT."); o->endParagraph(); o->beginParagraph(); o->text("Unfortunately the static binary is not particularly static, on Linux it depends " "on both glibc and openssl, furthermore you will need to have an xserver installed " "but not necessary running. You will need to have different fonts install including " "xfonts-scalable (Type1), and msttcorefonts. See "); o->link("http://code.google.com/p/wkhtmltopdf/wiki/static"); o->text(" for trouble shouting."); o->endParagraph(); o->endSection(); } // LocalWords: webkit bool unpatched beginList listItem endList WebKit http // LocalWords: stroustrup wkhtmltopdf commandlineparser hh QWebFrame param px // LocalWords: STRINGIZE outputter const beginSection beginParagraph QString // LocalWords: ifdef endif endParagraph endSection GPLv GPL Truelsen Mário td // LocalWords: Bouthenot PDF CSS username BNF frompage topage webpage toPage // LocalWords: html subst unescape subsubsection getElementsByClassName args // LocalWords: textContent onload readme stdin qapplication pdf cmds google // LocalWords: todo gcc openssl sudo dep libqt gui xorg wget xvf svn linux ps // LocalWords: PageSize enum eler glibc xserver xfonts libssl dev wkhtml cd // LocalWords: nomake opensource wkhtmltopdf-0.9.9.orig/src/htmloutputter.cc0000644000000000000000000000656311376515611015777 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "commandlineparser_p.hh" #include #define S(x) Qt::escape(x).toUtf8().constData() class HtmlOutputter: public Outputter { private: FILE * fd; bool ordered; public: HtmlOutputter(FILE * _): fd(_) { fprintf(fd, "\n" "\n" "\n" " \n" " wkhtmltopdf - Manual\n" " \n" ""); } ~HtmlOutputter() { fprintf(fd,"\n"); } void beginSection(const QString & name) { fprintf(fd, "

%s

\n", S(name)); } void endSection() { } void beginParagraph() { fprintf(fd,"

"); } void endParagraph() { fprintf(fd,"

\n"); } void text(const QString & t) { fprintf(fd, "%s", S(t)); } void bold(const QString & t) { fprintf(fd, "%s", S(t)); } void italic(const QString & t) { fprintf(fd, "%s", S(t)); } void link(const QString & t) { fprintf(fd, "%s", S(t),S(t)); } void verbatim(const QString & t) { fprintf(fd, "
%s
", S(t)); } void beginList(bool o) { ordered = o; fprintf(fd, ordered?"
    ":"
      "); } void endList() { fprintf(fd, ordered?"
":""); } void listItem(const QString & s) { fprintf(fd, "
  • %s
  • \n", S(s)); } void beginSwitch() { fprintf(fd, "\n"); } void cswitch(const ArgHandler * h) { fprintf(fd, "\n",S(h->getDesc())); } void endSwitch() { fprintf(fd, "
    "); if(h->shortSwitch) fprintf(fd, "-%c,",h->shortSwitch); fprintf(fd, "--%s%s",S(h->longName), (h->qthack?"*":"")); foreach(const QString & arg, h->argn) fprintf(fd, "<%s> ",S(arg)); fprintf(fd, "%s
    \n"); fprintf(fd, "

    Items marked * are only available using patched QT.

    "); } }; /*! Create a Html outputter \param fd A file description to output to */ Outputter * Outputter::html(FILE * fd) { return new HtmlOutputter(fd); } wkhtmltopdf-0.9.9.orig/src/multipageloader.hh0000644000000000000000000000324311376515611016217 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #ifndef __MULTIPAGELOADER_HH__ #define __MULTIPAGELOADER_HH__ #include "settings.hh" #include #include #include #include class MyQWebPage; class MultiPageLoaderPrivate; class MultiPageLoader: public QObject { Q_OBJECT public: MultiPageLoader(Settings & s); ~MultiPageLoader(); QWebPage * addResource(const QString & string); QWebPage * addResource(const QUrl & url); static QUrl guessUrlFromString(const QString &string); int httpErrorCode(); static bool copyFile(QFile & src, QFile & dst); public slots: void load(); void clearResources(); void cancel(); signals: void printRequested(QWebFrame * frame); void loadFinished(bool ok); void loadProgress(int progress); void loadStarted(); void warning(QString text); void error(QString text); private: MultiPageLoaderPrivate * d; friend class MultiPageLoaderPrivate; friend class MyQWebPage; }; #endif //__MULTIPAGELOADER_HH__ wkhtmltopdf-0.9.9.orig/src/manoutputter.cc0000644000000000000000000000535411376515611015603 0ustar //-*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*- // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "commandlineparser_p.hh" #include #define S(x) ((x).toUtf8().constData()) class ManOutputter: public Outputter { private: FILE * fd; int order; public: ManOutputter(FILE * _): fd(_) { fprintf(fd,".TH WKHTMLTOPDF 1 \"2009 February 23\"\n\n"); } void beginSection(const QString & name) { fprintf(fd, ".SH %s\n", S(name)); } void endSection() { fprintf(fd, "\n"); } void beginParagraph() { } void endParagraph() { fprintf(fd, "\n\n"); } void text(const QString & t) { QString str = QString(t).replace("-", "\\-"); fprintf(fd, "%s", S(str)); } void bold(const QString & t) { fprintf(fd, "\\fB%s\\fP", S(t)); } void italic(const QString & t) { fprintf(fd, "\\fB%s\\fP", S(t)); } void link(const QString & t) { fprintf(fd, "<%s>", S(t)); } void verbatim(const QString & t) { QString str = QString(t).replace("-", "\\-"); QStringList l = str.split('\n'); while ( l.back() == "") l.pop_back(); foreach(const QString & line, l) fprintf(fd, " %s\n", S(line)); fprintf(fd, "\n"); } void beginSwitch() { fprintf(fd, ".PD 0\n"); } void beginList(bool ordered) { order=(ordered?1:-1); } void endList() { fprintf(fd, "\n"); } void listItem(const QString & s) { if (order < 0) fprintf(fd, " * "); else fprintf(fd, "%3d ", order++); fprintf(fd,"%s\n",S(s)); } void cswitch(const ArgHandler * h) { fprintf(fd, ".TP\n"); fprintf(fd, "\\fB"); if(h->shortSwitch != 0) fprintf(fd, "\\-%c, ", h->shortSwitch); else fprintf(fd, " "); fprintf(fd,"\\-\\-%s\\fR", S(h->longName)); for(QVector::const_iterator i = h->argn.constBegin(); i != h->argn.constEnd(); ++i) fprintf(fd," \\fI<%s>\\fR", S(*i)); fprintf(fd, "\n%s\n", S(QString(h->desc).replace("-", "\\-"))); } void endSwitch() { fprintf(fd, ".PD\n"); fprintf(fd, "\n"); } }; /*! Create a man page outputter \param fd A file description to output to */ Outputter * Outputter::man(FILE * fd) { return new ManOutputter(fd); } wkhtmltopdf-0.9.9.orig/src/pageconverter.cc0000644000000000000000000006332511376515611015702 0ustar // This file is part of wkhtmltopdf. // // wkhtmltopdf is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // wkhtmltopdf is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with wkhtmltopdf. If not, see . #include "pageconverter_p.hh" #include #include #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_WIN32 #include #include #endif /*! \file pageconverter.hh \brief Defines the PageConverter class */ /*! \file pageconverter_p.hh \brief Defines the PageConverterPrivate class */ bool looksLikeHtmlAndNotAUrl(QString str) { QString s = str.split("?")[0]; return s.count('<') > 0 || s.count('<') > 0; } PageConverterPrivate::PageConverterPrivate(Settings & s, PageConverter & o) : settings(s), pageLoader(s), outer(o), printer(0), painter(0) #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ , hfLoader(s), outline(0), tocPrinter(0) #endif { #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ phaseDescriptions.push_back("Loading pages"); phaseDescriptions.push_back("Resolving links"); phaseDescriptions.push_back("Counting pages"); phaseDescriptions.push_back("Loading headers and footers"); if (!settings.defaultEncoding.isEmpty()) QWebSettings::globalSettings()->setDefaultTextEncoding(settings.defaultEncoding); if (!settings.enableIntelligentShrinking) { QWebSettings::globalSettings()->setPrintingMaximumShrinkFactor(1.0); QWebSettings::globalSettings()->setPrintingMinimumShrinkFactor(1.0); } QWebSettings::globalSettings()->setPrintingMediaType(settings.printMediaType?"print":"screen"); #else phaseDescriptions.push_back("Loading page"); #endif phaseDescriptions.push_back("Printing pages"); phaseDescriptions.push_back("Done"); QWebSettings::globalSettings()->setAttribute(QWebSettings::JavaEnabled, settings.enablePlugins); QWebSettings::globalSettings()->setAttribute(QWebSettings::JavascriptEnabled, settings.enableJavascript); QWebSettings::globalSettings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, false); QWebSettings::globalSettings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, false); QWebSettings::globalSettings()->setFontSize(QWebSettings::MinimumFontSize, s.minimumFontSize); #if QT_VERSION >= 0x040500 //Newer vertions of QT have even more settings to change QWebSettings::globalSettings()->setAttribute(QWebSettings::PrintElementBackgrounds, settings.background); QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, settings.enablePlugins); if (!settings.userStyleSheet.isEmpty()) QWebSettings::globalSettings()->setUserStyleSheetUrl(MultiPageLoader::guessUrlFromString(settings.userStyleSheet)); #endif connect(&pageLoader, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int))); connect(&pageLoader, SIGNAL(loadFinished(bool)), this, SLOT(preparePrint(bool))); connect(&pageLoader, SIGNAL(error(QString)), this, SLOT(forwardError(QString))); connect(&pageLoader, SIGNAL(warning(QString)), this, SLOT(forwardWarning(QString))); #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ connect(&hfLoader, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int))); connect(&hfLoader, SIGNAL(loadFinished(bool)), this, SLOT(printPage(bool))); connect(&hfLoader, SIGNAL(error(QString)), this, SLOT(forwardError(QString))); connect(&hfLoader, SIGNAL(warning(QString)), this, SLOT(forwardWarning(QString))); #endif } PageConverterPrivate::~PageConverterPrivate() { clearResources(); } void PageConverterPrivate::forwardError(QString error) { emit outer.error(error); } void PageConverterPrivate::forwardWarning(QString warning) { emit outer.warning(warning); } /*! * Called when the page is loading, display some progress to the using * \param progress the loading progress in percent */ void PageConverterPrivate::loadProgress(int progress) { progressString = QString::number(progress) + "%"; emit outer.progressChanged(progress); } void PageConverterPrivate::beginConvert() { clearResources(); error=false; progressString = "0%"; currentPhase=0; if (!settings.cover.isEmpty()) settings.in.push_front(settings.cover); if (!settings.header.htmlUrl.isEmpty() && looksLikeHtmlAndNotAUrl(settings.header.htmlUrl)) { emit outer.error("--header-html should be a URL and not a string containing HTML code."); fail(); return; } if (!settings.footer.htmlUrl.isEmpty() && looksLikeHtmlAndNotAUrl(settings.footer.htmlUrl)) { emit outer.error("--header-html should be a URL and not a string containing HTML code."); fail(); return; } #ifndef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ if (settings.in.size() > 1) { emit outer.error("This version of wkhtmltopdf is build against an unpatched version of QT, and does not support more then one input document."); fail(); return; } #endif foreach(QString url, settings.in) pages.push_back(pageLoader.addResource(url)); emit outer.phaseChanged(); loadProgress(0); pageLoader.load(); } void PageConverterPrivate::fail() { error = true; convertionDone = true; clearResources(); emit outer.finished(false); qApp->exit(0); // quit qt's event handling } /*! * Prepares printing out the document to the pdf file */ void PageConverterPrivate::preparePrint(bool ok) { if (!ok) { fail(); return; } lout = settings.out; if (settings.out == "-") { #ifndef Q_OS_WIN32 if (QFile::exists("/dev/stdout")) lout = "/dev/stdout"; else #endif lout = tempOut.create(".pdf"); } printer = new QPrinter(settings.resolution); if (settings.dpi != -1) printer->setResolution(settings.dpi); //Tell the printer object to print the file printer->setOutputFormat( settings.out.endsWith(".ps", Qt::CaseInsensitive)? QPrinter::PostScriptFormat : QPrinter::PdfFormat ); printer->setOutputFileName(lout); //We currently only support margins with the same unit if (settings.margin.left.second != settings.margin.right.second || settings.margin.left.second != settings.margin.top.second || settings.margin.left.second != settings.margin.bottom.second) { emit outer.error("Currently all margin units must be the same!"); fail(); return; } //Setup margins and papersize printer->setPageMargins(settings.margin.left.first, settings.margin.top.first, settings.margin.right.first, settings.margin.bottom.first, settings.margin.left.second); if((settings.size.height.first != -1) && (settings.size.width.first != -1)) { printer->setPaperSize(QSizeF(settings.size.width.first,settings.size.height.first), settings.size.height.second); } else { printer->setPaperSize(settings.size.pageSize); } printer->setOrientation(settings.orientation); printer->setColorMode(settings.colorMode); if (!printer->isValid()) { emit outer.error("Unable to write to destination"); fail(); return; } #ifndef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ //If you do not have the hacks you get this crappy solution printer->setCollateCopies(settings.copies); printer->setCollateCopies(settings.collate); printPage(true); #else printer->printEngine()->setProperty(QPrintEngine::PKK_UseCompression, settings.useCompression); painter = new QPainter(); QString title = settings.documentTitle; if (title == "") title = pages[0]->mainFrame()->title(); printer->setDocName(title); if (!painter->begin(printer)) { emit outer.error("Unable to write to destination"); fail(); return; } logicalPages = 0; actualPages = 0; tocPages = 0; //Find and resolve all local links if(settings.useLocalLinks || settings.useExternalLinks) { currentPhase = 1; emit outer.phaseChanged(); QHash urlToDoc; for(int d=0; d < pages.size(); ++d) urlToDoc[ pages[d]->mainFrame()->url().toString(QUrl::RemoveFragment) ] = d; for(int d=0; d < pages.size(); ++d) { progressString = QString("Page ")+QString::number(d+1)+QString(" of ")+QString::number(pages.size()); emit outer.progressChanged((d+1)*100 / pages.size()); findLinks(pages[d]->mainFrame(), localLinks[d], externalLinks[d]); } } currentPhase = 2; emit outer.phaseChanged(); outline = new Outline(settings); //This is the first render face, it is done to calculate: // * The number of pages of each document // * A visual ordering of the header element // * The location and page number of each header for(int d=0; d < pages.size(); ++d) { int tot = pages.size()+(settings.printToc?1:0); progressString = QString("Page ")+QString::number(d+1)+QString(" of ")+QString::number(tot); emit outer.progressChanged((d+1)*100 / tot); painter->save(); QWebPrinter wp(pages[d]->mainFrame(), printer, *painter); int count = wp.pageCount(); //pageCount.push_back(count); actualPages += count; if (settings.cover.isEmpty() || d != 0) { outline->addWebPage("", wp, pages[d]->mainFrame()); logicalPages += count; } painter->restore(); } //Now that we know the ordering of the headers in each document we //can calculate the number of pages in the table of content tocPrinter = NULL; if (settings.printToc) { int k=pages.size()+1; progressString = QString("Page ")+QString::number(k)+QString(" of ")+QString::number(k); emit outer.progressChanged(100); tocPrinter = new TocPrinter(outline, printer, *painter); actualPages += tocPrinter->pageCount(); logicalPages += tocPrinter->pageCount(); } actualPages *= settings.copies; int page=1; headers.clear(); footers.clear(); if(!settings.header.htmlUrl.isEmpty() || !settings.footer.htmlUrl.isEmpty()) { QWebSettings::globalSettings()->setAttribute(QWebSettings::JavascriptEnabled, true); currentPhase = 3; emit outer.phaseChanged(); for(int p=0; p < outline->pageCount(); ++p) { QHash parms; fillParms(parms, page); if(!settings.header.htmlUrl.isEmpty()) headers.push_back(loadHeaderFooter(settings.header.htmlUrl, parms) ); if(!settings.footer.htmlUrl.isEmpty()) footers.push_back(loadHeaderFooter(settings.footer.htmlUrl, parms) ); ++page; } hfLoader.load(); } else printPage(true); #endif } #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ void PageConverterPrivate::findLinks(QWebFrame * frame, QVector > & local, QVector > & external) { if (!settings.useLocalLinks && !settings.useExternalLinks) return; foreach (const QWebElement & elm, frame->findAllElements("a")) { QUrl href=QUrl(elm.attribute("href")); if (href.isEmpty()) continue; href=frame->url().resolved(href); if (urlToDoc.contains(href.toString(QUrl::RemoveFragment))) { if (settings.useLocalLinks) { int t = urlToDoc[href.toString(QUrl::RemoveFragment)]; QWebElement e; if (!href.hasFragment()) e = pages[t]->mainFrame()->findFirstElement("body"); else { e = pages[t]->mainFrame()->findFirstElement("a[name=\""+href.fragment()+"\"]"); if(e.isNull()) e = pages[t]->mainFrame()->findFirstElement("*[id=\""+href.fragment()+"\"]"); } if (e.isNull()) qDebug() << "Unable to find target for local link " << href; else { anchors[t][href.toString()] = e; local.push_back( qMakePair(elm, href.toString()) ); } } } else if (settings.useExternalLinks) external.push_back( qMakePair(elm, href.toString() ) ); } } void PageConverterPrivate::fillParms(QHash & parms, int page) { outline->fillHeaderFooterParms(page, parms); QDateTime t(QDateTime::currentDateTime()); parms["time"] = t.time().toString(Qt::SystemLocaleShortDate); parms["date"] = t.date().toString(Qt::SystemLocaleShortDate); } void PageConverterPrivate::beginPage(int & actualPage, bool & first) { progressString = QString("Page ") + QString::number(actualPage) + QString(" of ") + QString::number(actualPages); emit outer.progressChanged(actualPage * 100 / actualPages); if(first) first=false; else printer->newPage(); actualPage++; } void PageConverterPrivate::endPage(bool actual, bool hasHeaderFooter) { typedef QPair p_t; if(hasHeaderFooter && actual) { QHash parms; fillParms(parms, logicalPage); //Webkit used all kinds of crazy coordinate transformation, and font setup //We save it here and restore some sane defaults painter->save(); painter->resetTransform(); int h=printer->height(); int w=printer->width(); double spacing = settings.header.spacing * printer->height() / printer->heightMM(); //If needed draw the header line if (settings.header.line) painter->drawLine(0, -spacing, w, -spacing); //Guess the height of the header text painter->setFont(QFont(settings.header.fontName, settings.header.fontSize)); int dy = painter->boundingRect(0, 0, w, h, Qt::AlignTop, "M").height(); //Draw the header text QRect r=QRect(0, 0-dy-spacing, w, h); painter->drawText(r, Qt::AlignTop | Qt::AlignLeft, hfreplace(settings.header.left, parms)); painter->drawText(r, Qt::AlignTop | Qt::AlignHCenter, hfreplace(settings.header.center, parms)); painter->drawText(r, Qt::AlignTop | Qt::AlignRight, hfreplace(settings.header.right, parms)); spacing = settings.footer.spacing * printer->height() / printer->heightMM(); //IF needed draw the footer line if (settings.footer.line) painter->drawLine(0, h + spacing, w, h + spacing); //Guess the height of the footer text painter->setFont(QFont(settings.footer.fontName, settings.footer.fontSize)); dy = painter->boundingRect(0, 0, w, h, Qt::AlignTop, "M").height(); //Draw the footer text r=QRect(0,0,w,h+dy+ spacing); painter->drawText(r, Qt::AlignBottom | Qt::AlignLeft, hfreplace(settings.footer.left, parms)); painter->drawText(r, Qt::AlignBottom | Qt::AlignHCenter, hfreplace(settings.footer.center, parms)); painter->drawText(r, Qt::AlignBottom | Qt::AlignRight, hfreplace(settings.footer.right, parms)); //Restore Webkit's crazy scaling and font settings painter->restore(); } if(actual && logicalPage <= headers.size()) { painter->save(); painter->resetTransform(); double spacing = settings.header.spacing * printer->height() / printer->heightMM(); painter->translate(0, -spacing); QWebPrinter wp(headers[logicalPage-1]->mainFrame(), printer, *painter); painter->translate(0,-wp.elementLocation(headers[logicalPage-1]->mainFrame()->findFirstElement("body")).second.height()); QVector local; QVector external; findLinks(headers[logicalPage-1]->mainFrame(), local, external); foreach(const p_t & p, local) { QRectF r = wp.elementLocation(p.first).second; painter->addLink(r, p.second); } foreach(const p_t & p, external) { QRectF r = wp.elementLocation(p.first).second; qDebug() << p.second; painter->addHyperlink(r, QUrl(p.second)); } wp.spoolPage(1); painter->restore(); } if(actual && logicalPage <= footers.size()) { painter->save(); painter->resetTransform(); double spacing = settings.footer.spacing * printer->height() / printer->heightMM(); painter->translate(0, printer->height()+ spacing); QWebPrinter wp(footers[logicalPage-1]->mainFrame(), printer, *painter); QVector local; QVector external; findLinks(footers[logicalPage-1]->mainFrame(), local, external); foreach(const p_t & p, local) { QRectF r = wp.elementLocation(p.first).second; painter->addLink(r, p.second); } foreach(const p_t & p, external) { QRectF r = wp.elementLocation(p.first).second; qDebug() << p.second; painter->addHyperlink(r, QUrl(p.second)); } wp.spoolPage(1); painter->restore(); } } #endif void PageConverterPrivate::printPage(bool ok) { if (!ok) { fail(); return; } #ifndef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ currentPhase = 1; emit outer.phaseChanged(); pages[0]->mainFrame()->print(printer); progressString = ""; emit outer.progressChanged(-1); #else bool first=true; int actualPage=1; int cc=settings.collate?settings.copies:1; int pc=settings.collate?1:settings.copies; bool hasHeaderFooter = settings.header.line || settings.footer.line || !settings.header.left.isEmpty() || !settings.footer.left.isEmpty() || !settings.header.center.isEmpty() || !settings.footer.center.isEmpty() || !settings.header.right.isEmpty() || !settings.footer.right.isEmpty(); currentPhase = 4; emit outer.phaseChanged(); progressString = "Preparing"; emit outer.progressChanged(0); for(int cc_=0; cc_ < cc; ++cc_) { logicalPage=1; for(int d=0; d < pages.size(); ++d) { //Output the table of content now if(tocPrinter && d == (settings.cover.isEmpty()?0:1)) { painter->save(); for(int p=0; p < tocPrinter->pageCount(); ++p) { for(int pc_=0; pc_ < pc; ++pc_) { beginPage(actualPage,first); tocPrinter->spoolPage(p); endPage(true, hasHeaderFooter); } ++logicalPage; } painter->restore(); } painter->save(); //output QWebPrinter wp(pages[d]->mainFrame(), printer, *painter); QString l1=pages[d]->mainFrame()->url().path().split("/").back()+"#"; QString l2=pages[d]->mainFrame()->url().toString() + "#"; if (settings.cover.isEmpty() || d != 0) { //The toc printer adds an extra TOC document to the beginning of the outline //Using a cover does not add anything to cover int delta = (tocPrinter?1:0) - (settings.cover.isEmpty()?0:1); if(tocPrinter) tocPrinter->fillLinks(d+delta, localLinks[d]); outline->fillAnchors(d+delta, anchors[d]); } //Sort anchors and links by page QHash > myAnchors; QHash > > myLocalLinks; QHash > > myExternalLinks; for(QHash::iterator i=anchors[d].begin(); i != anchors[d].end(); ++i) myAnchors[ wp.elementLocation(i.value()).first][i.key()] = i.value(); for(QVector< QPair >::iterator i=localLinks[d].begin(); i != localLinks[d].end(); ++i) myLocalLinks[wp.elementLocation(i->first).first].push_back(*i); for(QVector< QPair >::iterator i=externalLinks[d].begin(); i != externalLinks[d].end(); ++i) myExternalLinks[wp.elementLocation(i->first).first].push_back(*i); QHash > myFormElements; if (settings.produceForms) { foreach(const QWebElement & elm,pages[d]->mainFrame()->findAllElements("input")) myFormElements[wp.elementLocation(elm).first].push_back(elm); foreach(const QWebElement & elm,pages[d]->mainFrame()->findAllElements("textarea")) myFormElements[wp.elementLocation(elm).first].push_back(elm); } for(int p=0; p < wp.pageCount(); ++p) { for(int pc_=0; pc_ < pc; ++pc_) { beginPage(actualPage,first); wp.spoolPage(p+1); foreach(const QWebElement & elm, myFormElements[p+1]) { QString type = elm.attribute("type"); QString tn = elm.tagName(); QString name = elm.attribute("name"); if (tn == "TEXTAREA" || type == "text" || type == "password") { painter->addTextField( wp.elementLocation(elm).second, tn == "TEXTAREA"?elm.toPlainText():elm.attribute("value"), name, tn == "TEXTAREA", type == "password", elm.attribute("readonly") == "readonly", elm.hasAttribute("maxlength")?elm.attribute("maxlength").toInt():-1 ); } else if (type == "checkbox") { painter->addCheckBox( wp.elementLocation(elm).second, elm.attribute("checked") == "checked", name, elm.attribute("readonly") == "readonly"); } } for(QHash::iterator i=myAnchors[p+1].begin(); i != myAnchors[p+1].end(); ++i) { QRectF r = wp.elementLocation(i.value()).second; painter->addAnchor(r, i.key()); } for(QVector< QPair >::iterator i=myLocalLinks[p+1].begin(); i != myLocalLinks[p+1].end(); ++i) { QRectF r = wp.elementLocation(i->first).second; painter->addLink(r, i->second); } for(QVector< QPair >::iterator i=myExternalLinks[p+1].begin(); i != myExternalLinks[p+1].end(); ++i) { QRectF r = wp.elementLocation(i->first).second; painter->addHyperlink(r, QUrl(i->second)); } endPage(settings.cover.isEmpty() || d != 0, hasHeaderFooter); } if (settings.cover.isEmpty() || d != 0) ++logicalPage; } painter->restore(); } } outline->printOutline(printer); outline->dumpOutline(); painter->end(); #endif if (settings.out == "-" && lout != "/dev/stdout") { QFile i(lout); QFile o; #ifdef Q_OS_WIN32 _setmode(_fileno(stdout), _O_BINARY); #endif if( !i.open(QIODevice::ReadOnly) || !o.open(stdout,QIODevice::WriteOnly) || !MultiPageLoader::copyFile(i,o) ) { emit outer.error("Count not write to stdout"); fail(); return; } } clearResources(); #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ currentPhase = 5; #else currentPhase = 2; #endif emit outer.phaseChanged(); convertionDone = true; emit outer.finished(true); qApp->exit(0); // quit qt's event handling } #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ QWebPage * PageConverterPrivate::loadHeaderFooter(QString url, const QHash & parms) { QUrl u = MultiPageLoader::guessUrlFromString(url); for(QHash::const_iterator i=parms.begin(); i != parms.end(); ++i) u.addQueryItem(i.key(), i.value()); return hfLoader.addResource(u); } /*! * Replace some variables in a string used in a header or footer * \param q the string to substitute in */ QString PageConverterPrivate::hfreplace(const QString & q, const QHash & parms) { QString r=q; for(QHash::const_iterator i=parms.begin(); i != parms.end(); ++i) r=r.replace("["+i.key()+"]", i.value(), Qt::CaseInsensitive); return r; } #endif bool PageConverterPrivate::convert() { convertionDone=false; beginConvert(); while(!convertionDone) { qApp->exec(); //qApp->processEvents(QEventLoop::WaitForMoreEvents | QEventLoop::AllEvents); } return !error; } void PageConverterPrivate::clearResources() { pageLoader.clearResources(); #ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__ hfLoader.clearResources(); if (outline) delete outline; outline = NULL; if (tocPrinter) delete tocPrinter; tocPrinter = NULL; anchors.clear(); localLinks.clear(); externalLinks.clear(); foreach (QWebPage * page, headers) delete page; headers.clear(); foreach (QWebPage * page, footers) delete page; footers.clear(); #endif foreach(QWebPage * page, pages) delete page; pages.clear(); if (printer) delete printer; printer = NULL; if (painter) delete painter; painter = NULL; } void PageConverterPrivate::cancel() { error=true; } /*! \class PageConverter \brief Class responsible for converting html pages to pdf \todo explain something about the conversion process here, and mention stages */ /*! \brief Create a page converter object based on the supplied settings \param settings Settings for the conversion */ PageConverter::PageConverter(Settings & settings): d(new PageConverterPrivate(settings, *this)) { } /*! \brief The destructor for the page converter object */ PageConverter::~PageConverter() { delete d; } /*! \brief Count the number of phases that the conversion process goes though */ int PageConverter::phaseCount() { return d->phaseDescriptions.size(); } /*! \brief return the current phase of conversion */ int PageConverter::currentPhase() { return d->currentPhase; } /*! \brief return a textual description of some phase \param phase the phase to get a description of, -1 for current phase */ QString PageConverter::phaseDescription(int phase) { if (phase < 0 || d->phaseDescriptions.size() <= phase) phase=d->currentPhase; if (phase < 0 || d->phaseDescriptions.size() <= phase) return "Invalid"; return d->phaseDescriptions[phase]; } /*! \brief return a textual description of progress in the current phase */ QString PageConverter::progressString() { return d->progressString; } /*! \brief return the HTTP return code, of the converted page */ int PageConverter::httpErrorCode() { return d->pageLoader.httpErrorCode(); } /*! \brief add a resource we want to convert \param url The url of the object we want to convert */ void PageConverter::addResource(const QString & url) { d->settings.in.push_back(url); } /*! \brief Start a asynchronous conversion of html pages to a pdf document. Once conversion is done an finished signal will be emitted */ void PageConverter::beginConvertion() { d->beginConvert(); } /*! \brief Synchronous convert html pages to a pdf document. */ bool PageConverter::convert() { return d->convert(); } /*! \brief Cancel a running conversion */ void PageConverter::cancel() { d->cancel(); } /*! \brief Returns the settings object associated with the page converter */ const Settings & PageConverter::settings() const { return d->settings; } /*! \fn PageConverter::warning(const QString & message) \brief Signal emitted when some non fatal warning occurs during conversion \param message The warning message */ /*! \fn PageConverter::error(const QString & message) \brief Signal emitted when a fatal error has occurred during conversion \param message A message describing the fatal error */ /*! \fn PageConverter::phaseChanged() \brief Signal emitted when the converter has reached a new phase */ /*! \fn PageConverter::progressChanged() \brief Signal emitted when some progress has been done in the conversion phase */ /*! \fn PageConverter::finised() \brief Signal emitted when conversion has finished. */ wkhtmltopdf-0.9.9.orig/changelog0000644000000000000000000000000011376515611013567 0ustar wkhtmltopdf-0.9.9.orig/wkhtmltopdf.nsi.m40000644000000000000000000000334511376515611015331 0ustar !include "MUI2.nsh" !include "EnvVarUpdate.nsh" Name "wkhtmltopdf WKVERSION" OutFile "wkhtmltopdf-WKVERSION-installer.exe" RequestExecutionLevel admin ;Default installation folder InstallDir "$PROGRAMFILES\wkhtmltopdf" ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\wkhtmltopdf" "" ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING ;-------------------------------- ;Pages !insertmacro MUI_PAGE_LICENSE "../COPYING" ; !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;Installer Sections Section SetOutPath "$INSTDIR" file wkhtmltopdf.exe file libgcc_s_dw2-1.dll file ssleay32.dll file libeay32.dll WriteRegStr HKCU "Software\wkhtmltopdf" "" $INSTDIR WriteUninstaller "$INSTDIR\uninstall.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \ "DisplayName" "wkhtmltopdf" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\wkhtmltopdf" \ "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" ; ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR" SectionEnd ;-------------------------------- ;Uninstaller Section Section "Uninstall" Delete "$INSTDIR\wkhtmltopdf.exe" Delete "$INSTDIR\libgcc_s_dw2-1.dll" Delete "$INSTDIR\ssleay32.dll" Delete "$INSTDIR\libeay32.dll" ; ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR" Delete "$INSTDIR\uninstall.exe" RMDir "$INSTDIR" DeleteRegKey /ifempty HKCU "Software\wkhtmltopdf" SectionEndwkhtmltopdf-0.9.9.orig/COPYING0000644000000000000000000010451311376515611012766 0ustar GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . wkhtmltopdf-0.9.9.orig/static_qt_conf_win0000644000000000000000000000147511376515611015536 0ustar # This file is part of wkhtmltopdf. # # wkhtmltopdf is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # wkhtmltopdf is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with wkhtmltopdf. If not, see . -qt-style-windows #Required for cleanlooks -qt-style-cleanlooks -no-style-windowsxp -no-style-windowsvista -no-style-plastique -no-style-motif -no-style-cde wkhtmltopdf-0.9.9.orig/scripts/0000755000000000000000000000000011376515611013416 5ustar wkhtmltopdf-0.9.9.orig/scripts/release.sh0000755000000000000000000000445211376515611015402 0ustar #!/bin/bash function usage() { echo "Usage $0: [Options] Major Minor Patch [Build]" echo "" echo "Options:" echo "-h Display this help message" echo "-q Build against this branch of QT" } while getopts hq: O; do case "$O" in [?h]) usage; exit 1 ;; q) shift 2 QB="-q $OPTARG" ;; esac done git status if [[ $1 == "" ]] || [[ $2 == "" ]] || [[ $3 == "" ]]; then echo "Bad version" exit 1 fi v="$1.$2.$3" if [[ "$4" != "" ]]; then v="${v}_$4" fi echo "About to release $v" read -p "Are you sure you are ready: " N [ "$N" != "YES" ] && exit sed -ri "s/MAJOR_VERSION=[0-9]+ MINOR_VERSION=[0-9]+ PATCH_VERSION=[0-9]+ BUILD=.*/MAJOR_VERSION=$1 MINOR_VERSION=$2 PATCH_VERSION=$3 BUILD=\"$4\"/" wkhtmltopdf.pro || exit 1 HEAD="$(git log --pretty=oneline -n 1 | sed -e 's/ .*//')" git commit -m "TEMPORERY DO NOT COMMIT $v" wkhtmltopdf.pro rm -rf wkhtmltopdf-i386 wkhtmltopdf-amd64 wkhtmltopdf.exe wkhtmltopdf ./scripts/static-build.sh $QB linux-i386 || (echo Build failed; git reset $HEAD --hard; exit 1) cp wkhtmltopdf-i386 wkhtmltopdf if ! ./scripts/test.sh -q; then echo "Test failed" git reset $HEAD --hard exit 1 fi ./wkhtmltopdf-i386 --readme > README ./scripts/static-build.sh $QB linux-amd64 || (echo Build failed; git reset $HEAD --hard; exit 1) ./scripts/static-build.sh $QB windows || (echo Build failed; git reset $HEAD --hard; exit 1) git commit --amend -m "Version $v" wkhtmltopdf.pro README git tag "$v" rm -rf "release-$v" mkdir "release-$v" git checkout-index --prefix="./release-$v/wkhtmltopdf-$v/" -a wget "http://code.google.com/p/wkhtmltopdf/wiki/ChangeLog" -qO - | sed -nre 's/.*

    CHANGELOGBEGIN[ ]*<\/p>(.*)

    CHANGELOGEND.*/\1/p' | html2text > "./release-$v/wkhtmltopdf-$v/changelog" tar -cjvf "release-$v/wkhtmltopdf-$v.tar.bz2" -C "release-$v" "wkhtmltopdf-$v" cp wkhtmltopdf.exe "release-$v/wkhtmltopdf.exe" m4 -D "WKVERSION=$v" wkhtmltopdf.nsi.m4 > "release-$v/wkhtmltopdf.nsi" tar -cjvf "release-$v/wkhtmltopdf-$v-static-i386.tar.bz2" wkhtmltopdf-i386 tar -cjvf "release-$v/wkhtmltopdf-$v-static-amd64.tar.bz2" wkhtmltopdf-amd64 cd "release-$v" for x in libgcc_s_dw2-1.dll ssleay32.dll libeay32.dll EnvVarUpdate.nsh; do [ -f "$x" ] || wget http://wkhtmltopdf.googlecode.com/files/$x -O $x done makensis wkhtmltopdf.nsi wkhtmltopdf-0.9.9.orig/scripts/static-build.sh0000755000000000000000000002014511376515611016343 0ustar #!/bin/bash # This file is part of wkhtmltopdf. # # wkhtmltopdf is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # wkhtmltopdf is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with wkhtmltopdf. If not, see . # This script will compile static versions of wkhtmltopdf for linux and for windows (it must run in linux) # It requires build-essential and wine to run. Please note that it will take quite a while #Configuration for the static build MIRROR=kent MINGWFILES="binutils-2.19.1-mingw32-bin.tar.gz \ mingw32-make-3.81-20090910.tar.gz \ gcc-full-4.4.0-mingw32-bin-2.tar.lzma \ w32api-3.13-mingw32-dev.tar.gz \ mingwrt-3.16-mingw32-dev.tar.gz \ mingwrt-3.16-mingw32-dll.tar.gz" GNUWIN32FILES="openssl-0.9.8h-1-lib.zip \ openssl-0.9.8h-1-bin.zip " #freetype-2.3.5-1-bin.zip \ #freetype-2.3.5-1-lib.zip " QTBRANCH= function usage() { echo "Usage: $0 [OPTIONS] target" echo "" echo "Options:" echo "-h Display this help message" echo "-q branch Use this qt branch" echo "-v version Compile this version of wkhtmltopdf" echo "" echo "Target:" echo "linux-local Compile under local linux distro" echo "linux-amd64 Compile under debian 64bit chroot" echo "linux-i368 Compile under debian 32bit chroot" echo "windows Compile windows binary using wine" } VERSION="" QTBRANCH="staging" while getopts hq:v: O; do case "$O" in [h?]) usage exit 1 ;; v) shift 2 VERSION=$OPTARG ;; q) shift 2 QTBRANCH=$OPTARG ;; esac done if file /bin/true | grep -q 64-bit; then UPX=upx-3.03-amd64_linux else UPX=upx-3.03-i386_linux fi #Helper functions function get() { [ -f $2.download ] || (rm -rf $2; wget $1 -O $2 && touch $2.download) } function unpack() { [ -f $1.unpack ] || (echo "unpacking $1"; (tar -xf $1 || unzip -o $1) && touch $1.unpack) } BASE=${PWD} BUILD=${BASE}/static-build VERSION=$2 function git_fetch_and_update() { if [ ! -d "$1" ]; then git clone "$2" "$1" || (rm -rf "$1" && return 1) fi cd "$1" git fetch origin if ! (git checkout "$3" -f 2>/dev/null && git pull origin "$3" 2>/dev/null); then git branch -a git checkout origin/"$3" -f 2>/dev/null || return 1 git branch -D "$3" 2>/dev/null git checkout origin/"$3" -b "$3" || return 1 git pull origin "$3" -f || return 1 fi cd .. } function checkout() { #Create static build directory mkdir -p $BUILD cd ${BUILD} #Fetch most recent version of qt echo "Updating qt from remote" git_fetch_and_update qt git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git "$QTBRANCH" || exit 1 cd qt #Fetch and unpack upx get http://upx.sourceforge.net/download/${UPX}.tar.bz2 ${UPX}.tar.bz2 || exit 1 unpack ${UPX}.tar.bz2 || exit 1 } function setup_build() { echo "Updating QT" git_fetch_and_update qts ${BUILD}/qt "$QTBRANCH" || exit 1 cd qts if ! [ -z "$VERSION" ] ; then git checkout wkhtmltopdf-$VERSION || exit 1 fi touch conf cat ${BASE}/static_qt_conf_base ${BASE}/static_qt_conf_${1} | sed -re 's/#.*//' | sed -re '/^[ \t]*$/d' | sort -u > conf_new cd .. echo "$(cd ${BASE} && git branch --no-color | sed -nre 's/\* //p')" git_fetch_and_update wkhtmltopdf "${BASE}" "$(cd ${BASE} && git branch --no-color | sed -nre 's/\* //p')" || exit 1 cd wkhtmltopdf if ! [ -z "$VERSION" ] ; then git checkout "$VERSION" || exit 1 fi cd .. [ "$1" == "win" ] && return cat > build.sh < linux-$2/build/buildw.sh chmod +x linux-$2/build/buildw.sh || exit 1 } function build_linux_chroot() { cd ${BUILD} setup_chroot etch $1 cd linux-$1/build setup_build linux if [ "$1" == 'i386' ]; then sudo linux32 chroot ${BUILD}/linux-$1/ /build/buildw.sh || exit 1 else sudo chroot ${BUILD}/linux-$1/ /build/buildw.sh || exit 1 fi ${BUILD}/${UPX}/upx --best ${BUILD}/linux-$1/build/wkhtmltopdf/wkhtmltopdf -o ${BASE}/wkhtmltopdf-$1 || exit 1 } function build_windows() { cd ${BUILD} export WINEPREFIX=${BUILD}/windows if [ ! -f ${BUILD}/windows/create ]; then cat > tmp <. #This script will test a compiled wkhtmltopdf for some basic functionality function result() { printf "%-30s [%-4s]\n" "$1" "$2";} function good() { result "$1" " OK ";} function bad() { result "$1" "Fail"; [ "$2" != "false" ] && export failed=$(($failed+1));} function fs() { du -b "$1" | sed -re 's/([0-9]*).*/\1/';} function wk() { $WK -q "$@"; } function testTest() { (which pdftotext > $LEVEL1 && which pdfinfo > $LEVEL1) && good $1 || bad $1 } #Test if we can convert a html file containing #An image of some format function doTestImgSupport() { [ -f img.$1 ] || convert img.jpg img.$1 rm -rf tmp.pdf echo "Img test $1

    The $1 image

    " > tmp.html wk tmp.html tmp.pdf 2>$LEVEL2 >$LEVEL1 S=`fs tmp.pdf` ([ -f tmp.pdf ] && [[ $S -ge 20000 ]]) && good "$1 Suppport ($S)" || bad "$1 Support ($S)" "$2" } function testJPEGSupport() { doTestImgSupport jpg true } function testGIFSupport() { doTestImgSupport gif true } function testPNGSupport() { doTestImgSupport png true } function testMNGSupport() { doTestImgSupport mng false } function testTIFFSupport() { doTestImgSupport tiff false } function testLocalFile() { echo "Local Test

    Hello

    " > tmp.html wk tmp.html tmp.pdf 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good $1 || bad $1 } function testUserStyleSheet { echo "Local Test

    .

    " > tmp.html echo "p:before {content: \"Hello \"}" > tmp.css wk tmp.html tmp.pdf --user-style-sheet tmp.css 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good $1 || bad $1 false } function testPipeIn() { rm -rf tmp.pdf echo "Local Test

    Hello

    " > tmp.html cat tmp.html | wk - tmp.pdf 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good $1 || bad $1 } function testPipeOutSupport() { echo "Local Test

    Hello

    " > tmp.html wk tmp.html - > tmp.pdf 2>$LEVEL2 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello) && good $1 || bad $1 } function testRemote() { wk http://www.google.dk/ tmp.pdf 2>$LEVEL2 >$LEVEL1 [ -f tmp.pdf ] && good $1 || bad $1 } function testSSL() { wk https://www.google.com/accouts tmp.pdf 2>$LEVEL2 >$LEVEL1 [ -f tmp.pdf ] && good $1 || bad $1 } function testHeaderFooter() { echo "Local Test

    monster

    " > tmp.html wk tmp.html tmp.pdf --footer-left hat --header-right emacs 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q monster && pdftotext tmp.pdf /dev/stdout | grep -q emacs && pdftotext tmp.pdf /dev/stdout | grep -q hat) && good $1 || bad $1 } function testToc() { echo "

    foo

    bar

    baz

    " > tmp.html wk tmp.html tmp.pdf --toc --toc-depth 2 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && [ "$(pdftotext tmp.pdf /dev/stdout | grep -c foo)" == 2 ] && [ "$(pdftotext tmp.pdf /dev/stdout | grep -c bar)" == 2 ] && [ "$(pdftotext tmp.pdf /dev/stdout | grep -c baz)" == 1 ]) && good $1 || bad $1 } function testOutline() { echo "

    foo

    bar

    baz

    " > tmp.html wk tmp.html tmp.pdf --outline --outline-depth 2 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && cat tmp.pdf | grep -q ".f.o.o" && cat tmp.pdf | grep -q ".b.a.r" && ! cat tmp.pdf | grep -q ".b.a.z") && good $1 || bad $1 } function testJSRedirect() { wk http://madalgo.au.dk/~jakobt/jsredirect.html tmp.pdf 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Right) && good $1 || bad $1 } function testServersideRedirect() { wk http://madalgo.au.dk/~jakobt/redirect.php tmp.pdf 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Right) && good $1 || bad $1 } function test404() { wk http://madalgo.au.dk/~jakobt/nosuchfile.nsf tmp.pdf 2>$LEVEL2 >$LEVEL1 && bad $1 || good $1 } function testBadDest() { echo "

    foo

    bar

    baz

    " > tmp.html (! wk tmp.html /proc/cpuinfo 2> tmp.out >$LEVEL1 && grep -q "Error" tmp.out) && good $1 || bad $1 } function testBadSource() { (! wk http://nosuchdomain.nosuchtld tmp.pdf 2> tmp.out && grep -q "Error" tmp.out) && good $1 || bad $1 } function testMultipleInputDocuments() { echo "Local Test

    Hello

    " > tmp.html echo "Local Test

    world

    " > tmp2.html wk tmp.html tmp2.html tmp.pdf 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Hello && pdftotext tmp.pdf /dev/stdout | grep -q world) && good $1 || bad $1 } function testHtmlHeader() { echo "Header" > tmp.html echo "Local Test

    world

    " > tmp2.html wk --header-html tmp.html tmp2.html tmp.pdf 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q Header && pdftotext tmp.pdf /dev/stdout | grep -q world) && good $1 || bad $1 } function testCustomHeader() { wk http://madalgo.au.dk/~jakobt/cookiewrite.php --custom-header "Cookie" "cookie=hello" tmp.pdf 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q hello) && good $1 || bad $1 } function testCookies() { wk --cookie mykey myvalue1 --cookie mykey2 myvalue2 --cookie-jar tmp.jar http://cs.au.dk/~jakobt/cookie.php tmp.pdf 2>$LEVEL2 >$LEVEL1 wk --cookie-jar tmp.jar http://cs.au.dk/~jakobt/cookie.php tmp2.pdf 2>$LEVEL2 >$LEVEL1 ( [ -f tmp.pdf ] && pdftotext tmp.pdf /dev/stdout | grep -q "mykey:myvalue1;" && pdftotext tmp.pdf /dev/stdout | grep -q "mykey2:myvalue2;" && [ -f tmp2.pdf ] && pdftotext tmp2.pdf /dev/stdout | grep -q "writetest:success;") && good $1 || bad $1 } function testTitle() { title="\()fooæøåおさか おかみ" wk http://google.com --title "$title" tmp.pdf 2>$LEVEL2 >$LEVEL1 ([ -f tmp.pdf ] && [[ "$(pdfinfo tmp.pdf | sed -nre 's/Title:[\t ]*//p')" == "$title" ]]) && good $1 || bad $1 } function testQMakeBuild() { (cd .. && git checkout-index --prefix=./test/wkhtmltopdf/ -a) || (bad "$1 (1)" && return 1) cd wkhtmltopdf qmake 2>$LEVEL2 >$LEVEL1 || (bad "$1 (2)" && return 1) make -j2 2>$LEVEL2 >$LEVEL1 || good $1 || bad $1 cd .. } function testArgumentFromStdin() { echo "XFooZ" > tmp.html wk --read-args-from-stdin 2>$LEVEL2 >$LEVEL1 <. -largefile -rpath -no-nis -no-cups -no-iconv -no-pch -no-gtkstyle -no-nas-sound -no-sm -no-xshape -no-xinerama -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-mitshm -no-xinput -no-xkb -no-glib -no-openvg -no-opengl -no-xsync -no-svg wkhtmltopdf-0.9.9.orig/static_qt_conf_base0000644000000000000000000000221411376515611015643 0ustar # This file is part of wkhtmltopdf. # # wkhtmltopdf is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # wkhtmltopdf is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with wkhtmltopdf. If not, see . -release -static -fast -no-exceptions -no-accessibility -no-stl -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-qt3support -no-xmlpatterns -no-phonon -no-phonon-backend -webkit -no-scripttools -no-mmx -no-3dnow -no-sse -no-sse2 -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -graphicssystem raster -opensource -nomake tools -nomake examples -nomake demos -nomake docs -nomake translations -no-opengl -no-dbus -no-multimedia -fast -opensslwkhtmltopdf-0.9.9.orig/README0000644000000000000000000005062311376515611012615 0ustar ==========================> wkhtmltopdf 0.9.6 Manual <========================== This file documents wkhtmltopdf, a program capable of converting html documents into PDF documents. ==================================> Contact <=================================== If you experience bugs or want to request new features please visit , if you have any problems or comments please feel free to contact me: see ===========================> Reduced Functionality <============================ Some versions of wkhtmltopdf are compiled against a version of QT without the wkhtmltopdf patches. These versions are missing some features, you can find out if your version of wkhtmltopdf is one of these by running wkhtmltopdf --version if your version is against an unpatched QT, you can use the static version to get all functionality. Currently the list of features only supported with patch QT includes: * Printing more then one HTML document into a PDF file. * Running without an X11 server. * Adding a document outline to the PDF file. * Adding headers and footers to the PDF file. * Generating a table of contents. * Adding links in the generated PDF file. * Printing using the screen media-type. * Disabling the smart shrink feature of webkit. ==================================> License <=================================== Copyright (C) 2008,2009 Wkhtmltopdf Authors. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. ==================================> Authors <=================================== Written by Jakob Truelsen. Patches by Mário Silva, Benoit Garret and Emmanuel Bouthenot. ==================================> Synopsis <================================== wkhtmltopdf [OPTIONS]... [More input files] ==============================> General Options <=============================== --allow Allow the file or files from the specified folder to be loaded (repeatable) -b, --book * Set the options one would usually set when printing a book --collate Collate when printing multiple copies --cookie Set an additional cookie (repeatable) --cookie-jar Read and write cookies from and to the supplied cookie jar file --copies Number of copies to print into the pdf file (default 1) --cover * Use html document as cover. It will be inserted before the toc with no headers and footers --custom-header Set an additional HTTP header (repeatable) --debug-javascript Show javascript debugging output -H, --default-header * Add a default header, with the name of the page to the left, and the page number to the right, this is short for: --header-left='[webpage]' --header-right='[page]/[toPage]' --top 2cm --header-line --disable-external-links * Do no make links to remote web pages --disable-internal-links * Do no make local links -n, --disable-javascript Do not allow web pages to run javascript --disable-pdf-compression * Do not use lossless compression on pdf objects --disable-smart-shrinking * Disable the intelligent shrinking strategy used by WebKit that makes the pixel/dpi ratio none constant --disallow-local-file-access Do not allowed conversion of a local file to read in other local files, unless explecitily allowed with --allow -d, --dpi Change the dpi explicitly (this has no effect on X11 based systems) --enable-plugins Enable installed plugins (such as flash --encoding Set the default text encoding, for input --extended-help Display more extensive help, detailing less common command switches --forms * Turn HTML form fields into pdf form fields -g, --grayscale PDF will be generated in grayscale -h, --help Display help --htmldoc Output program html help --ignore-load-errors Ignore pages that claimes to have encountered an error during loading -l, --lowquality Generates lower quality pdf/ps. Useful to shrink the result document space --manpage Output program man page -B, --margin-bottom Set the page bottom margin (default 10mm) -L, --margin-left Set the page left margin (default 10mm) -R, --margin-right Set the page right margin (default 10mm) -T, --margin-top Set the page top margin (default 10mm) --minimum-font-size Minimum font size (default 5) --no-background Do not print background -O, --orientation Set orientation to Landscape or Portrait --page-height Page height (default unit millimeter) --page-offset * Set the starting page number (default 1) -s, --page-size Set paper size to: A4, Letter, etc. --page-width Page width (default unit millimeter) --password HTTP Authentication password --post Add an additional post field (repeatable) --post-file Post an aditional file (repeatable) --print-media-type * Use print media-type instead of screen -p, --proxy Use a proxy -q, --quiet Be less verbose --read-args-from-stdin Read command line arguments from stdin --readme Output program readme --redirect-delay Wait some milliseconds for js-redirects (default 200) --replace * Replace [name] with value in header and footer (repeatable) --stop-slow-scripts Stop slow running javascripts --title The title of the generated pdf file (The title of the first document is used if not specified) -t, --toc * Insert a table of content in the beginning of the document --use-xserver * Use the X server (some plugins and other stuff might not work without X11) --user-style-sheet Specify a user style sheet, to load with every page --username HTTP Authentication username -V, --version Output version information an exit --zoom Use this zoom factor (default 1) Items marked * are only available using patched QT. =========================> Headers And Footer Options <========================= --footer-center * Centered footer text --footer-font-name * Set footer font name (default Arial) --footer-font-size * Set footer font size (default 11) --footer-html * Adds a html footer --footer-left * Left aligned footer text --footer-line * Display line above the footer --footer-right * Right aligned footer text --footer-spacing * Spacing between footer and content in mm (default 0) --header-center * Centered header text --header-font-name * Set header font name (default Arial) --header-font-size * Set header font size (default 11) --header-html * Adds a html header --header-left * Left aligned header text --header-line * Display line below the header --header-right * Right aligned header text --header-spacing * Spacing between header and content in mm (default 0) Items marked * are only available using patched QT. ==========================> Table Of Content Options <========================== --toc-depth * Set the depth of the toc (default 3) --toc-disable-back-links * Do not link from section header to toc --toc-disable-links * Do not link from toc to sections --toc-font-name * Set the font used for the toc (default Arial) --toc-header-font-name * The font of the toc header (if unset use --toc-font-name) --toc-header-font-size * The font size of the toc header (default 15) --toc-header-text * The header text of the toc (default Table Of Contents) --toc-l1-font-size * Set the font size on level 1 of the toc (default 12) --toc-l1-indentation * Set indentation on level 1 of the toc (default 0) --toc-l2-font-size * Set the font size on level 2 of the toc (default 10) --toc-l2-indentation * Set indentation on level 2 of the toc (default 20) --toc-l3-font-size * Set the font size on level 3 of the toc (default 8) --toc-l3-indentation * Set indentation on level 3 of the toc (default 40) --toc-l4-font-size * Set the font size on level 4 of the toc (default 6) --toc-l4-indentation * Set indentation on level 4 of the toc (default 60) --toc-l5-font-size * Set the font size on level 5 of the toc (default 4) --toc-l5-indentation * Set indentation on level 5 of the toc (default 80) --toc-l6-font-size * Set the font size on level 6 of the toc (default 2) --toc-l6-indentation * Set indentation on level 6 of the toc (default 100) --toc-l7-font-size * Set the font size on level 7 of the toc (default 0) --toc-l7-indentation * Set indentation on level 7 of the toc (default 120) --toc-no-dots * Do not use dots, in the toc Items marked * are only available using patched QT. ==============================> Outline Options <=============================== --dump-outline * Dump the outline to a file --outline * Put an outline into the pdf --outline-depth * Set the depth of the outline (default 4) Items marked * are only available using patched QT. =============================> Specifying A Proxy <============================= By default proxy information will be read from the environment variables: proxy, all_proxy and http_proxy, proxy options can also by specified with the -p switch := "http://" | "socks5://" := (":" )? "@" := "None" | ? ? (":" )? Here are some examples (In case you are unfamiliar with the BNF): http://user:password@myproxyserver:8080 socks5://myproxyserver None ============================> Footers And Headers <============================= Headers and footers can be added to the document by the --header-* and --footer* arguments respectfully. In header and footer text string supplied to e.g. --header-left, the following variables will be substituted. * [page] Replaced by the number of the pages currently being printed * [frompage] Replaced by the number of the first page to be printed * [topage] Replaced by the number of the last page to be printed * [webpage] Replaced by the URL of the page being printed * [section] Replaced by the name of the current section * [subsection] Replaced by the name of the current subsection * [date] Replaced by the current date in system local format * [time] Replaced by the current time in system local format As an example specifying --header-right "Page [page] of [toPage]", will result in the text "Page x of y" where x is the number of the current page and y is the number of the last page, to appear in the upper left corner in the document. Headers and footers can also be supplied with HTML documents. As an example one could specify --header-html header.html, and use the following content in header.html:
    Page of
    As can be seen from the example, the arguments are sent to the header/footer html documents in get fashion. ==================================> Outlines <================================== Wkhtmltopdf with patched qt has support for PDF outlines also known as book marks, this can be enabled by specifying the --outline switch. The outlines are generated based on the tags, for a in-depth description of how this is done see the "Table Of Contest" section. The outline tree can sometimes be very deep, if the tags where spread to generous in the HTML document. The --outline-depth switch can be used to bound this. ===============================> Page Breaking <================================ The current page breaking algorithm of WebKit leaves much to be desired. Basically webkit will render everything into one long page, and then cut it up into pages. This means that if you have two columns of text where one is vertically shifted by half a line. Then webkit will cut a line into to pieces display the top half on one page. And the bottom half on another page. It will also break image in two and so on. If you are using the patched version of QT you can use the CSS page-break-inside property to remedy this somewhat. There is no easy solution to this problem, until this is solved try organising your HTML documents such that it contains many lines on which pages can be cut cleanly. See also: , and . =================================> Page sizes <================================= The default page size of the rendered document is A4, but using this --page-size optionthis can be changed to almost anything else, such as: A3, Letter and Legal. For a full list of supported pages sizes please see . For a more fine grained control over the page size the --page-height and --page-width options may be used ========================> Reading arguments from stdin <======================== If you need to convert a lot of pages in a batch, and you feel that wkhtmltopdf is a bit to slow to start up, then you should try --read-args-from-stdin, When --read-args-from-stdin each line of input sent to wkhtmltopdf on stdin will act as a separate invocation of wkhtmltopdf, with the arguments specified on the given line combined with the arguments given to wkhtmltopdf For example one could do the following: echo "http://doc.trolltech.com/4.5/qapplication.html qapplication.pdf" >> cmds echo "--cover google.com http://en.wikipedia.org/wiki/Qt_(toolkit) qt.pdf" >> cmds wkhtmltopdf --read-args-from-stdin --book < cmds ===============================> Static version <=============================== On the wkhtmltopdf website you can download a static version of wkhtmltopdf . This static binary will work on most systems and comes with a build in patched QT. Unfortunately the static binary is not particularly static, on Linux it depends on both glibc and openssl, furthermore you will need to have an xserver installed but not necessary running. You will need to have different fonts install including xfonts-scalable (Type1), and msttcorefonts. See for trouble shouting. ================================> Compilation <================================= It can happen that the static binary does not work for your system for one reason or the other, in that case you might need to compile wkhtmltopdf yourself. *GNU/Linux:* Before compilation you will need to install dependencies: X11, gcc, git and openssl. On Debian/Ubuntu this can be done as follows: sudo apt-get build-dep libqt4-gui libqt4-network libqt4-webkit sudo apt-get install openssl build-essential xorg git-core git-doc libssl-dev On other systems you must use your own package manager, the packages might be named differently. First you must check out the modified version of QT git clone git://gitorious.org/+wkhtml2pdf/qt/wkhtmltopdf-qt.git wkhtmltopdf-qt Next you must configure, compile and install QT, note this will take quite some time, depending on what arguments you use to configure qt cd wkhtmltopdf-qt ./configure -nomake tools,examples,demos,docs,translations -opensource -prefix ../wkqt make -j3 make install cd .. All that is needed now is, to compile wkhtmltopdf. git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf cd wkhtmltopdf ../wkqt/bin/qmake make -j3 You show now have a binary called wkhtmltopdf in the currently folder that you can use, you can optionally install it by running make install *Other operative systems and advanced features* If you want more details or want to compile under other operative systemsother then GNU/Linux, please see . ================================> Installation <================================ There are several ways to install wkhtmltopdf. You can download a already compiled binary, or you can compile wkhtmltopdf yourself. On windows the easiest way to install wkhtmltopdf is to download the latest installer. On linux you can download the latest static binary, however you still need to install some other pieces of software, to learn more about this read the static version section of the manual. ==================================> Examples <================================== This section presents a number of examples of how to invoke wkhtmltopdf. To convert a remote HTML file to PDF: wkhtmltopdf http://www.google.com google.pdf To convert a local HTML file to PDF: wkhtmltopdf my.html my.pdf You can also convert to PS files if you like: wkhtmltopdf my.html my.ps Produce the eler2.pdf sample file: wkhtmltopdf http://geekz.co.uk/lovesraymond/archive/eler-highlights-2008 eler2.pdf -H --outline