|
|
|
|
|
1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
I created this example after reading a job posting looking for the ability to first load an image, and then, by selecting a portion of the image (using a selection rectangle), to save it into a "OCR-like" TIF file.
Click to try the example.
Sceenshot of the app:
If you're a regular reader of my blog, you'll recognize my technique that combines an AS3 PNG encoder, an open-source utility (KVEC), the Apache Batik project, and of course, ColdFusion 9, enabling you to convert an image to the TIF/PNG/SVG/PDF formats.
This example allows you to upload any JPG, PNG, or GIF (up to 500 KB each upload), and convert it entirely (or select any portion of it with a ActionScript 3 selection rectangle) to all four file-types - a SVG, a PNG, a TIF, and a PDF. It works like this:
-
The uploaded image (or only a selected portion) is passed as binary data to a ColdFusion CFC function that saves a PNG to the ColdFusion server's file system.
-
Next, leveraging an open source tool, KVEC, the PNG, created in step one, is passed to another CFC function that converts the PNG to a SVG file.
-
Next, the SVG is passed to a CFC function that completes the final conversions -
1) to a PDF file and 2) to a TIF file, using the Apache Batik project's batik-rasterizer.jar.
-
Next, leveraging the ColdFusion 9 (available in CF 8 too) <cfzip> tag, a CFC function creates a zip archive containing the PNG, the SVG, the TIF, and the PDF files of the uploaded image.
-
Finally, to save on disk space, a final CFC function is called to delete the TIF, SVG, and PDF files (once the zip archive is safely created). The PNG is retained and used for display purposes.
Click to try the example.
Tip Jar:
|
|
I use bitly.com for shortening some of my URLs. There are API Libraries and Documentation for bitly, so it is possible to write your own bitly-related applications. In this post, I'll show you two examples of such applications - one built in Flex and AS3 and another in ColdFusion's CFML. |
Read More |
|
|
Create your own electronic signature (Flex-based or HTML5-based) In an updated example of a technique that combines an AS3 PNG encoder, an open-source utility (KVEC), the Apache Batik project, and of course, ColdFusion 9, you can create your very own electronic signature. You can also try the new HTML5 version.
Flex-based version :
The electronic signature you create, by dragging your mouse across the signature canvas to, in effect, sign your 'John Hancock', works like this:
-
The signature drawing is passed as binary data to a ColdFusion CFC function that saves the PNG to the ColdFusion server's file system.
-
Next, leveraging an open source tool, KVEC, the PNG, created in
step one, is passed to another CFC function that converts the PNG to a SVG file.
-
Next, the SVG is passed to a CFC function that completes the final conversion
to a PDF file, using the Apache Batik project's batik-rasterizer.jar.
-
Next, leveraging the ColdFusion 9 (available in CF 8 too) <cfzip> tag, a CFC function creates a zip archive of the PNG, the SVG, and the PDF files of the signature just created.
-
Finally, to save on disk space, a final CFC function is called to delete the PNG and SVG files (once the PDF and zip archive are safely created).
Click to create your own electronic signature with the Flex-based version.
HTML5-based version :
The electronic signature you create, by dragging your mouse across the HTML5 canvas to, in effect, sign your 'John Hancock', works like this:
-
The signature drawing is converted to a JSON array of points, via a modified Thomas J. Bradley's Signature Pad, collected, via James Moberg's sigJsonToImage ColdFusion UDF, and passed to a function in the UDF that saves the PNG (a raster-based graphic) to the ColdFusion server's file system.
-
Next, leveraging an open source tool, KVEC, the PNG, created in
step one, is passed to CFML that converts the PNG to a SVG file.
-
Next, the SVG is passed to CFML that completes the final conversion
to a PDF file, using the Apache Batik project's batik-rasterizer.jar.
-
Next, leveraging the ColdFusion 9 (available in CF 8 too) <cfzip> tag, and more CFML that creates a zip archive of the PNG, the SVG, and the PDF files of the signature just created.
-
Finally, to save on disk space, final CFML is used to delete the PNG and SVG files (once the PDF and zip archive are safely created).
Click to create your own electronic signature with the HTML5 version.
Tip Jar:
|
Related Entries:
|
|
I have not just two, or even three, but four ColdFusion instances all running in harmony with my Apache HTTP Server.
Leveraging the invaluable article by Brandon Purcell Installing and Configuring ColdFusion MX 6.1 Multiple Instances with IIS and Apache Virtual Hosts (and this works great with CFMX 7 too). I am happily providing web application isolation for all four web sites.
My multi-instance example: See it
Adding additional instances with CFMX 7 is even easier now:
CFMX 7 - Defining additional server instances
Here's a sample of my Apache httpd.conf (for brevity, this highlights only the critical elements):
httpd.conf
Oh by the way, after you create new instances, running as services (for Windows Servers), you'll see that these instances may be named a bit odd. This is easily corrected with regedit as shown in the screenshot below:
|
|
I ran across a need to periodically archive my CFMX 7's logs. I initially thought about using the cffile tag and doing some combination of copy & rename actions. I quickly realized that trying to do operations on an active log file would not work. Then I remembered that wonderful coldfusion.server.ServiceFactory and the rollLog method of the LoggingService. This nifty function archives or "rolls" the log of the logfile name passed into it: rollLog("full_path_name_to logfile name plus the logfile_name"). Creating a scheduled task that periodically calls this type of function is an easy way to keep the active logs from growing too large and still maintain the former log's contents.
Here's a code example. |
|
Finally! I figured out how to toggle the required red asterisk (*) on and off on my CFForm (type=flash). Utilizing the same approach you can use with Flex 1.5, I was able to do what some have said is impossible. ;-)
To see a demo of my implementation:
Live Demo
Show me the code
* Now toggling that red asterisk on and off. |
|
Wow! I figured out how to toggle the required red asterisk (*) on and off on my CFForm (type=flash).
To see a demo of my implementation:
Live Demo
Show me the code
* Now toggling that red asterisk on and off. |
|
This past week, I had the pleasure of working with CFMX 7's CFForm tag (format=Flash) a bit more extensively than I had done before. Combining my experience with Flex as well as some helpful articles found on the ASFusion site and Jeff Tapper's site, I found that I was able to build a fairly intuitive tabbed form that successfully captured some validation business requirement rules.
To see a demo of my implementation:
Captivate Demo
Live Demo
Show me the code
* Now toggling that red asterisk on and off. |
|
Just a quick example I gleaned off the Sys-Con site that uses the Apache FOP Project. It reads some data from a database and then creates Output formats currently supported include PDF, PCL, PS, SVG, XML (area tree representation), Print, AWT, MIF and TXT. The primary output target is PDF.
In the zip you'll find:
1) three jars (in my case I'm running CFMX 7 as JRun multiple instances, so I dropped the files here on my server: C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\lib
2) files for the example app
3) mySQL database (for this example)
4) Don't forget to restart CFMX after you copy the jar files to the lib folder.
Demo |
|
A business requirement I ran across this week was to take the results from a query, generate an Excel file, and send the generated xls via cfmail. During the week I discovered that there was something called OpenXCF that would make my dreams come true. Personally, I found it was not the easiest to work with and that, for me, the benefits were not that useful - as noted in numerous comments scattered about a Google search, it was next to impossible to figure out how to install it, and once I did, I was able to read an XLS and generate a query, but never did get it to write an XLS file. In case you ever do want to go down that road, here's what I did to get it [javacfx] working (reading in an XLS) - Steps 1 - 6. For a shortened, simpler approach utilizing only the Apache POI Project, follow Steps 4 - 11: |
Read More |
|
|
|
|
|
|