# eric4.QScintilla.Exporters.ExporterPDF

Module implementing an exporter for PDF.

### Global Attributes

PDF_ENCODING
PDF_FONTSIZE_DEFAULT
PDF_FONT_DEFAULT
PDF_MARGIN_DEFAULT
PDF_SPACING_DEFAULT
PDFfontAscenders
PDFfontDescenders
PDFfontNames
PDFfontWidths
PDFpageSizes

### Classes

ExporterPDF | Class implementing an exporter for PDF.
PDFObjectTracker | Class to conveniently handle the tracking of PDF objects so that the cross-reference table can be built (PDF1.4Ref(p39)) All writes to the file are passed through a PDFObjectTracker object.
PDFRender | Class to manage line and page rendering.
PDFStyle | Simple class to store the values of a PDF style.

### Functions

None

## ExporterPDF

Class implementing an exporter for PDF.

### Derived from

ExporterBase

### Class Attributes

None

### Class Methods

None

### Methods

ExporterPDF | Constructor
__getPDFRGB | Private method to convert a color object to the correct PDF color.
exportSource | Public method performing the export.

### Static Methods

None

#### ExporterPDF (Constructor)

ExporterPDF(editor, parent = None)

Constructor

editor
  reference to the editor object (QScintilla.Editor.Editor)
parent
  parent object of the exporter (QObject)

#### ExporterPDF.__getPDFRGB

__getPDFRGB(color)

Private method to convert a color object to the correct PDF color.

color
  color object to convert (QColor)

Returns:
  PDF color description (string)

#### ExporterPDF.exportSource

exportSource()

Public method performing the export.

Up

## PDFObjectTracker

Class to conveniently handle the tracking of PDF objects so that the cross-reference table can be built (PDF1.4Ref(p39)) All writes to the file are passed through a PDFObjectTracker object.

### Derived from

object

### Class Attributes

None

### Class Methods

None

### Methods

PDFObjectTracker | Constructor
add | Public method to add a new object.
write | Public method to write the data to the file.
xref | Public method to build the xref table.

### Static Methods

None

#### PDFObjectTracker (Constructor)

PDFObjectTracker(file)

Constructor

file
  file object open for writing (file)

#### PDFObjectTracker.add

add(objectData)

Public method to add a new object.

objectData
  data to be added (integer or string)

Returns:
  object number assigned to the supplied data (integer)

#### PDFObjectTracker.write

write(objectData)

Public method to write the data to the file.

objectData
  data to be written (integer or string)

#### PDFObjectTracker.xref

xref()

Public method to build the xref table.

Returns:
  file offset of the xref table (integer)

Up

## PDFRender

Class to manage line and page rendering.

Apart from startPDF, endPDF everything goes in via add() and nextLine() so that line formatting and pagination can be done properly.

### Derived from

object

### Class Attributes

None

### Class Methods

None

### Methods

PDFRender | Constructor
add | Public method to add a character to the page.
endPDF | Public method to end the PDF document.
endPage | Public method to end a page.
flushSegment | Public method to flush a segment of data.
fontToPoints | Public method to convert the font size to points.
nextLine | Public method to start a new line.
setStyle | Public method to set a style.
startPDF | Public method to start the PDF document.
startPage | Public method to start a new page.

### Static Methods

None

#### PDFRender (Constructor)

PDFRender()

Constructor

#### PDFRender.add

add(ch, style_)

Public method to add a character to the page.

ch
  character to add (string)
style_
  number of the style of the character (integer)

#### PDFRender.endPDF

endPDF()

Public method to end the PDF document.

#### PDFRender.endPage

endPage()

Public method to end a page.

#### PDFRender.flushSegment

flushSegment()

Public method to flush a segment of data.

#### PDFRender.fontToPoints

fontToPoints(thousandths)

Public method to convert the font size to points.

Returns:
  point size of the font (integer)

#### PDFRender.nextLine

nextLine()

Public method to start a new line.

#### PDFRender.setStyle

setStyle(style_)

Public method to set a style.

style_
  style to be set (integer)

Returns:
  the PDF string to set the given style (string)

#### PDFRender.startPDF

startPDF()

Public method to start the PDF document.

#### PDFRender.startPage

startPage()

Public method to start a new page.

Up

## PDFStyle

Simple class to store the values of a PDF style.

### Derived from

object

### Class Attributes

None

### Class Methods

None

### Methods

PDFStyle | Constructor

### Static Methods

None

#### PDFStyle (Constructor)

PDFStyle()

Constructor

Up