GraffitiPDF

View Categories

Enumerations #

This class exposes no enumerations.

Contants #

NameValue
FormatA0 as String“a0”
FormatA1 as String“a1”
FormatA2 as String“a2”
FormatA3 as String“a3”
FormatA4 as String“a4”
FormatA5 as String“a5”
FormatA6 as String“a6”
FormatA7 as String“a7”
FormatA8 as String“a8”
FormatA9 as String“a9”
FormatA10 as String“a10”
FormatB0 as String“b0”
FormatB1 as String“b1”
FormatB2 as String“b2”
FormatB3 as String“b3”
FormatB4 as String“b4”
FormatB5 as String“b5”
FormatB6 as String“b6”
FormatB7 as String“b7”
FormatB8 as String“b8”
FormatB9 as String“b9”
FormatB10 as String“b10”
FormatC0 as String“c0”
FormatC1 as String“c1”
FormatC2 as String“c2”
FormatC3 as String“c3”
FormatC4 as String“c4”
FormatC5 as String“c5”
FormatC6 as String“c6”
FormatC7 as String“c7”
FormatC8 as String“c8”
FormatC9 as String“c9”
FormatC10 as String“c10”
FormatCreditCard as String“credit-card”
FormatDL as String as String“dl”
FormatGovernmentLetter“government-letter”
FormatJuniorLegal as String“junior-legal”
FormatLedger as String“ledger”
FormatLegal as String“legal”
FormatLetter as String“letter”
FormatTabloid as String“tabloid”
LineStyleBevel as Number0
LineStyleRound as Number1
LineStyleSquare as Number2
OrientationLandscape as String“landscape”
OrientationPortrait as String“portrait”
SideLeft as Number0
SideRight as Number1
UnitCentimeters as String“cm”
UnitInches as String“in”
UnitMillimeters as String“mm”
UnitPoints as String“pt”

Events #

DefinitionParametersReturn TypeDescription
DocumentReadyfile as GraffitiWebFile = NilNoneFired when the document has been completed.
TableUpdatedtheTable as GraffitiWebPDFTableNoneRaised when a table has been added to the document and its StartY and EndY properties are populated.

Methods #

NameParametersReturn TypeDescription
AddBezierStartX as DoubleNoneAdd a bezier curve to the PDF.
StartY as Double
X1 as Double
Y1 as Double
X2 as Double
Y2 as Double
X3 as Double
Y3 as Double
AddCircleX as DoubleNoneAdd a circle to the PDF.
Y as Double
Radius as Double
hasFill as Boolean = False
hasStroke as Boolean = False
AddEllipseX as DoubleNoneAdd an ellipse to the PDF.
Y as Double
RadiusX as Double
RadiusY as Double
hasFill as Boolean = False
hasStroke as Boolean = False
AddHTMLHTMLContent as StringNoneAdd HTML to the PDF. W is the width of the area to render on.
W as Integer = 1200 
AddImagePictureData as StringNoneAdd an image to the PDF. PictureData should be a BASE64 compatible URIstring.
Type as String
X as Double
Y as Double
W as Double = – 1
H as Double = – 1
AddLineX1 as DoubleNoneDraws a line on the PDF.
Y1 as Double
X2 as Double
Y2 as Double
hasFill as Boolean = False
hasStroke as Boolean = False
AddPageW as Double = 210NoneAdds a page to the PDF. W and H are dimensions.
H as Double = 297
AddRectX as DoubleNoneDraws a rectangle on the PDF.
Y as Double
W as Double
H as Double
hasFill as Boolean = False
hasStroke as Boolean = False
AddRoundedRectX as DoubleNoneDraws a rounded rectangle on the PDF.
Y as Double
W as Double
H as Double
RadiusX as Double
RadiusY as Double
hasFill as Boolean = False
hasStroke as Boolean = False
AddTableData as GraffitiWebPDFTableNoneDraws a table on the PDF.
AddTexttheContent as StringNoneDraws text on the PDF.
X as Integer
Y as Integer
BlockWidth as Double = -1
AddTriangleX1 as DoubleNoneDraws a triangle on the PDF.
Y1 as Double
X2 as Double
Y2 as Double
X3 as Double
Y3 as Double
hasFill as Boolean = False
hasStroke as Boolean = False
DownloadFilename as StringNoneConstructs the PDF and sends it to the browser for download.
FromHTMLtheHTML as StringNoneCreates a PDF from an HTML string.
DocumentOrientation as String = “portrait”
DocumentUnits as String = “pt”
DocumentFormat as String = “letter”
Margin as Double = 0
GetTabletableID as StringGraffitiWebPDFTableGets an added table object.
LoadInViewertheViewer as WebHTMLViewerNoneWill load the output of the PDFOutput event in to a WebHTMLViewer.
theContent as String
NewDocumentDocumentOrientation as String = “portrait”NoneStart a new PDF document.
DocumentUnits as String = “mm”
DocumentFormat as String = “A4”
OutputNoneNoneTell GraffitiWebPDF to compile and output the data.
SetFillColortheColor as ColorNoneChanges the document’s Fill Color for items added after calling this method.
SetFillColorGray as IntegerNone
SetFillColorRed as IntegerNone
Green as Integer
Blue as Integer
SetFillColorCyan as IntegerNone
Magenta as Integer
Yellow as Integer
Key as Integer
SetFontFace as StringNoneChanges the document’s font face and style for items added after calling this method.
Style as String
SetFontSizenewSize as DoubleNoneChanges the document’s font size for items added after calling this method.
SetFontStyleStyle as StringNoneChanges the document’s font style for items added after calling this method.
SetLineCapStyle as IntegerNoneChanges the style of line end caps.
SetLineJoinStyle as IntegerNoneChanges the style of line joints.
SetLineWidthW as DoubleNoneSets the thickness of lines drawn after calling this method.
SetPagePageNumber as IntegerNoneChanges the currently selected page within the document.
SetPropertiesTitle as StringNoneSets the properties of the current document.
Subject as String = “”
Author as String = “”
Keywords as String = “”
Creator as String = “GraffitiWebPDF”
SetStrokeColortheColor as ColorNoneChanges the stroke color for items added to the document after this method is called.
SetStrokeColorGray as IntegerNone
SetStrokeColorRed as IntegerNone
Green as Integer
Blue as Integer
SetStrokeColorCyan as IntegerNone
Magenta as Integer
Yellow as Integer
Key as Integer
SetTextColortheColor as ColorNoneChanges the text color of items added after this method is called.
SetTextColorGray as IntegerNone
SetTextColorRed as IntegerNone
Green as Integer
Blue as Integer
SetTextColorCyan as IntegerNone
Magenta as Integer
Yellow as Integer
Key as Integer

Properties #

NameTypeDefault ValueDescription
AvailableFontsJSONItemNilThe fonts on the user’s machine which are available for use in PDFs.
HasCoverPageBooleanFalseIf True, the PageTemplate will not be applied to the first page and the numbering will shift accordingly to exclude the first page of the document.
PageTemplateGraffitiPDFTemplateNilHeader and footer template to apply to pages.
UploadPathFolderItemNilPath to save built PDFs to on the server. File are saved in an identifier/year/month/day/name scheme.
UploadPathMakeSafeBooleanTrueWill attempt to sort returned PDF files in such a way that one user’s uploads will not effect those of another. If you set this to False, generated files will be saved directly in the UploadPath and you may run in to issues in multi-user environments. Sorting these problems out will not be supported as the recommended setting is to leave this property’s value as True.

Examples #

Saving PDFs on the Server #

Defining the UploadPath property will cause generated PDFs to be automatically saved on your server in the path you provide with the following structure:/UploadPath/Session.Identifier/Year/Month/Day/Filename.PDF

Data is not retained in the GraffitiWebFile object to reduce memory usage, and is written directly to the file as it is received.

If UploadPath is Nil then file data will not be transferred back to the server and DocumentReady is only an indicator that you may then safely call the Download, LoadInViewer, and Print methods for client-side functionality.

Notes #

HTML Methods #

The AddHTML and FromHTML methods are currently experimental per the developers of the underlying library. Issues may arise depending on your usage of these methods.

In FromHTML, you can explicitly add your own page breaks by inserting <div class='html2pdf__page-break'></div> in your HTML.

LoadInViewer #

In order for LoadInViewer to function, your WebHTMLViewer must have the following code in its Shown event:

me.LoadURL( "about:blank" )