Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Office #5

Open
DevTrinh opened this issue Nov 3, 2023 · 2 comments
Open

Convert Office #5

DevTrinh opened this issue Nov 3, 2023 · 2 comments

Comments

@DevTrinh
Copy link

DevTrinh commented Nov 3, 2023

Hey man, can I ask you something, let's say I have a docx file, with 3 pages, how can I output each page as a bitmap or image (returns a list of bitmaps? ). With your code given:

private void initControl() {
        control = new MainControl(this);
        control.setOffictToPicture(new IOfficeToPicture() {
            public Bitmap getBitmap(int componentWidth, int componentHeight) {
                if (componentWidth == 0 || componentHeight == 0) {
                    return null;
                }
                if (bitmap == null
                        || bitmap.getWidth() != componentWidth
                        || bitmap.getHeight() != componentHeight) {
                    // custom picture size
                    if (bitmap != null) {
                        bitmap.recycle();
                    }
                    bitmap = Bitmap.createBitmap((int) (componentWidth), (int) (componentHeight), Bitmap.Config.ARGB_8888);
                }
                return bitmap;
            }

            public void callBack(Bitmap bitmap) {
                saveBitmapToFile(bitmap);
            }

            private Bitmap bitmap;

            @Override
            public void setModeType(byte modeType) {

            }

            @Override
            public byte getModeType() {
                return VIEW_CHANGE_END;
            }

            @Override
            public boolean isZoom() {
                return false;
            }

            @Override
            public void dispose() {

            }
        });
    }

desired image as:
public void callBack(Bitmap bitmap) { saveBitmapToFile(bitmap); }
How to make the result return a bitmap list, I tried to fix it but my level does not allow me to complete this yet. Hope you can update it in the future. Thank you for the great project

@Victor2018
Copy link
Owner

yes,you can get all page bitmap by public void callBack(Bitmap bitmap) {
saveBitmapToFile(bitmap);
} to add bitmap in list so diplay in other view

@DevTrinh
Copy link
Author

DevTrinh commented Nov 4, 2023

What I mean is that it will return a bitmap list, with each item in this list being each page of the word or pptx file. Currently, it only returns a single page when it is displayed, and initialized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants