Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
testing.tools.fixup_pdf_template Namespace Reference

Classes

class  StreamLenState
 
class  TemplateProcessor
 

Functions

 expand_file (infile, output_path)
 
 insert_includes (input_path, output_file, visited_set)
 
 main ()
 

Variables

str WINDOWS_LINE_ENDING = b'\r\n'
 
str UNIX_LINE_ENDING = b'\n'
 
list EXTENSION_OVERRIDE_LINE_ENDINGS
 

Detailed Description

Expands a hand-written PDF testcase (template) into a valid PDF file.

There are several places in a PDF file where byte-offsets are required. This
script replaces {{name}}-style variables in the input with calculated results

  {{include path/to/file}} - inserts file's contents into stream.
  {{header}} - expands to the header comment required for PDF files.
  {{xref}} - expands to a generated xref table, noting the offset.
  {{trailer}} - expands to a standard trailer with "1 0 R" as the /Root.
  {{trailersize}} - expands to `/Size n`, to be used in non-standard trailers.
  {{startxref} - expands to a startxref directive followed by correct offset.
  {{startxrefobj x y} - expands to a startxref directive followed by correct
                        offset pointing to the start of `x y obj`.
  {{object x y}} - expands to `x y obj` declaration, noting the offset.
  {{streamlen}} - expands to `/Length n`.

Function Documentation

◆ expand_file()

testing.tools.fixup_pdf_template.expand_file ( infile,
output_path )

Definition at line 147 of file fixup_pdf_template.py.

References open(), and print().

Referenced by testing.tools.fixup_pdf_template.main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert_includes()

testing.tools.fixup_pdf_template.insert_includes ( input_path,
output_file,
visited_set )

Definition at line 162 of file fixup_pdf_template.py.

References decode, testing.tools.fixup_pdf_template.insert_includes(), open(), and print().

Referenced by testing.tools.fixup_pdf_template.insert_includes(), and testing.tools.fixup_pdf_template.main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main()

testing.tools.fixup_pdf_template.main ( )

Definition at line 200 of file fixup_pdf_template.py.

References testing.tools.fixup_pdf_template.expand_file(), testing.tools.fixup_pdf_template.insert_includes(), testing.tools.fixup_pdf_template.main(), and set.

Referenced by testing.tools.fixup_pdf_template.main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ EXTENSION_OVERRIDE_LINE_ENDINGS

list testing.tools.fixup_pdf_template.EXTENSION_OVERRIDE_LINE_ENDINGS
Initial value:
1= [
2 '.js',
3 '.fragment',
4 '.in',
5 '.xml',
6]

Definition at line 33 of file fixup_pdf_template.py.

◆ UNIX_LINE_ENDING

str testing.tools.fixup_pdf_template.UNIX_LINE_ENDING = b'\n'

Definition at line 30 of file fixup_pdf_template.py.

◆ WINDOWS_LINE_ENDING

str testing.tools.fixup_pdf_template.WINDOWS_LINE_ENDING = b'\r\n'

Definition at line 29 of file fixup_pdf_template.py.