How To Show The Print Dialog And Print Text Files

CK CK 3788 
Created at
Updated at  
1,294 0 0

The RichEdit component in Delphi is a powerful visual control that allows you to create and display formatted text within your applications. It provides features like font styling, colors, indentation, bullet points, and even embedded images, enabling you to build rich text editors, help documents, and other applications that require visually appealing and easily formatted text. 

 

This code show an example of how to print a text of a RichEdit component.
 

unit Unit1; 

interface 

uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
  StdCtrls, ComCtrls; 

type 
  TForm1 = class(TForm) 
    Button1: TButton; 
    PrintDialog1: TPrintDialog; 
    RichEdit1: TRichEdit; 
    procedure Button1Click(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 

var 
  Form1: TForm1; 

implementation 

{$R *.DFM} 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
  If PrintDialog1.Execute then 
    richedit1.print('Ltp1'); {Ltp1 stands for printer} 
end; 

end.


 

Tags Print Print Dialog Print Text Files TPrintDialog Facebook X
Comments 0
Similar posts
  1. Get A Print Dialog Box By Clicking A Button
    817
  2. Printing A Page
    376
  3. How To Print Text In C#
    453
  4. Simplified .NET Printing In C#
    691
  5. A Customizable Printing Text Class
    427
  6. Print HTML In C# With Or Without The Web Browser Control And The Print Dialog
    971
  7. Adding Custom Paper Sizes To Named Printers
    644
  8. How to print external document ?
    413
  9. Changing the Title of a Print Dialog in Delphi
    1,092
  1. Convert TColor to Hex & Hex to TColor
    588
  2. Convert a BMP to a JPG
    407
  3. Reading a directory content
    440
  4. Path shortener: c:\ABC...DEF.ghi
    439
  5. How to Split and Merge Files
    618
  6. Get File 'Last Modified' attribute
    465
  7. From/to the 8.3 (short) format to/from the long format
    576
  8. Delete folders recursively
    420
  9. Delete files with the ability to UNDO
    437
  10. Does my CD-ROM drive contain an audio CD?
    363
  11. Convert a mapped drive to a full UNC path
    831
  12. Checking If File Is In Use
    918
  13. Browse for Computers, Folders, Files and Printers
    570
  14. How to draw Transparent Text on bitmap
    385
  15. How Do I Remove The Application Icon From The Taskbar?
    1,097
  16. How To Make An Animated Application Icon
    817
  17. How To Pass The Focus To The Next/prior Control
    1,202
  18. How To Make Rounded Windows
    1,224
  19. How To Get Windows Uptime
    1,472
  20. How To Find Out Total And Available Memory
    1,632
  21. How To Change The System Time
    1,248
  22. How To Get The Windows OS Version
    615
  23. How To Change The Desktop Wallpaper
    2,136
  24. How To Get The Windows Language
    1,135
  25. How To Make A Gradient Filled Form
    835
  26. How can I hide the caption bar on a form?
    1,398
  27. How To Send An E-mail By Code
    1,112
  28. How To Open Url In Default Webbrowser
    456
  29. How To Check If A Soundcard Is Installed
    1,556
  30. How To Change Screen Resolution
    2,064
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    27
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    24
  3. How do I create animated background for Google Meet?
    19,731
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    217
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    86
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    153
  7. Array of arguments passed to script in PHP
    85
  8. Invalid Auction Storms in Ad Tech
    93
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    198
  10. The Two Clocks of Ad Server Architecture
    63
  11. Frequency Cap Architecture Overview
    509
  12. Collecting Proof-of-Play from 100,000 Screens
    141
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    280
  14. What is RedisVL?
    105
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    224
  16. TPU & GPU Cluster Management Tools
    234
  17. The Concept of Scaffolding in AI Agents
    222
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    576
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    253
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    328
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    197
  22. Machine Learning: Training vs. Ranking
    213
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    217
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    189
  25. Designing a Data Curation System Around a Vector Database
    215
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    229
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    649
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    185
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    207
  30. Understanding Data Lineage
    252