I have a database document where there is links available for multiple images. I want to display this images in pdf.
I am using pdf: ^2.1.0 to edit the pdf file and flutter_pdfview: ^1.0.1 to view the pdf.
I am currently displaying images like this but this can only display images from the asset
final profileImage = pw.MemoryImage(
(await rootBundle.load('assets/images/image.png')).buffer.asUint8List(),
);
//Inside Widgets
pw.Image(profileImage)
I want to show images using a link but its not being possible.
This will help you
var response = await http.get(Uri.parse(imageUrl));
var data = response.bodyBytes;
Image(pdfW.MemoryImage(data),)
Related
Hi I am new to rect Js and hope so I you will get the problem I am facing.
I and using the react js and firebase storage.
I want to done following task.
1 upload image from-front end to the storage
2 Pass it's reference to a collection in firebase.
3 get the images I have saved in the firebase storage and display it in the Gallery section.
I have completed the 1st task and facing issue with 2nd and 3rd. I can't find a solution on the internet related to React Js all the tutorial are about React Native.
basically I am creating a front end and a dashboard from where I upload images for the gallery section and get those uploaded images on the website gallery section
all the imports
import { ref, uploadB``ytesResumable } from "firebase/storage";
import { storage } from "../../firebase-config";
Here is the code for uploading the file into firebase storage.
let fileRef = ref(storage, `birdsImage/${birdName}-${ringNo}`);
const uploadTask = uploadBytesResumable(fileRef, file);
// track progress
uploadTask.on("state_changed", (snapshot) => {
progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
setUploadProgress(progress);
console.log(`upload is ${progress} % done`);
image gallery where the image must show
Please Help me with this...!!!
I have a PDF file stored in a directory within the application (assets/pdf/fileName.pdf). I need to display it on a new tab on a button click from a dialog.
Here is what I have, after looking at various answers:
In *.component.ts:
openPDF() {
this.myService.fetchPDF().subscribe(
res => {
let file = new window.Blob([res], {type: 'application/pdf'});
let fileURL = window.URL.createObjectURL(file);
window.open(fileURL, '_blank');
}
);
}
In *.service.ts:
fetchPDF(): any {
const path = 'assets/pdf/fileName.pdf';
return this.httpClient.get(PathResolver.resolveStatic(path),{responseType : 'blob'});
}
I already tried using responseType : 'arraybuffer', but it didn't work out either.
Here are the threads I have looked at:
How to Display blob (.pdf) in an AngularJS app
Angular 2 download PDF from API and Display it in View
PDF Blob - Pop up window not showing content
Failed to load PDF document - Angular JS - BLOB
I am not sure why are you using httpClient. The outcome that you want could be simply achieved by the following code
In *.service.ts:
fetchPDF(): any {
const path = 'assets/pdf/fileName.pdf'
return path;
}
In *.component.ts:
openPDF() {
window.open(this.myService.fetchPDF(), '_blank');
}
You will either need to use the html embed tag (most likely also using a safe pipe), a PDF viewer (like Google PDF Viewer) or you can open the PDF in a new tab (this is the more common approach I see). It depends on your preference.
I am making an app on codename one using InteliJ and I have some cloudinary pictures that show up on the simulator but when I send an IOS debug build, the pictures do not show up.
I went to this link https://www.codenameone.com/blog/sizing-images-just-right-with-cloudinary.html and used the same method but it did not work. When I tried to show a local image on the debug build, it showed up but the cloudinary images did not, so the problem has to do with cloudinary, not images in general.
Here is my code:
Cloudinary cloudinary = new Cloudinary(ObjectUtils.asMap(
"cloud_name", NAME,
"api_key", API_KEY,
"api_secret", API_SECRET));
cloudinary.config.privateCdn = false;
ArrayList labels = new ArrayList();
for (Object url : images) {
Image img2 = cloudinary.url()
.type("fetch") // Says we are fetching an image
.format("jpg") // We want it to be a jpg
.new Transformation().crop("fill") // We crop the image to fill the given width/height
.width(hi.getWidth())
.height(hi.getWidth())
)
.image(encImage, (String) url);
// Add the image to a label and place it on the form.
labels.add(img2);
}
for (Object img : labels) {
Image newImg = (Image) img;
allImgs.addItem(newImg);
}
ImageViewer imgViewer = new ImageViewer();
imgViewer.setImageList(allImgs);
Again, I am not getting any error messages in the simulator and the images are showing up but they are not showing up in the IOS debug build. Please help.
i am trying for a pdf viewer using syncfusion with input as a blob sorage url but CORS error is being thrown when i use it. my core is as follows
blobService.getFileFromBlobByURI(objBlobStorageModel).then(function (result) {
$scope.ShowprofileSpinner = false;
$scope.serviceurl = $sce.trustAsResourceUrl(result.data);
$scope.serverActionSettings = {
load: 'LoadAction', fileUpload: 'FileUploadAction',
download: 'DownloadAction'
}
});
and the html for pdf is as follows
<div id="container" style="width: 100%; height: 680px" ej-pdfviewer e-serviceurl="serviceurl" e-serverActionSettings="serverActionSettings"></div>
Based on the provided details, we suspect that you are passing the PDF document data in the serviceURL. The serviceUrl property sets the Web Service Url not the PDF document data. Refer to the below UG to display the PDF document using Web Service.
https://help.syncfusion.com/angularjs/pdfviewer/getting-started#displaying-pdf-document-using-web-api
If your requirement is to load the PDF document from blob storage, kindly refer to the below KB,
https://www.syncfusion.com/kb/8737/how-to-load-a-pdf-document-from-url-into-pdf-viewer-from-client-side
You can also load the PDF documents during the control initialization using the documentPath API. Refer to the “Load the documents during control initialization” section in the below link,
https://help.syncfusion.com/angularjs/pdfviewer/getting-started#initialize-and-configure-the-control
Regards,
Ramya T
I am trying to append the recorded video which is blob object into quill editor but the video which is appended in the editor is not playable.
Able to see only the blob object getting printed in the quill editor. If i try to open the contents in the browser it is working fine. Any suggestions?
enter image description here
well,according to this issue,
I think you maybe need to overwrite the video module's sanitize method to make it work,for image it can work like this:
var Image = Quill.import('formats/image')
Image.sanitize = function(url) {
return url
}
so as I guess, following things maybe useful:
var Video = Quill.import('formats/video')
Video.sanitize = function(url) {
return url
}
and you may need provide blob url to make it work