Magento PDF Invoice Customization

,

Over the past month or so, I’ve been building a Magento eCommerce module allowing PDF invoices to be customized in four areas:

  • Page Size: By default, Magento PDF invoices are rendered as A4 pages. Most of us in the US would probably prefer that these PDFs be outputted using the letter page size (8.5″ * 11″) to match the paper we use. This module allows easy configuration of the invoice’s page size.
  • Logo Size: By default, Magento requires that your logo be 200 pixels by 50 pixels. With this module, your logo can be any size that will fit on the page. Continue reading

Zend Pdf Coordinates

, ,

Thought I would share a few things I recently learned about coordinates when using Zend Framework‘s Zend Pdf library.

  • The typographical point is the unit of measurement used for all coordinates. 72 points equals 1 inch. An 8.5″ * 11″ page is 612 * 792 points.
  • The x/y coordinate origin is the bottom left corner of the page. If you are laying out a page from top to bottom, the y-coordinate will get smaller as you work your way down the page.
  • Lines are centered on their coordinates. Continue reading

SET_ANSI_NULLS Does Not Affect Column-to-Column Comparisons

I learned this fact the hard way the other day! A MERGE statement would not update null values in the destination table with the appropriate non-null data from the source table. My AND clause looked something like “Source.Name != Destination.Name”. I thought that setting ANSI_NULLS to OFF would cause this clause to catch differences when one of the values was null.

Nope! Continue reading

Merry Christmas!

“For unto us a child is born, unto us a son is given: and the government shall be upon his shoulder: and his name shall be called Wonderful, Counsellor, The mighty God,  The everlasting Father, The Prince of Peace.”—Isaiah 9:6

Do you know the Son?

Part of Chickasha's Festival of Light

Part of Chickasha, Oklahoma’s Festival of Lights

97 Things Every Programmer Should Know (Book Review)

97 nuggets of wisdom presented in the form of two-page essays. Topics range from architecture to refactoring, from testing to client interactions. 73 contributing authors—diverse in their experiences, sometimes with differing perspectives, but all united in the goal of helping you become a better programmer.

Some of these quick-to-read compositions will (likely) introduce you to new ideas that help you hone the programmer’s craft. Other articles will touch on practices you already follow, reminding you of why you adhere to those tenets and, perhaps, helping you refine your application of them. Continue reading

Master-Detail Forms & Object Scope (Context)

, , ,

Imagine a master-detail form. The top portion of the window contains a grid listing people’s names. Below is a form where the currently-selected person’s details may be edited. Should data-binding be used to connect the edit form’s fields directly to the grid’s currently selected record (row)? To put it another way, should the grid’s selected item and the edit form both be referencing the same in-memory object instance? Continue reading