C# Class Dogbert2.Services.PdfService

Inheritance: IPdfService
Datei anzeigen Open project: ucdavis/Dogbert

Public Methods

Method Description
AddImage ( int fileId, PdfPCell pCell = null ) : void
GeneratePdf ( Project project, bool draft ) : byte[]

Generates a pdf document

PdfMerger ( List files ) : byte[]
PdfService ( IRepository fileRepository, IRepository sectionTypeRepository ) : System
ScanForImage ( string txt, PdfPCell pCell = null ) : string
WatermarkPdf ( byte pdf, string watermarkTxt ) : byte[]
WriteToPdf ( byte pdf, string stringToWriteToPdf ) : byte[]

Adds a watermark to all pages in the pdf, even takes into account orientation

http://footheory.com/blogs/donnfelker/archive/2008/05/11/using-itextsharp-to-watermark-write-text-to-existing-pdf-s.aspx

Private Methods

Method Description
AddCoverpage ( PdfContentByte cb ) : void
AddDisclaimerInformation ( PdfContentByte cb, Document doc, Project project ) : void

Add in the light grey disclaimer on the bottom of the front page

AddGlossary ( PdfPTable table, Project project ) : void
AddHtmlText ( string text, PdfPCell pCell = null ) : void

Parse out the html and format it using iTextSharp's stuff

http://blog.dmbcllc.com/2009/07/28/itextsharp-html-to-pdf-parsing-html/ (not being used)

AddProjectInformation ( PdfContentByte cb, Document doc, Project project ) : void

Adds in the project name, and clien information

AddRequirementTable ( PdfPTable table, Project project ) : void
AddSectionHeader ( string title, PdfPCell pCell = null ) : void
AddToPage ( PdfPTable table ) : void

Adds the table to the document taking into account what is currently on the page

AddUseCases ( PdfPTable table, Project project ) : void
AddWorkerInformation ( PdfContentByte cb, Document doc, Project project ) : void

Adds in worker information, Department(s), Unit(s), and PM/Lead Programmer

BuildDocObject ( List elements, PdfPCell pCell = null ) : Paragraph
BuildListObject ( List elements, string listType, PdfPCell pCell = null ) : List
BuildUseCaseTable ( UseCase useCase ) : PdfPCell
CreateCell ( Chunk chunk = null, Phrase phrase = null, float borderLeft = null, float borderTop = null, float borderRight = null, float borderBottom = null, float borderAll = null, float paddingLeft = null, float paddingTop = null, float paddingRight = null, float paddingBottom = null, float paddingAll = null ) : PdfPCell

Defaults to creating cell with no border and no padding

CreateTableHeader ( string text, CMYKColor backgroundColor = null, float borderWidth = null, float padding = null ) : PdfPCell

Creates a formatted cell for a table header

DrawBoxForCover ( PdfContentByte cb, Document doc ) : void

Draws the box on the cover page that contains the date

GetHypotenuseAngleInDegreesFrom ( double opposite, double adjacent ) : double

Calculates the angle for the watermark

http://footheory.com/blogs/donnfelker/archive/2008/05/11/using-itextsharp-to-watermark-write-text-to-existing-pdf-s.aspx

HandleTag ( Stack elements, HtmlElement element, PdfPCell pCell = null ) : Phrase

Generates new phrase element with all sub formatting

InitializeDocument ( ) : void
InitializeTable ( int columns = 1 ) : PdfPTable

Initializes a pdf p table

IsReadyToProcess ( string tag ) : bool

Determines if readed end of block element that cooresponds to iTextSharp objects

Method Details

AddImage() public method

public AddImage ( int fileId, PdfPCell pCell = null ) : void
fileId int
pCell iTextSharp.text.pdf.PdfPCell
return void

GeneratePdf() public method

Generates a pdf document
public GeneratePdf ( Project project, bool draft ) : byte[]
project Project
draft bool
return byte[]

PdfMerger() public method

public PdfMerger ( List files ) : byte[]
files List
return byte[]

PdfService() public method

public PdfService ( IRepository fileRepository, IRepository sectionTypeRepository ) : System
fileRepository IRepository
sectionTypeRepository IRepository
return System

ScanForImage() public method

public ScanForImage ( string txt, PdfPCell pCell = null ) : string
txt string
pCell iTextSharp.text.pdf.PdfPCell
return string

WatermarkPdf() public method

public WatermarkPdf ( byte pdf, string watermarkTxt ) : byte[]
pdf byte
watermarkTxt string
return byte[]

WriteToPdf() public method

Adds a watermark to all pages in the pdf, even takes into account orientation
http://footheory.com/blogs/donnfelker/archive/2008/05/11/using-itextsharp-to-watermark-write-text-to-existing-pdf-s.aspx
public WriteToPdf ( byte pdf, string stringToWriteToPdf ) : byte[]
pdf byte
stringToWriteToPdf string
return byte[]