Android 如何将图像、Pdf、Docx和Doc文件转换为位图

Android 如何将图像、Pdf、Docx和Doc文件转换为位图,android,pdf,docx,doc,Android,Pdf,Docx,Doc,我正在使用图像转换为位图的代码: public Bitmap getBitmap() throws IOException { if (!getInformation()) throw new FileNotFoundException(); if (!getStoredDimensions()) throw new InvalidObjectException(null); RectF rect

我正在使用图像转换为位图的代码:

public Bitmap getBitmap() throws IOException {
        if (!getInformation())
            throw new FileNotFoundException();

        if (!getStoredDimensions())
            throw new InvalidObjectException(null);

        RectF rect = new RectF(0, 0, storedWidth, storedHeight);
        orientation.mapRect(rect);
        int width = (int) rect.width();
        int height = (int) rect.height();
        int subSample = 1;

        while (width > MAX_WIDTH || height > MAX_HEIGHT) {
            width /= 2;
            height /= 2;
            subSample *= 2;
        }

        if (width == 0 || height == 0)
            throw new InvalidObjectException(null);

        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = subSample;
        Bitmap subSampled = BitmapFactory.decodeStream(resolver.openInputStream(uri), null, options);

        Bitmap picture;
        if (!orientation.isIdentity()) {
            picture = Bitmap.createBitmap(subSampled, 0, 0, options.outWidth, options.outHeight,
                    orientation, false);
            subSampled.recycle();
        } else
            picture = subSampled;

        return picture;
    }
我面临的问题是如何从Pdf、Docx和Doc扩展文件转换为位图。 是否有将文件转换为位图的常用函数。
我想将位图文件发送到服务器。

我正在使用改型将所有类型的文件转换为位图。通过使用此改型,android可以轻松轻松地转换为位图。请分享您的观点。我遇到了问题