Home / Computers And Technology / Software / Sharp Pdf Usage In Vb6
Hello Guest! login | Register

Sharp Pdf Usage In Vb6 , Software

Resource for Sharp Pdf Usage In Vb6 , Software with Articles arranged by categories . Continue for our current list of the Sharp Pdf Usage In Vb6 , Software


Sharp PDF Usage In VB6

Most people are looking on how to create PDF documents through their VB applications, but don't want to spend money to buy Adobe Acrobat SDK or other third party components. If you don't want to invest money, there is an open source solution for you, SharpPDF. SharpPDF is a very cool C# library based on .NET Framework 1.1 and created 100% compatible PDF document. More information about SharpPDF library can be found on sharppdf.sourceforge.net.

Visual Basic developers can't use this library straight. If you register the SharpPDF and try to create the pdfDocument method you'll get an error. So how can you take advantage of sharpPDF? A choice I can think of is to change the code of sharpPDF based on your needs. If you don't want to mess up with the code of sharpPDF you can simply create a wrapper library with VB.NET, register the assembly and reference the wrapper through you VB6 project.

To register the assembly use the following command: regasm /tlb: mywrapper.tlb /codebase mywrapper.dll

and from your VB6 project add a refence to mywrapper.tlb

Sample Code of wrapper created with VB.NET:

Imports sharpPDF

Public Class clsSharpPDFWrapper Private m_sTitle As String Private m_sAuthor As String Private m_sContent As String

Public WriteOnly Property Title() As String Set(ByVal Value As String) m_sTitle = Value End Set End Property

Public WriteOnly Property Author() As String Set(ByVal Value As String) m_sAuthor = Value End Set End Property

Public WriteOnly Property

Content() As String Set(ByVal Value As String) m_sContent = Value End Set End Property

Public Function CreatePDFDocument() Dim oPDF As New sharpPDF.pdfDocument(m_sTitle, m_sAuthor) Dim oPDFPage As sharpPDF.pdfPage = oPDF.addPage(sharpPDF.Enumerators.predefinedPageSize.csA4Page)

oPDFPage.addText(m_sContent, 200, 450, oPDF.getFontReference(Enumerators.predefinedFont.csHelvetica), 20, pdfColor.Black)

oPDF.createPDF("c:MyPDFDoc.pdf") oPDFPage = Nothing oPDF = Nothing End Function End Class

Sample Code for calling the wrapper through your VB6 project:

Dim o As New clsSharpPDFWrapper o.Title = "My First PDF Document" o.Author = "Thomas Kaloyani" o.Content = "Hello World!" o.createPDFDocument

Happy coding!


Thomas is an experienced Visual Basic developer, with expertise of 7+ years developing especially financial applications. His main IT skills are VB, SQL, Crystal Reports - should you need a Visual Basic developer for your projects feel free to contact Thomas through his personal website Kaloyani.com or through VBprofs.com - the newest Visual Basic and VB.NET resources portal.


Submit YOUR Articles Here!!

If you are not sure what to do Please Contact Us
Submit max. to be added featured contributors.
To contribute to Articles4Ever.com, Please login

Not Registered yet? Click to Register it's FREE

Tell Your Friend


Search Site

 
Web Articles4Ever.com


More from Web