xyzio

Archive for the ‘Bingowords’ Category

Free Online Wordsearch Puzzle Generator

leave a comment »

A Wordsearch puzzle is a puzzle that contains words hidden in a grid of text. It is a fun activity used to teach children spelling and to help memorize information like country capitals.

Interested in creating your own Wordsearch puzzle? Then try out the Free Online Wordsearch Puzzle Generator at http://xyzio.com/Projects/WordSearch/Default.aspx.

This Word Search generator was written in C#/ASP.NET and generates PDFs using the iTextSharp library.

Sample Page:

Free Online Wordsearch Example

Wordsearch Example

Written by M Kapoor

June 29, 2013 at 12:23 am

Generating PDFs using iTextSharp on Mono

leave a comment »

I was looking for a .NET pdf generator so that I could add online bingocard generation to my side project, BingoWords.  The code and website are built using .NET and I run the site under Mono on a VPS at Linode.  So, it was important that the PDF generator run under Mono without issues.  Being cheap and full featured were two other desired features.  After some research, I found that there were two major players that satisfied this criteria,  PDFSharp and  iTextSharp.  Both are open source, free, and are fully featured.

Although some posts on the web indicated that PDFSharp would run under Mono, it was a no-go from  the beginning.  It failed the mono compatibility tool – Mono Migration Analyzer or M0MA almost right away.  I still decided to try out PDFSharp with Mono after reading a few posts stating that it may work if my code avoided the non-Mono compatible portions of the code but that was a total failure.  

So, I had no choice but to use iTextSharp.  iTextSharp passed under MoMA and it worked great on my Linode VPS under Mono.  With iTextSharp, I can generate PDFs that comply with the PDF standard and are viewable on every major platform.  So, if you are planning to generate PDFs under Mono, I would highly recommend iTextSharp.  Or to get a better sense of the features, try out my free Online Bingo Card Generator!

 I noticed that weren’t many code samples available while doing my research and coding the Bingo Card Generator.  So, here are some samples from my code for those that are just getting started:

Creating a new PDF document:

MemoryStream ms = new MemoryStream();
Document document = new Document(PageSize.LETTER);
PdfWriter writer = PdfWriter.GetInstance(document, ms);
document.Open();

Creating a BaseFont.  A BaseFont contains the parameters of the font that is written to the PDF document:

BaseFont bf = BaseFont.CreateFont(BaseFont.COURIER, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

Writing center-aligned text to 400pts from the left and 400pts from the top:

cb.BeginText();
cb.ShowTextAligned(PdfContentByte.ALIGN_CENTER, “Title Text”, (int)(Math.Abs(400, 400, 0);
cb.EndText();

Getting the width of a string in points:

titleWidth = (int)cb.GetEffectiveStringWidth(“Hello World!”, false);
Setting the font size of a BaseFont:
cb.SetFontAndSize(bf, titleFontSize);

Draw a line from the top left to the bottom left of the document:

cb.MoveTo(document.Left, document.Top);
cb.LineTo(document.Left, document.Bottom);
cb.Stroke();

Editing the document’s properties:

document.AddTitle(“Designed by BingoWords.com”);
document.AddAuthor(“Author goes here!”);
document.AddSubject(“Subject Goes Here!”);
document.AddKeywords(“Keyword1, keyword2, …”);

Closing your document:

document.Close();

Put this after the “document.Close()” to return your document with the name “file.pdf” when a user clicks on a link:

Response.ContentType = “application/pdf”;
Response.AddHeader(“content-disposition”, “attachment;filename=file.pdf”);
Response.Buffer = true;
Response.Clear();
Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length);
Response.OutputStream.Flush();
Response.End();

I hope this comes in handy.  Feel free to contact me if you have any questions or comments.

Written by M Kapoor

June 20, 2010 at 5:52 am

Free Bingo Card and Wordsearch Designer

leave a comment »

If you are looking for a free Bingo Card or Wordsearch Designer then look no more – BingoWords Puzzle Designer is now free for everybody!  Click here to go to the website!

Features:

  • Create arbitrary sized Wordsearch puzzles
  • Create Bingo Cards up to 5×5 squares in size
  • Save your wordlists for future use and to share with co-workers
  • Print an unlimited number of Bingo Cards and Word Search Puzzles
  • Print up to 8 Bingo Cards per page
  • Quick access to common word lists using the built in Word Wizard

For more details, read on.

Why is it Free?

Originally, I was planning to sell Bingo Words Puzzle Designer but then I realized that I’d rather spend my free time working on new code instead of on marketing and all the hassle that comes with running a business.  Besides, putting together something like this only took me a couple weeks of part-time work and it annoys me that some people are charging over $30/copy for something that is this simple to make.

My hope is that it will be useful to someone and that they will pay it forward some day.

About

BingoWords Puzzle Designer is a project I worked on in order to teach myself C#/ASP.NET.  The application is made with C# and Winforms.  The website is build using ASP.NET and is hosted using Mono on a  virtual server at Linode.  I was able to learn every aspect of creating an app with this project – from drawing on the screen to printing and to saving files to generating serial numbers.

Feel free to contact me with questions or suggestions for improvement!

Written by M Kapoor

February 19, 2010 at 4:06 am