Android: Embedding a compressed image inside a PDF document - android

How to embed a compressed image (e.g. PNG, JPEG, etc.) in an Android PdfDocument?
When writing the image into the Page's canvas, it is encoded as a bitmap, instead I'd like to embed the image compressed as it is.

I've just realised I can do this with iText:
itext images tutorial
Unfortunately, it does not allow to draw views in a canvas like the native PdfDocument class. So I need to create a PDF without images with PdfDocument and put a placeholder for such images. Then I need to open the pdf file with iText and append the images at the placeholders' location.

Related

Adding SVG images from assets folder in adapter

I want to load SVG in ImageView from Gridview Adapter,
i do this:
imageView.setImageURI(Uri.parse("file:///android_asset/ico/s.svg"));
but not work and dont show anything
I want to load SVG in ImageView from Gridview Adapter, i do this:
First, ImageView does not support SVG directly.
Second, your code appears to be loading a PNG file, not an SVG file.
Third, file:///android_asset/ is for WebView. It does not work elsewhere in the Android SDK.
You should consider switching to using Glide as an image-loader. It handles file:///android_asset/ and has sample code for transcoding SVG files. Plus, it does the image-loading work on a background thread.
Otherwise, you can use AssetManager and its open() method to get an InputStream on an asset. If that asset is a PNG, JPEG, or WebP file, you can use BitmapFactory.decodeStream() to read in the stream and give you a Bitmap back that you can use for the ImageView. You would need a third-party library to do something with an SVG asset. And, you need to arrange to do this work on a background thread, as otherwise your UI will freeze and cause users to think that your app is stuck.

Displaying a image captured using Camera inside an html image tag placed within a WebView - Xamarin.Android

I'm looking for a way on to display the image captured using Camera2 API in Xamarin.Android inside an HTML tag which is placed within a WebView.
Though it was possible to obtain the File URi where the image is located, setting it into the image tag which I have tried, isn't working. I also want to know whether this kind of thing can be done in Native Android.
You can encode the content of the image in base64, and than set it in the src of your img tag like this:
<img src="data:image/jpg;base64,VeryLongBase64EncodedImageData"/>

SVG image not display

i have converted a psd file into svg, it works good at browser but not works on android native applications, how can i do this?
ImageView imageView = (ImageView)findViewById(R.id.img1);
imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
//Parse the SVG file from the resource
SVG svg = SVGParser.getSVGFromResource(getResources(), R.raw.android);
//Get a drawable from the parsed SVG and apply to ImageView
imageView.setImageDrawable(svg.createPictureDrawable());
This is the code i used to display svg image. it works when i used simple svg images, but it not works converted svg images using illustrator . how can i do?
I am guessing that your SVG just contains the image from the PSD. Is that the case?
If all that the SVG contains is a bitmap image, then you are not really using SVGs for their proper purpose (vector art). You would be better off just converting the PSD to a JPEG or PNG and loading that into an ImageView.
However, if you are definitely sure you want to load an SVG, then the solution depends on which SVG library you are using.
svg-android: As far as I know, it doesn't support <image> elements, so there is no solution
AndroidSVG: supports <image>, so it should work as long as the device has the memory to load the image. If the image is embedded in the file, you should be fine. If it references an external image, you will need to pass in an SVGExternalFileResolver so it knows how to find the bitmap. See my answer to the following question: https://stackoverflow.com/a/21531168/1292848

Is it possible to view a pdf image on android imageview

Hello I am looking at a type of drawing application that views images and would like to mark them up. Now I can load regular jpg and pngs, but our client has images in a pdf file. I am wondering if there is a way to display these on an image view in android.

Android PDF page to image api

Is there any possible way to convert a pdf into image and show them on a image view?
PDF isn't made up of images, they're vectors.
Tcouple open-source java PDF to Image converters though like:
http://www.jpedal.org/
http://code.google.com/p/pdfonejava/

Categories

Resources