Home  docPrint  docPrint-Pro  Support  ScreenShots

Draw GDI Commands to docPrint Printer

Word OLE VB sample is a simple Windows application that converts a MS Word document to PDF using Word OLE automation.

Download Evaluation Version of docPrint SDK
Purchase docPrint SDK

Private Sub GDIDrawing_Click()
Dim iret As Long, n As Long
Dim s1 As String, xpos As Long, ypos As Long
Dim docinf As DOCINFO
' set up an initial font
Dim log_font As LOGFONT, new_font As Long, old_font As Long

SetOutputFileName_docPrintPDFDriver "C:\output.eps"
SetDefaultPrinter "docPrint PDF Driver"

If Not GetMyPrinter Then Exit Sub
With log_font
.lfEscapement = 0 ' desired rotation in tenths of a degree
.lfHeight = 12 * (-MyPrinter.dpiY / 72) ' 12 points
.lfFaceName = "Times New Roman" & vbNullChar
.lfWeight = 400 ' standard (bold = 700)
.lfItalic = False
.lfUnderline = False
End With
new_font = CreateFontIndirect(log_font)
old_font = SelectObject(MyPrinter.Handle, new_font)
' start a document
docinf.cbSize = Len(docinf) ' Size of DOCINFO structure
iret = StartDoc(MyPrinter.Handle, docinf) 'Start new document
iret = StartPage(MyPrinter.Handle) 'Start a new page
'
' print a simple line of text at position (1, 1) (inches)
For n = 1 To 10
	PrinterText "This is Line " & Format(n), 1, 1 * 0.16 * n
Next n
' end page
iret = EndPage(MyPrinter.Handle) 'End the page
' end the document
SelectObject MyPrinter.Handle, old_font
DeleteObject new_font ' clear up the font
iret = EndDoc(MyPrinter.Handle) 'End the print job
iret = DeleteDC(MyPrinter.Handle)

End Sub

Copyright © 2000-2006 by VeryPDF, Inc.
Send comments about this site to the webmaster.