Hi Saber,
We can read the PDF document
from webspace/website by using the HTTP package and drawn the text. Kindly try
the following code example in your end.
- Add http package
in dependencies section of pubspec.yaml file
|
dependencies:
http: ^0.13.4
|
- Import the following package in
your dart file.
|
import 'package:http/http.dart' show get;
|
- Get image data
- //Read an PDF from website/webspace
- var url = Uri(
- path:
- Input pdf address link);
-
- var response
= await get(url);
- var data = response.bodyBytes;
|
- Drawstring in PDF
- // Create a new PDF document
- PdfDocument document
= PdfDocument(inputBytes: data);
- // PdfDocument document = PdfDocument();
-
- //Draw string on the existing page graphics
- document.pages[0].graphics.drawString(
- "Sample text content", new PdfStandardFont(PdfFontFamily.helvetica, 17),
- bounds:
const Rect.fromLTWH(100, 20, 200, 50));
- //Save and launch the document
- final List<int> bytes
= document.save();
- //Dispose the document.
- document.dispose();
|
Kindly refer to the following
articles for more details,
KB: https://www.syncfusion.com/kb/12757/how-to-load-a-pdf-document-from-firebase-storage-in-syncfusion-flutter-pdfviewer
Regards,
Surya V