Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't create in-memory paginated PDF based on WebView, but I think I'm close




On Mar 31, 2006, at 10:13 PM, Mike Zornek wrote:

In my app I am generating HTML and want to create a PDF based on the
rendering of it. I'm using a WebView (currently on screen but will probably
be off screen once I've gotten this working since the user is never meant to
see a webview, only the resulting PDF).


After lots of searching (list archives, Google, and so on) I have gotten
some code working that will create a PDF file that is properly paginated,
but in my case I want the PDF in memory not on disk.


...

I was hoping the WebView would be able to paginate by itself. I am also a
web developer and I know there are CSS attributes out there that help
control printing so I am a little hesitant to manually cut out pages since
I'd like to honor any Print CSS that is being used in the HTML.

I don't know about CSS and some of the other things. In the WebKit sample code (installed in /Developer/Examples/WebKit on my machine) is a project called CarbonWeb.


At one point in the past, the CarbonWeb printing code would generate a PDF from a paginated web view (in memory using dataWithPDFInsideRect:) and then print the resulting PDF . At the time the pagination was done using the pagination routines of NSView. It looks like the code has been modified since I implemented that so that it is using a NSPrintOperation to do the pagination but it should be fairly easy to pick up the PDF pages as they are generated and stuff them into a CGPDFDocument in memory.

Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.