PrintPRO 8 for ActiveX - User Guide > How To > Print > Print to a File |
This sample shows that with PrintPRO™ printing to a file is very much the same as generating printer output but with a few properties set to the appropriate values. Any printer output, regardless of how it is generated, can be easily directed to a file.
Example |
Copy Code
|
---|---|
' NOTE: all of the dimensions in this demo are in twips. ' Give the document a name.The default document ' name is PrintPRO Document. PrintPRO1.DocName = "Accusoft's PrintPRO Demo" PrintPRO1.OutputFileName = App.Path + "\AccusoftTst.tif" ' Direct output to a file instead of a printer. PrintPRO1.PrintToFile = True ' Specify which kind of file, could be: ' PP_TIF_G4 (B&W COMPRESSED - STANDARD) ' PP_TIF (COLOR) ' PP_TIF_G3 (B&W COMPRESSED) ' PP_TIF_G3_2D (B&W COMPRESSED) ' PP_TIF_BMP (COLOR) ' PP_EMF (ENHANCED META-FILE) ' PP_PDF_G4 (B&W COMPRESSED IMAGE FILE) PrintPRO1.SaveFileType = PP_TIF ' Specify the density for the file. PrintPRO1.RequestedDPI = 100 ' Start a print job by starting a new page. PrintPRO1.StartPrintDoc PrintPRO1.PrintPreviewOnly = False ' Print the information on the page just as you would for ' creating printer output... PrintPRO1.BackStyle = 1 'Opaque PrintPRO1.ForeColor = RGB(255, 255, 255) 'White text PrintPRO1.BackColor = RGB(0, 0, 0) 'Black background PrintPRO1.Font.Name = "arial" PrintPRO1.Font.Bold = True PrintPRO1.Font.Size = 24 PrintPRO1.Alignment = ALIGN_CenterJustifyMiddle ' Center justify the text prWidth = PrintPRO1.PWidth PrintPRO1.PrintTextAligned " Hello! Check out PrintPRO ", 1000, PrintPRO1.TMargin, prWidth - 1000, 1100 ' Add a previously loaded graphic to the output. PrintPRO1.PrintPicture 1640, 5700, 0, 0, 0, 0, 0, 0, True ' End the print job. This will end the current page and create the file. PrintPRO1.EndPrintDoc |