I'm trying to do something similar

Inside my button's OnClick I have

View    myView  = arg0.getRootView();
myView.setDrawingCacheEnabled( true );
mPDF.addImage( myView.getDrawingCache() );

I'm hoping this will capture the screen to a bitmap

my PDF.addImage   is as follows:

        public void addImage(Bitmap bmp) {
                ByteArrayOutputStream bos = new ByteArrayOutputStream();
                bmp.compress(CompressFormat.JPEG, 100 , bos);

                mImage += "5 0 obj \n" +
                                 "<< /Type /XObject\n" +
                                 "  /Subtype /Image\n" +
                                 "  /Width  " + bmp.getWidth()  + " \n" +
                                 "  /Height " + bmp.getHeight() + " \n" +
                                 "  /ColorSpace  /DeviceRGB\n" +
                                 "  /BitsPerComponent 8\n" +
                                 "  /Length " + bos.size()  + "\n" +
                                 "  /Filter  /ASCIIHexDecode\n" +
                                 ">>\n\n" +
                                 "stream\n";

                mImage += bos.toString() + "\n";

                mImage += "endstream\n" +
                                 "endobj\n\n";
        }


1) Is the onClick the correct way to capture the screen to bitmap ?
2) Is the PDF code the correct way to store an image inside a PDF ?

thanks in advance


On Jun 2, 3:11 pm, Paul Turchenko <[email protected]> wrote:
> Your process will need permission to do that. ADB has it by default,
> but regular apps don't. Unless you're rooted, you can't do that.
>
> On Jun 2, 4:27 am, Bharathiraja R <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > Hi All,
>
> > Want sample code to capture screenshot of current screen from phone,
> > same like ddms (screen capture).
> > Please help me out.
>
> > Regards,
> > Bharathiraja R

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to