David PHAM-VAN

Fix MultiPage with multiple save() calls

# Changelog
## 1.3.17
* Fix MultiPage with multiple save() calls
## 1.3.16
* Add better debugPaint on Align Widget
... ...
... ... @@ -39,7 +39,7 @@ class PdfObjectStream extends PdfObject {
void _prepare() {
super._prepare();
if (params.containsKey('/Filter')) {
if (params.containsKey('/Filter') && _data == null) {
// The data is already in the right format
_data = buf.output();
} else if (pdfDocument.deflate != null) {
... ...
... ... @@ -4,7 +4,7 @@ description: A pdf producer for Dart. It can create pdf files for both web or fl
homepage: https://github.com/DavBfr/dart_pdf/tree/master/pdf
repository: https://github.com/DavBfr/dart_pdf
issue_tracker: https://github.com/DavBfr/dart_pdf/issues
version: 1.3.16
version: 1.3.17
environment:
sdk: ">=2.1.0 <3.0.0"
... ...
... ... @@ -28,6 +28,7 @@ import 'type1_test.dart' as type1;
import 'widget_basic_test.dart' as widget_basic;
import 'widget_clip_test.dart' as widget_clip;
import 'widget_container_test.dart' as widget_container;
import 'widget_multipage_test.dart' as widget_multipage;
import 'widget_table_test.dart' as widget_table;
import 'widget_test.dart' as widget;
import 'widget_text_test.dart' as widget_text;
... ... @@ -47,6 +48,7 @@ void main() {
widget_basic.main();
widget_clip.main();
widget_container.main();
widget_multipage.main();
widget_table.main();
widget_text.main();
widget_theme.main();
... ...
/*
* Copyright (C) 2017, David PHAM-VAN <dev.nfet.net@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'dart:io';
import 'package:pdf/widgets.dart';
import 'package:test/test.dart';
List<Widget> lines = <Widget>[];
void main() {
setUpAll(() {
for (int i = 0; i < 200; i++) {
lines.add(Text('Line $i'));
}
});
test('Pdf Widgets MultiPage', () {
Document.debug = true;
final Document pdf = Document();
pdf.addPage(MultiPage(build: (Context context) => lines));
final File file = File('widgets-multipage.pdf');
file.writeAsBytesSync(pdf.save());
final File file1 = File('widgets-multipage-1.pdf');
file1.writeAsBytesSync(pdf.save());
});
test('Pdf Widgets MonoPage', () {
Document.debug = true;
final Document pdf = Document();
pdf.addPage(Page(build: (Context context) => Column(children: lines)));
final File file = File('widgets-monopage.pdf');
file.writeAsBytesSync(pdf.save());
final File file1 = File('widgets-monopage-1.pdf');
file1.writeAsBytesSync(pdf.save());
});
}
... ...