• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Generating a PDF file without a NSView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generating a PDF file without a NSView


  • Subject: Re: Generating a PDF file without a NSView
  • From: Stefan Jung <email@hidden>
  • Date: Fri, 16 Nov 2001 20:35:11 +0100

Am Freitag den, 16. November 2001, um 06:42, schrieb David Adalsteinsson:

How can I create a PDF file (and EPS) without drawing it inside a drawRect in NSView and then
using "dataWithPDFInsideRect/dataWithEPSInsideRect" on the view.
Why? Is there a special reason to avoid drawRect:?
Calling drawRect does not mean anything happens onscreen, as long as you "lockFocus" on a view object that is not on screen.

For example:
NSImage *specImage;
specImage = [[NSImage alloc] initWithSize:[self bounds].size];
[specImage lockFocus];
[self drawRect:[self bounds]];
[specImage unlockFocus];
should do what you want.

I would like to be able to do something like:

Create an empty NSPDFImageRep/NSEPSImageRep
Connect it to a NSImage
draw into the NSImage using standard drawing command (lockFocus, ...., unlockFocus)
extract the representation with NSPDFImageRep/NSEPSImageRep

Is this in the right direction? If so, what is the exact syntax for lines 1 & 2.
Another example:
NSPDFImageRep *specImage = [[NSPDFImageRep alloc] initWithData:[self dataWithPDFInsideRect:[self bounds]]];
"self" because this line is used in a method of your view class. If you want to call it from within another class you need an explicit pointer.

Should I do this entirely differently.
With the information you gave us, the above examples should be appropriate..


Any help appreciated.

David


Stefan Jung


References: 
 >Generating a PDF file without a NSView (From: David Adalsteinsson <email@hidden>)

  • Prev by Date: Loading fonts
  • Next by Date: fetching help!!
  • Previous by thread: Generating a PDF file without a NSView
  • Next by thread: Targets
  • Index(es):
    • Date
    • Thread