platypus.pdf
Class OutfilePdf

java.lang.Object
  extended by platypus.Outfile
      extended by platypus.pdf.OutfilePdf

public class OutfilePdf
extends Outfile

Handles document creation/termination and command routines in iText library

Author:
alb

Field Summary
private  java.lang.String filename
           
private  GDD.FileType fileType
          the type of file: PDF, HTML, etc.
private  GDD gdd
           
(package private)  com.lowagie.text.pdf.ColumnText iTColumn
           
(package private)  com.lowagie.text.pdf.PdfContentByte iTContentByte
          for writing to columns
 com.lowagie.text.Document iTDocument
          some commands cannot occur after any text has been ouput.
(package private)  com.lowagie.text.Paragraph iTPara
           
(package private)  com.lowagie.text.pdf.PdfWriter iTWriter
           
private  Literals lits
           
private  boolean openStatus
          is the file open? so, true = open; false = not open
 
Fields inherited from class platypus.Outfile
textProcessedFlag
 
Constructor Summary
OutfilePdf()
           
 
Method Summary
 void addColumnsContentToDocument()
          Adds any material in the columns to the document.
 int addParagraph()
          Adds paragraph to document.
 void close()
          iText-required function at end of processing.
 void doNewParagraph()
           
 void emitText(java.lang.String s)
          Two actions can result from an item in an input file: it can set the value of a variable (such as margins, for example) or result in text that must be emitted to the output file stream.
 void FTOsetDocument(com.lowagie.text.Document newDoc)
           
 java.lang.String getFilename()
           
 GDD.FileType getFileType()
           
private  void indentParagraphFirstLine(float indentPoints)
          Indent the first line of the paragraph by indentPoints This code requires explanation.
 boolean isOpen()
           
 boolean lowLevelPdfNewPage()
           
 int newPage()
          Creates a new page in the document.
 void newParagraph()
          create a new paragraph in iText and indent the first line as specified.
 int open()
          creates and opens iText document into which we write the ouput.
 void setFilename(java.lang.String newName)
           
 void setFileType(GDD.FileType newFileType)
           
 void setOpenStatus(boolean newStatus)
           
 
Methods inherited from class platypus.Outfile
hasTextBeenProcessed, setTextProcessedFlag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

private java.lang.String filename

fileType

private GDD.FileType fileType
the type of file: PDF, HTML, etc.


openStatus

private boolean openStatus
is the file open? so, true = open; false = not open


iTDocument

public com.lowagie.text.Document iTDocument
some commands cannot occur after any text has been ouput. To monitor, we use this flag.


iTPara

com.lowagie.text.Paragraph iTPara

iTWriter

com.lowagie.text.pdf.PdfWriter iTWriter

iTContentByte

com.lowagie.text.pdf.PdfContentByte iTContentByte
for writing to columns


iTColumn

com.lowagie.text.pdf.ColumnText iTColumn

gdd

private final GDD gdd

lits

private final Literals lits
Constructor Detail

OutfilePdf

public OutfilePdf()
Method Detail

open

public int open()
creates and opens iText document into which we write the ouput. Important note: This method is called only when Platypus has text to emit, so we know something about state at this point: All commands that must precede the first text have been processed.

Returns:
Status.OK on normal completion; otherwise, an error code.

addParagraph

public int addParagraph()
Adds paragraph to document. The paragraph we are adding is always the current one pointed to by iTPara. If it's null, there is nothing to add, so we just return.

Overrides:
addParagraph in class Outfile
Returns:
Status.OK if all goes well, otherwise Status.ERR

newPage

public int newPage()
Creates a new page in the document.

Overrides:
newPage in class Outfile
Returns:
Status.OK if all went well, Status.DOCUMENT_CLOSED_ERR if Document not open

lowLevelPdfNewPage

public boolean lowLevelPdfNewPage()
Overrides:
lowLevelPdfNewPage in class Outfile

doNewParagraph

public void doNewParagraph()
Overrides:
doNewParagraph in class Outfile

newParagraph

public void newParagraph()
create a new paragraph in iText and indent the first line as specified.


indentParagraphFirstLine

private void indentParagraphFirstLine(float indentPoints)
Indent the first line of the paragraph by indentPoints This code requires explanation. iText, prior to v. 2, did not have a way to indent the first line of a paragraph. So, what we do is add spaces to make up the intended indent. The space character in the 7-point Helvetica font is 1.946 pts wide. We divide the specified indent by this amount. then round, and we get the number of spaces to add to the paragraph. Luckily, iText does not compress sequential spaces, so this actually works. I admit, it's a hack. -alb

Parameters:
indentPoints - amount to indent the first line

close

public void close()
iText-required function at end of processing. Basically, output any not-yet-output content to the document. Then, close the file.

Overrides:
close in class Outfile

addColumnsContentToDocument

public void addColumnsContentToDocument()
Adds any material in the columns to the document. This is where the content is written to the PDF file.

Overrides:
addColumnsContentToDocument in class Outfile

emitText

public void emitText(java.lang.String s)
Two actions can result from an item in an input file: it can set the value of a variable (such as margins, for example) or result in text that must be emitted to the output file stream. emit() handles this latter function.

Overrides:
emitText in class Outfile
Parameters:
s - text string to send to output

setFilename

public void setFilename(java.lang.String newName)
Overrides:
setFilename in class Outfile

getFilename

public java.lang.String getFilename()

getFileType

public GDD.FileType getFileType()
Overrides:
getFileType in class Outfile

setFileType

public void setFileType(GDD.FileType newFileType)
Overrides:
setFileType in class Outfile

isOpen

public boolean isOpen()
Overrides:
isOpen in class Outfile

setOpenStatus

public void setOpenStatus(boolean newStatus)

FTOsetDocument

public void FTOsetDocument(com.lowagie.text.Document newDoc)


Copyright © 2006-7 Pacific Data Works LLC