David PHAM-VAN

Fix podspec for Swift

# 1.3.4
* Fix iOS build with Swift
* Add installation instructions in the Readme
# 1.3.3
* Fix dart lint warnings
* Add documentation
... ...
... ... @@ -34,3 +34,29 @@ PdfTtfFont ttf = PdfTtfFont(pdf, font);
g.setColor(PdfColor(0.3, 0.3, 0.3));
g.drawString(ttf, 20.0, "Dart is awesome", 50.0, 30.0);
```
## Installing
1. Add this to your package's `pubspec.yaml` file:
```yaml
dependencies:
printing: any # <-- Add this line
```
2. Enable Swift on the iOS project, in `ios/Podfile`:
```Ruby
target 'Runner' do
use_frameworks! # <-- Add this line
```
3. Set minimum Android version in `android/app/build.gradle`:
```java
defaultConfig {
...
minSdkVersion 19 // <-- Change this line to 19 or more
...
}
```
... ...
# Pdf Printing Example
```dart
void printPdf() {
Printing.layoutPdf(onLayout: (PdfPageFormat format) {
final pdf = Document()
..addPage(Page(
pageFormat: PdfPageFormat.a4,
build: (Context context) {
return Center(
child: Text("Hello World"),
); // Center
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as Pdf;
import 'package:printing/printing.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Printing Demo'),
),
body: Center(
child: FlatButton(
child: Text("Print Document"),
onPressed: () {
Printing.layoutPdf(onLayout: buildPdf);
},
),
),
),
);
}
List<int> buildPdf(PdfPageFormat format) {
final PdfDoc pdf = PdfDoc()
..addPage(Pdf.Page(
pageFormat: format,
build: (Pdf.Context context) {
return Pdf.ConstrainedBox(
constraints: const Pdf.BoxConstraints.expand(),
child: Pdf.FittedBox(
child: Pdf.Text(
"Hello World",
)),
);
}));
return pdf.save();
}); // Page
return pdf.document.save();
}
}
```
... ...
... ... @@ -17,5 +17,5 @@ Plugin that allows Flutter apps to generate and print documents to android or io
s.dependency 'Flutter'
s.ios.deployment_target = '8.0'
s.swift_version = '4.2'
end
... ...
... ... @@ -2,7 +2,7 @@ name: printing
author: David PHAM-VAN <dev.nfet.net@gmail.com>
description: Plugin that allows Flutter apps to generate and print documents to android or ios compatible printers
homepage: https://github.com/DavBfr/dart_pdf/tree/master/printing
version: 1.3.3
version: 1.3.4
environment:
sdk: ">=1.19.0 <3.0.0"
... ...