rtf 0.0.3
rtf: ^0.0.3 copied to clipboard
A library to build an RTF document. RTF (Rich Text Format) is a document format that most word processors are able to read and write.
A minimal Rtf creation library for dart/flutter
Features #
The library can create RTF file
Installing #
In order to use this rtf library, follow the steps above:
- Add this package to your package's pubspec.yaml file as described on the installation tab
- Import the library
import 'package:rtf/rtf.dart' as rtf;
Examples #
Create a document (use Times New Roman as font)
var el = [
rtf.Text('Test text', style: rtf.TextStyle(style: 'heading 1', align: rtf.Align.right)),
rtf.NewLine(),
rtf.Text('Second test text', style: rtf.TextStyle(style: 'Normal')),
rtf.NewLine(),
rtf.SkipPage(),
rtf.Text('Third test text'),
];
rtf.Document doc = rtf.Document(el, hdLeft: rtf.PageNo());
doc.addFont('Normal', 'roman', 'Times New Roman', rtf.FontStyle.regular, 9);
doc.addFont('heading 1', 'roman', 'Times New Roman', rtf.FontStyle.bold, 14);
doc.addFont('heading 2', 'roman', 'Times New Roman', rtf.FontStyle.bold, 12);
await doc.save(File('result.rtf'));
See also example directory