Comments (4)
Can you attach the 2 documents?
from dart_pdf.
The first one is this:
sample.pdf
The second one is generate in the generatePDF()
method that I put in the code example
static Future<File> generatePDF(Uint8List signature) async {
try {
final font = await PdfGoogleFonts.nunitoExtraLight();
final pdf = Document();
final image = MemoryImage(signature);
pdf.addPage(
Page(
pageFormat: PdfPageFormat.a4,
build: (Context context) {
return Center(
child: Column(
children: [
Text(
'Participant Agreement Form',
style: TextStyle(
font: font,
),
),
SizedBox(height: 12),
Text(
'Name: Anakin Skywalker',
style: TextStyle(
font: font,
),
),
Text(
'Signature',
style: TextStyle(
font: font,
),
),
SizedBox(height: 20),
Image(image),
SizedBox(height: 4),
Container(
height: 1,
width: 200,
decoration: BoxDecoration(
border: Border.all(),
),
),
SizedBox(height: 10),
Text(
'Date: 2021-09-01',
style: TextStyle(
font: font,
),
),
],
),
); // Center
},
),
);
final dir = await getApplicationDocumentsDirectory();
final formPdf = File('${dir.path}/sign_form.pdf');
return await formPdf.writeAsBytes(await pdf.save());
} catch (e) {
log(e.toString());
throw Exception('Error generating PDF');
}
}
from dart_pdf.
Looks like your sample.pdf file is corrupted.
If you validate it at https://www.pdfforge.org/online/en/validate-pdfa it says so.
from dart_pdf.
Yes, you are right! It's working with another PDF as expected, thanks @DavBfr.
from dart_pdf.
Related Issues (20)
- Emoji's not displaying in PDF generated with dart_pdf HOT 2
- Send PDF to a wifi printer by ip
- Merging two pdf
- Updating PDF page
- Russian text Rendering issue.
- Flutter printing: ^5.12.0 package is not working offline or when on local network
- Texts containing \n and \r sometimes don't work
- error build for flutter 3.22.0 (No named parameter with the name 'size'.) HOT 3
- Unable to build app on Flutter version 3.22.0 HOT 5
- Support `--wasm` flag in Flutter 3.22 for web HOT 2
- IntrinsicHeight widget
- Support SVG `vector-effect` as Β΄non-scaling-stroke`
- Not able to create windows build
- Instance of toomanypagesexception
- networkImage could not download an image have .emf extension HOT 1
- Is there any callback if my printer pages ran out it generates me proper error like "Page not found" or "Insert paper first" on print command?
- No named parameter with the name 'size'. Issue Flutter 3.22.1 HOT 4
- Customize TableOfContent text style (size at least) - title name is bigger sometimes
- How to change printing margins HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dart_pdf.