Data Report using Data Environment (Print and Export)-Visual
Basic6
Visual Basic 6.0 Tutorial -Create Data Report using Data Environment (Print and
Export data report)-Step by Step-From Scratch
In this Video tutorial,Following Features are discussed
1.First,Create Database ,Store Data in it using MS Access.Also,Display the data in Datagrid Using
ADODC and Data Grid Control In Visual Basic 6.0 .
2.Before Creating data report in Vb6,First Create Data Environment Which is used to connect your
database with Data Report and tells the data report what is stored in the database..
3.Once,Data Environment has been created ,Now Create Data Report with Data Environment just by
dragging different fields from Data Environment to Data Report..
4.How to display all records in one Page or One Record in One Page.
5.How to print the data report.
6.How to export contents of data report to text files or other format files.
7.Use various Controls and functions in the different Sections of Data Report in order to make data report
more readable and understandable.With functions,You can do the calculations about the records and
values.
8.How to make this data report attractive and more effective,with Logos,Text and tabular representation of
data using controls.
Printer.Print
VB.Printer.Scale (0, 0)-(200, 500)
Printer.ScaleMode = vbInches
Printer.CurrentX=50: Printer.CurrentY = 100
'for the position of the picture on paper
Printer.PaintPicture Picture1.Picture, 2, 9
Printer.EndDoc
Automatic Conversion from PDF to JPG
Universal Document Converter allows saving any type of a document as a PDF, JPEG, TIFF, or PNG
image file. Software developers can benefit from the Universal Document Converter resources using
the COM-interface with Adobe Acrobat as COM-server for converting PDF to JPG.
PDF conversion source code examples:
Private Sub PrintAdobePDFToJPEG(ByVal strFilePath As String)
Dim objAdobeApp As Object
Dim itfAVDocument As Object
Dim itfPDDocument As Object
Dim nPages As Long
Dim objUDC As UDC.IUDC
Dim itfPrinter As UDC.IUDCPrinter
Dim itfProfile As UDC.IProfile
Dim AppDataPath As String
Dim ProfilePath As String
' Use Universal Document Converter API to change settings of converterd document
objUDC = New UDC.APIWrapper
itfPrinter = objUDC.Printers("Universal Document Converter")
itfProfile = itfPrinter.Profile
' Adobe Acrobat API allow to print only on the default printer
objUDC.DefaultPrinter = "Universal Document Converter"
' Load profile located in folder "%APPDATA%\UDC Profiles".
' Value of %APPDATA% variable should be received using Environment.GetFolderPath
' method. Or you can move default profiles into a folder you prefer.
AppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
ProfilePath = Path.Combine(AppDataPath, "UDC Profiles\PDF to JPEG.xml")
itfProfile.Load(ProfilePath)
itfProfile.OutputLocation.Mode = UDC.LocationModeID.LM_PREDEFINED
itfProfile.OutputLocation.FolderPath = "C:\Out"
itfProfile.PostProcessing.Mode = UDC.PostProcessingModeID.PP_OPEN_FOLDER
' Run Adobe Acrobat as COM-server
On Error Resume Next
objAdobeApp = CreateObject("AcroExch.App")
itfAVDocument = CreateObject("AcroExch.AVDoc")
' Open PDF document from file
If itfAVDocument.Open(strFilePath, "") = True Then
itfPDDocument = itfAVDocument.GetPDDoc()
nPages = itfPDDocument.GetNumPages()
' Print all pages of the document
Call itfAVDocument.PrintPagesSilent(0, nPages - 1, 0, True, True)
' Close the document
Call itfAVDocument.Close(True)
itfAVDocument = Nothing
itfPDDocument = Nothing
End If
' Close Adobe Acrobat Writer
Call objAdobeApp.Exit()
objAdobeApp = Nothing
End Sub
Hi,
for all they search for a sample to print any PDF Files on the fly, ....
Sample written for Visual Basic 6:
______________________________________________________
Private Sub Print_on_the_fly_Click()
' Sub to prints PDF Files on the fly without saving
Dim QP As iSed.QuickPDF
Set QP = CreateObject("iSED.QuickPDF")
' GDIPlus.dll needed that the images are printable 'on the fly
Call QP.SetGDIPlusFileName(App.Path & "\GDIPLUS.DLL")
Call QP.UnlockKey("secret")
Call QP.LoadFromFile(App.Path & "\Formular.pdf")
If QP.Encrypted = 1 Then
QP.SetPassword ("secret")
QP.Unencrypt
End If
Call QP.SetNeedAppearances(1)
Call QP.SetFormFieldValueByTitle("Datum", date)
Call QP.SetFormFieldValueByTitle("Firma", Firma.value)
Call QP.SetFormFieldValueByTitle("Name", Name.value)
Call QP.SetFormFieldValueByTitle("Strasse", Strasse.value)
Call QP.SetFormFieldValueByTitle("Ort",PLZ.value & " " & Ort.value)
Call QP.SetFormFieldValueByTitle("Tel", Telfon.value)
' UpdateApperanceStream needed for printable 'on the fly
For pdfFields = 1 To QP.FormFieldCount
Call QP.UpdateAppearanceStream(pdfFields)
Next pdfFields
Call QP.PrintDocument(QP.GetDefaultPrinterName, 1, 1, QP.PrintOptions(0, 0, "Formular"))
Set QP = Nothing
End Sub
All you you need for a "printPreview"
....
Call QP.NeedImagePreview(1)
Call QP.RenderDocumentToFile(72, 1, 1, 1, App.Path & "\Vorschau.jpg")
....
regards
Devil