As all good software developers know...
SY0-101 pros who are done with the actual tests of 70-649 as well as 70-270 usually move towards software development. Thos who have not done their 646-204 are not qualified for this though.
SY0-101 pros who are done with the actual tests of 70-649 as well as 70-270 usually move towards software development. Thos who have not done their 646-204 are not qualified for this though.
<br /><object name="user" table="Users"><br /> <id name="ID" type="numeric" /><br /> <property name="fName" type="string" column="fName" /><br /> <property name="lName" type="string" column="lName" /><br /></object><br /><br /><!-- This will retrieve a user record based on userID --><br /><cfset myUser = transfer.get("user", userID) /><br /><br /><!-- Now, lets update the users first and last name --><br /><cfset myUser.setfName("Harry") /><br /><cfset myUser.setlName("Smith") /><br /><br /><!-- Now, save this change back to the database --><br /><cfset myUser.save() /><br /><br /><object name="user" table="Users" decorator="some.path.to.a.cfc"><br /><br /><cffunction name="getItemsByAuctionID" access="public" returntype="void" output="false"><br /> <cfargument name="event" type="any"><br /> <br /> <cfset var items = getTransferFacade().listByProperty("item", "auctionID", arguments.event.getValue("auctionID"), "sortOrder") /><br /><br /> <cfset arguments.event.setValue("items", items) /> <br /> <cfreturn /><br /></cffunction><br /><br /><cfset myVar = arguments.event.getValue("myURLorFormVar") /><br /><cfset arguments.event.setValue("myVariableName", myVariableValue) /><br /><br /><cfset viewstate.setValue("pageTitle", "This is my title") /><br /><cfset myLocalVar = viewState.getValue("varNameFromEvent") /><br /><br /> <cffunction name="writePdfFromTiffs" output="false" returntype="string" hint="This will output a .pdf file containing multiple tiff images"><br /> <cfargument name="pdfOutput" required="true" type="string" hint="Provide a full path to output your PDF too"><br /> <cfargument name="tiffList" required="true" type="string" hint="Provide a comma deliniated list of tiff images to include"><br /><br /> <!---// This code was modified from code provided by bryan@electricedgesystems.com, thanks a ton! //---><br /><br /> <!---// Declare local variables to keep everything clean //---><br /> <cfset var cb = /><br /> <cfset var curFile = /><br /> <cfset var ra = /><br /> <cfset var comps = /><br /> <cfset var i = /><br /> <cfset var img = /><br /> <cfset var writer = /><br /> <cfset var TiffImage = /><br /> <cfset var PdfFile = /><br /> <cfset var Document = /><br /> <cfset var Image = /><br /> <cfset var Paragraph = /><br /> <cfset var PdfContentByte = /><br /> <cfset var PdfWriter = /><br /> <cfset var RandomAccessFileOrArray = /><br /><br /> <!---// Opan file system I/O to write pdf too //---><br /><cfset PdfFile = createObject("java","java.io.FileOutputStream").init(arguments.pdfOutput)><br /> <!---// Init the text.document object //---><br /><cfset Document = createObject("java", "com.lowagie.text.Document").init()><br /> <!---// Create pagesize argument so I can set new page sizes //---><br /> <cfset PageSize = createObject("java", "com.lowagie.text.PageSize") /><br /> <!---// Init the text.image object //---><br /><cfset Image = createObject("java", "com.lowagie.text.Image")><br /> <!---// Create our default paragraph object to contain our images //---><br /><cfset Paragraph = createObject("java", "com.lowagie.text.Paragraph")><br /> <!---// not sure what this does, but it needs to be here //---><br /><cfset PdfContentByte = createObject("java", "com.lowagie.text.pdf.PdfContentByte")><br /> <!---// Create PDFWriter class //---><br /><cfset PdfWriter = createObject("java", "com.lowagie.text.pdf.PdfWriter")><br /> <!---// Create array to contain image //---><br /><cfset RandomAccessFileOrArray = createObject("java", "com.lowagie.text.pdf.RandomAccessFileOrArray")><br /> <!---// Load TIFF image handling //---><br /><cfset TiffImage = createObject("java", "com.lowagie.text.pdf.codec.TiffImage")><br /> <!---// Assign the page size //---><br /> <cfset document.setPageSize(PageSize.Letter) /><br /> <!---// Set page margins to all 10 //---><br /><cfset document.setMargins(10,10,10,10) /><br /> <!---// Create instance of writer //---><br /><cfset Writer = PdfWriter.getInstance(document, PdfFile)><br /><br /> <cftry><br /> <!---// Open document for writing //---><br /> <cfset document.open()><br /> <cfset cb = writer.getDirectContent()><br /><br /> <!---// Loop through list of files provided as an argument and add each to our pdf //---><br /> <cfloop list="#arguments.tiffList#" delimiters="," index="curFile"><br /> <!---// Check this file to make sure it is a Tiff //---><br /> <cfif right(curFile, 3) eq tif or right(curFile, 4) eq tiff><br /><br /> <!---// Catch - try to account for un-accessable files or 32 bpp tiffs<br /> 32 bit tiffs not supported by iText //---><br /> <cftry><br /><br /> <!---// stuff file into memory //---><br /> <cfset ra = RandomAccessFileOrArray.init(curFile)><br /><br /> <!---// read file and determine number of pages in TIFF //---><br /> <cfset comps = TiffImage.getNumberOfPages(ra)><br /><br /> <!---// loop over number of pages and add each one to the PDF //---><br /> <cfloop index="i" from="1" to="#comps#"><br /> <cfset img = TiffImage.getTiffImage(ra,javacast("int",i))><br /> <cfset img.scaleToFit(592, 772)><br /> <cfset img.setAbsolutePosition(10,10)><br /> <cfset cb.addImage(img)><br /><br /> <!---// force new page after each image is added //---><br /> <cfset document.newPage()><br /> </cfloop><br /><br /> <cfcatch type="any"><br /> <!--- Ignore, un-supported file type //---><br /> </cfcatch><br /> </cftry><br /> </cfif><br /> <!---// Close each file after a loop //---><br /> <cfset ra.close()><br /> </cfloop><br /><br /> <!---// close document, this will write the pdf to the filesystem //---><br /> <cfset document.close()><br /><br /> <!---// Return success //---><br /> <cfreturn Success /><br /><br /> <!---// Catch any errors and return failed //---><br /> <cfcatch type="any"><br /> <cfreturn Failed /><br /> </cfcatch><br /> </cftry><br /> </cffunction><br />
<br /> <cffunction name="imgWriteText" output="false" hint="This is a sub method that will write text over an image in memory at a specific location, font, weight, and style." returntype="struct"><br /> <cfargument name="imageVar" required="yes" type="struct" hint="This is the variable name that contains our Image.cfc object with our blank invoice image already loaded."><br /> <cfargument name="text" required="yes" type="string" hint="This is the actual text to be written"><br /> <cfargument name="xpos" required="yes" type="numeric" hint="This is the X position we are going to write our text at"><br /> <cfargument name="ypos" required="yes" type="numeric" hint="This is the Y position we are going to write our text at"><br /> <cfargument name="type" required="no" default="System" type="string" hint="This is the type of font, either system or truetype"><br /> <cfargument name="font" required="no" default="Lucida Console" type="string" hint="If a system font is specified, this is the name of the font. If a truetype font is specified, provide the full path to the font."><br /> <cfargument name="size" required="no" default="40" type="numeric" hint="Font size to be written"><br /> <cfargument name="color" required="no" default="black" type="string" hint="Color of the font to be written - name format"><br /><br /><br /> <!---// Declare all local variables //---><br /> <cfset var myFont = /><br /> <cfset var myColor = /><br /> <cfset var myString = /><br /><br /> <cfsilent><br /> <!--- make sure we have something to write before we attempt to do so ---><br /> <cfif Len(arguments.text)><br /> <!--- create a font object ---><br /> <cfswitch expression="#arguments.type#"><br /> <cfcase value="system"><br /> <cfset myFont = arguments.imageVar.loadSystemFont("#arguments.font#", #arguments.size#, "plain") /><br /> </cfcase><br /> <cfcase value="truetype"><br /> <cfset myFont = arguments.imageVar.loadTTFFile("#arguments.font#", #arguments.size#, "plain") /><br /> </cfcase><br /> </cfswitch><br /><br /> <!--- create the color black ---><br /> <cfset myColor = arguments.imageVar.getColorByName("#arguments.color#") /><br /><br /> <!--- create a string to write into the image ---><br /> <cfset myString = arguments.imageVar.createString("#arguments.text#") /><br /><br /> <!---// set our strings font //---><br /> <cfset arguments.imageVar.setStringFont(myString, myFont) /><br /><br /> <!--- set font color ---><br /> <cfset arguments.imageVar.setStringForeground(myString, myColor) /><br /><br /> <!--- draw the text, at the specified X and Y coordinates ---><br /> <cfset arguments.imageVar.drawString(myString, #arguments.xpos#, #arguments.ypos#) /><br /> </cfif><br /> </cfsilent><br /><br /> <cfreturn arguments.imageVar /><br /><br /> </cffunction><br />