Solved

How to send data to PDF file from VB.NET

Posted on 2010-09-21
3
891 Views
Last Modified: 2013-12-16
experts,

As a novice to VB.NET, I would like to find out how to print some text strings in my code to produce a PDF file directly. I prefer to use some free PDF add-ins without the need to install a PDF printer. The target PC will have basic PDF reader installed. My source data will only be text-based. However, the size and font of the text needs to be changeable. Samples appreciated!

sew
0
Comment
Question by:sungenwang
3 Comments
 
LVL 18

Assisted Solution

by:John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou earned 200 total points
ID: 33728555
0
 

Accepted Solution

by:
veve33 earned 300 total points
ID: 33728558
hello,

you can use ItextSharp : http://sourceforge.net/projects/itextsharp/

Hervé
0
 
LVL 5

Expert Comment

by:NKOWA
ID: 33730327
iTextSharp can create text, paragraphs, tables, and images inside PDFs.
iTextSharp is free, open-source, and works with VB.net.

Samples are on sourceforge iTextSharp project website.
http://sourceforge.net/projects/itextsharp/files/

See chapter 1: Example #1
Public Class Chap0101

            Public Sub New()
                  Console.WriteLine("Chapter 1 example 1: Hello World")
                  Dim doc As Document = New Document
                  Try
                        PdfWriter.GetInstance(doc, New FileStream("Chap0101.pdf", FileMode.Create))
                        doc.Open
                        doc.Add(New Paragraph("Hello World"))
                  Catch de As DocumentException
                        Console.Error.WriteLine(de.Message)
                  Catch ioe As IOException
                        Console.Error.WriteLine(ioe.Message)
                  End Try
                  doc.Close
            End Sub
      End Class
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question