# eric7.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)).
PDFRender | Class to manage line and page rendering.
PDFStyle | Simple class to store the values of a PDF style.

### Functions

createExporter | Function to instantiate an exporter object.

## 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 (QScintilla.Editor.Editor)
  reference to the editor object
parent (QObject)
  parent object of the exporter

#### ExporterPDF.__getPDFRGB

__getPDFRGB(color)

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

color (QColor)
  color object to convert

Return:
  PDF color description

Return Type:
  str

#### 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

None

### 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)
  file object open for writing

#### PDFObjectTracker.add

add(objectData)

Public method to add a new object.

objectData (int or str)
  data to be added

Return:
  object number assigned to the supplied data

Return Type:
  int

#### PDFObjectTracker.write

write(objectData)

Public method to write the data to the file.

objectData (int or str)
  data to be written

#### PDFObjectTracker.xref

xref()

Public method to build the xref table.

Return:
  file offset of the xref table

Return Type:
  int

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

None

### 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 (str)
  character to add
style_ (int)
  number of the style of the character

#### 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.

thousandths (int)
  font size

Return:
  point size of the font

Return Type:
  int

#### PDFRender.nextLine

nextLine()

Public method to start a new line.

#### PDFRender.setStyle

setStyle(style_)

Public method to set a style.

style_ (int)
  style to be set

Return:
  the PDF string to set the given style

Return Type:
  str

#### 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

None

### Class Attributes

font
fore

### Class Methods

None

### Methods

None

### Static Methods

None

Up

## createExporter

createExporter(editor, parent=None)

Function to instantiate an exporter object.

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

Return:
  exporter object

Return Type:
  ExporterPDF

Up