Hi, excellent videos! Do you happen to have one on how to create a download button for downloading an image, like in wallpaper download apps? How can I contact you? Thanks and best regards.
To add the images in the PDF or Watermark you need to convert your assets/images files anyfile type for example PNGs into Uint8List -> this converts your image into bytes. Then use that data to populate your images in your code. For example: // Load the images from assets final Uint8List logoBytes = await rootBundle.load('assets/logo.png').then((data) => data.buffer.asUint8List()); final Uint8List watermarkBytes = await rootBundle.load('assets/watermark.png').then((data) => data.buffer.asUint8List()); final Uint8List backgroundBytes = await rootBundle.load('assets/background.png').then((data) => data.buffer.asUint8List()); final pdf = pw.Document(); // Define common styles final titleStyle = pw.TextStyle( fontSize: 28, fontWeight: pw.FontWeight.bold, color: PdfColors.blue900, ); final subheadingStyle = pw.TextStyle( fontSize: 18, fontWeight: pw.FontWeight.bold, color: PdfColors.black, ); final normalTextStyle = pw.TextStyle( fontSize: 14, color: PdfColors.black, ); final highlightedTextStyle = pw.TextStyle( fontSize: 20, fontWeight: pw.FontWeight.bold, color: PdfColors.black, ); // Add a page to the PDF pdf.addPage( pw.Page( pageFormat: PdfPageFormat.a4, margin: pw.EdgeInsets.all(32), build: (pw.Context context) { return pw.Stack( children: [ // Ensure the background image fits the entire A4 page if (backgroundBytes != null) pw.Positioned.fill( child: pw.Image( pw.MemoryImage(backgroundBytes), fit: pw.BoxFit.cover, // Ensures the image covers the full page ), ), Hope this would help you :) Cheers,
please create more videos like these bec you are the best 😍
this video help me alot.. you should do more like this
how to download the pdf now?
Great video! Can you show us how to email the generated email please?
Hi how to add image in this pdf?
great video. would be helpful to know how then to email it or to have this done automatically.
Hi, excellent videos! Do you happen to have one on how to create a download button for downloading an image, like in wallpaper download apps? How can I contact you? Thanks and best regards.
Please create a video showing dynamic product data, invoices, etc....
Thanks
Can you do one for a word document?
Thank you
Hi how to add image in this pdf tks
To add the images in the PDF or Watermark you need to convert your assets/images files anyfile type for example PNGs into Uint8List -> this converts your image into bytes. Then use that data to populate your images in your code.
For example:
// Load the images from assets
final Uint8List logoBytes = await rootBundle.load('assets/logo.png').then((data) => data.buffer.asUint8List());
final Uint8List watermarkBytes = await rootBundle.load('assets/watermark.png').then((data) => data.buffer.asUint8List());
final Uint8List backgroundBytes = await rootBundle.load('assets/background.png').then((data) => data.buffer.asUint8List());
final pdf = pw.Document();
// Define common styles
final titleStyle = pw.TextStyle(
fontSize: 28,
fontWeight: pw.FontWeight.bold,
color: PdfColors.blue900,
);
final subheadingStyle = pw.TextStyle(
fontSize: 18,
fontWeight: pw.FontWeight.bold,
color: PdfColors.black,
);
final normalTextStyle = pw.TextStyle(
fontSize: 14,
color: PdfColors.black,
);
final highlightedTextStyle = pw.TextStyle(
fontSize: 20,
fontWeight: pw.FontWeight.bold,
color: PdfColors.black,
);
// Add a page to the PDF
pdf.addPage(
pw.Page(
pageFormat: PdfPageFormat.a4,
margin: pw.EdgeInsets.all(32),
build: (pw.Context context) {
return pw.Stack(
children: [
// Ensure the background image fits the entire A4 page
if (backgroundBytes != null)
pw.Positioned.fill(
child: pw.Image(
pw.MemoryImage(backgroundBytes),
fit: pw.BoxFit.cover, // Ensures the image covers the full page
),
),
Hope this would help you :)
Cheers,
is it support arbic language
asombroso, me gustaría saber cómo se puede descargar ese documento