I want the code that adds an image to pdf. I am using pspdfkit in my flutter app.
I saw the official documentation of pspdfkit flutter. There they have explained how to add image annotation to pspdfkit web, but not pspdfkit flutter. I need code or any guide that would help me adding image annotation to pspdfkit flutter.
2
Answers
I tried to insert signature image to PDF in Flutter in an interactive way (scale/drag & drop/rotate). Here are some advices for you:
This will take A LOT of effort, you could challenge yourself, like I did 😀 :
Note 1: This is a hard task because if you want to insert an image to PDF correctly, you need to calculate COORDINATES of image in PDF. Keep in mind, coordinates of PDF is from bottom-left whereas phone is top-left. And the measurement of PDF is POINTS, whereas other can be pixels or DIP.
Note 2: You can use MethodChannel to completely change your Flutter entire screen to native code, or you can use Platform View to combine Flutter + native (that could easier to communicate between Flutter + native but harder to create). I’m using the latter option.
Well this maybe not a answer that you want, but maybe in future some guys could meet the same problem so I still answer here, maybe helpful some days.
The method is in general the same in any application/pdf the object to be placed over a page is normally appended by over stamping, thus PDF or image it should not matter you may find some applications call it watermark.
As for code I cannot help except to point to related examples can be found in github such as https://github.com/PSPDFKit/pspdfkit-android-catalog/blob/32476b0ce1dd482c740786217582135b646310e4/app/src/main/java/com/pspdfkit/catalog/examples/java/activities/AnnotationWithAlphaCreationActivity.java