Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
how to create pdf file in vb.net Wink | ;)
Posted 20-Feb-11 19:29pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Please look into following link
 
http://itextsharp.com/[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

What do you exactly want, creating a PDF or convert a document to PDF?
You can use itextsharp[^] to create PDF.
 
Here are some articles(in C# unfortunately) from where you can get idea.
ITextSharp Helper Class[^]
Tutorials on creating PDF files using C# 2.0[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Microsoft .NET doesn't yet include a PDF component, so you'll need to use a third-party component, unless you enjoy doing stuff the hard way, and have plenty of time to spare.
 
Here are a few popular components for the task - ABCpdf.NET, iTextsharp, PDFSharp.
 
Some of these are free for personal use, but for commercial purposes you may need to purchase a license. It's certainly worth checking the small print before you begin Wink | ;-)
 
Here's a quick example in VB.NET to show how easy PDF generation can be...
 
Dim theDoc As Doc = New Doc()
theDoc.FontSize = 96
theDoc.AddText("Hello World")
theDoc.Save("simple.pdf")
theDoc.Clear()
 
The example above uses the ABCpdf component from WebSupergoo.
 
All these components feature their own native drawing commands, which enable you to draw and construct pages and documents. One of the differences between these components is what other methods of layout and formatting they offer, e.g. HTML & CSS, Drawing2D, WPF, Flash, PostScript. If you already know one of these, and your chosen components support it, this can help you get up to speed and generate more complex layouts sooner.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

I am not try this code
You can try and give me reply what happen
 

Private Sub prn_PrintPage(ByVal sender As System.Object, _
                             ByVal e As System.Drawing.Printing.PrintPageEventArgs)
 
       e.Graphics.DrawString("Hello from VB.NET", New Font("Arial", 60, FontStyle.Regular), _
                             Brushes.Blue, 100, 100)
 
   End Sub
 
   Private Sub PrintTest()
       Dim DC As Object = CreateObject("Neevia.docCreator")
 
       DC.setParameter("DocumentOutputFormat", "PDF")
       DC.setParameter("DocumentOutputName", "testVBNET")
       DC.setParameter("DocumentOutputFolder", "d:\")
 
       Dim prn As New System.Drawing.Printing.PrintDocument
       AddHandler prn.PrintPage, AddressOf prn_PrintPage
       prn.PrinterSettings.PrinterName = "Neevia docCreator"
 
       Dim tempFile As String = DC.getParameter("TempDir") + DC.GUID + ".ps"
 
       prn.PrinterSettings.PrintFileName = tempFile
       prn.PrinterSettings.PrintToFile = True
 
       prn.Print()
 
       DC.setInputDocument(tempFile)
 
       Dim RVal As Integer = DC.create()
       DC.fileDelete(tempFile)
 
       prn = Nothing
       DC = Nothing
 
       If (RVal <> 0) Then
           MsgBox("Error while creating document!!!")
       Else
           MsgBox("Done !!!")
       End If
   End Sub
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 9

There is a CodeProject article that explains how to create PDFs and includes a C# library that you can use to create PDFs. You can call the C# library from VB .NET.
 
See PDF File Writer C# Class Library[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

You can also just use the CrystalDecisions.CrystalReports.Engine.ReportClass to export to a pdf file.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

I found this post when I searching for something about PDF.
 
Actually, others have given the solutions. But I want to show my solutions.
 
Code
 
            //Create a pdf document.
            PdfDocument doc = new PdfDocument();
 
            // Create one page
            PdfPageBase page =doc.Pages.Add();
 
            //Draw the text
            page.Canvas.DrawString("Hello, World!",
                                   new PdfFont(PdfFontFamily.Helvetica, 30f),
                                   new PdfSolidBrush(Color.Black),
                                   10, 10);
 
            //Save pdf file.
            doc.SaveToFile("HelloWorld.pdf");
 
How about this? I create it with a third party component
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 696
1 OriginalGriff 478
2 Tadit Dash 400
3 sanket saxena 337
4 Peter Leow 228
0 Sergey Alexandrovich Kryukov 11,890
1 OriginalGriff 7,335
2 Peter Leow 5,003
3 Abhinav S 3,943
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web03 | 2.8.140421.2 | Last Updated 28 Oct 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid