Jay R Blog

SQL to PDF mailing labels

If anyone is ever looking for the ability to write dynamic PDF files from .NET, may I recommend using iTextSharp.

http://sourceforge.net/projects/itextsharp/ 

I just got done with some programming that accepts input from a web page, grabs the correspondnig data from SQL, then writes this data to a PDF file which is formatted for printing mailing labels (standard Avery 5160's). There's not a built in page format to feed in order to get it label printable. In order to position the text to come out in the right spot, it takes several trial and error runs, positioning the text with X Y coordinates that read from the left and the bottom.

Best of all, iTextSharp is free! It might take a little extra work (especially in my case since I had to translate what documentation there was from C# to VB.NET), but I think it sure beats paying for a more expensive solution like ActivePDF.

I'll post a snippet of the code when I'm not running out the door @ 5PM on Monday :)

 

Legacy Comments


Shannon J Hager
2003-11-15
re: SQL to PDF mailing labels
I have spent a lot of time working with the iText component, it is great for many things, has a few faults, but is an incredible piece of work. I have had a few issues with it but have managed to work around most of them. The only 'real' problem I've had is that sometimes the text doesn't "cascade" and piles up in one spot, but that is recognizable immediately and running the batch again always "cures" the problem since it very rarely happens and has never happened twice in a row.

Tim Grot
2004-02-21
re: SQL to PDF mailing labels
So you had to use the information from Chapter 10 of the tutorial: Absolute position of graphics and text?

Jay
2004-02-23
re: SQL to PDF mailing labels
Yes, that is correct. I am using absolute positioning in order to make the addresses line up to fit the aforementioned label sheets.

Worldlabel.com
2004-03-03
re: SQL to PDF mailing labels
Can u use PDF templates from Worldlabel.com

David Capelo
2004-03-08
re: SQL to PDF mailing labels
Does anybody has a snippet to create the label template for the pdf file?

Greg Holmes
2004-04-14
re: SQL to PDF mailing labels
Jay, could you please post the snippet if you get a chance? This sounds great!

Paul
2004-07-11
re: SQL to PDF mailing labels
Please do post the snipit :)

Yogen
2004-08-09
re: SQL to PDF mailing labels
Please post the snippet...that would be so good..

Jana Reddy
2005-06-08
re: SQL to PDF mailing labels
Please do post the snippet...

NAME
2005-09-16
TITLE
Comments Please

Ram
2005-11-23
re: SQL to PDF mailing labels
Hi jay,

I am looking at getting data from Oracle or SQL Tables via SQL Statements and creating simple reports, which are to be converted to PDF Format, can you let me know if this solution of yours useful in the above scenario if not what other solution is possible.

You suggestion in this regard would be very helpful.


Regards
Ram

ali
2005-12-14
re: SQL to PDF mailing labels
salam

jt
2006-01-05
re: SQL to PDF mailing labels
hhh

Steven Lee
2006-02-14
re: SQL to PDF mailing labels
I have finished iTextSharp tutorial both in C# version and VB.NET version, and on my blog, there are also many articles talking about iTextSharp
http://hardrock.cnblogs.com

on http://aspspider.net/tonyfox/pdf,there are some asp.net 2.0 examples about iTextSharp.

saravanan
2006-03-25
re: SQL to PDF mailing labels
note for the