On Aug 19, 2009, at 8:45 PM, Adam R. Maxwell wrote:


On Aug 19, 2009, at 2:50 PM, Ben Lachman wrote:

I have an offscreen window containing a WebView that I'm using to generate web previews. My current code works beautifully and looks like this:

        NSView *view = previewWebView.mainFrame.frameView.documentView;

I do something similar, although using the frameView directly (and drawing to a CGContext). Do you really need to draw the documentView?

If I use the frameView I get scrollers in the generated image. How do you avoid getting scrollers?


However, I'm really only interested in the first page or so of data. So I figure I just make targetRect smaller by making the height the same as the width (if it's larger) prior to creating the image rep, like so:

        if( NSHeight(targetRect) > NSWidth(targetRect) )
                targetRect.size.height = NSWidth(targetRect);

This either produces an empty image rep or a chunk of the image the size of the intersection of the visible area of view and the rect you'd get if targetRect was aligned to the bottom left (however view is flipped). Manipulating targetRect doesn't seem to help.

Have you tried sending -layout to the documentView before drawing? Safari 4.0.3 broke my code (I started getting blank image), and that was the workaround I came up with.

Hadn't tried it but it doesn't seem to make a difference to my problem. Mind posting your code? (My plan is to release a web preview generator class so that others don't have to continually roll their own once mine is working correctly).

Cheers,
->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: blach...@mac.com
twitter: @benlachman
mobile: 740.590.0009



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to