Generating a paginated PDF for use with PDFDocument
Generating a paginated PDF for use with PDFDocument
- Subject: Generating a paginated PDF for use with PDFDocument
- From: Keith Blount <email@hidden>
- Date: Wed, 12 Sep 2007 11:03:28 -0700 (PDT)
Hi,
I've searched the archives but solutions posted here
don't seem to have worked for me.
Basically, I have a paginated view, a bit like the
multiple page view in text edit, except that mine is
used only for printing. This view gets printed or
saved as a PDF through the inbuilt print panels/sheets
perfectly.
However, what I would now like to do is generate PDF
data from this view that can be used to create a
PDFDocument (using PDFDocument's -initWithData:) and
then displayed in the PDFView right inside my app. In
other words, I want to create a sort of one-click
preview of the paginated view right within in my app,
without having to go to print > preview and without
having to save the PDF to disk.
Unfortunately, all of the methods I have tried to do
this just create one long PDF page rather than a
paginated document with borders.
For instance, I thought this would work:
KBTextPagePrintingView *printView = [self
draftPrintingView];
NSMutableData *data = [NSMutableData data];
NSPrintOperation *printOp = [NSPrintOperation
PDFOperationWithView:printView insideRect:[printView
bounds] toData:data printInfo:[printView printInfo]];
[printOp runOperation];
(Note that KBTextPagePrintingView is my paginated
view.)
But it doesn't. (Neither does NSView's
dataWithPDFInsideRect:) When loaded into a PDFDocument
and then displayed in a PDFView, the document is one
long (and thin) document.
Is there any way of doing this without having to save
the file as a PDF file to disk first?
Many thanks in advance,
Keith
____________________________________________________________________________________
Got a little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden