• 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: Creating PDF from a view with custom bounds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating PDF from a view with custom bounds


  • Subject: Re: Creating PDF from a view with custom bounds
  • From: email@hidden
  • Date: Fri, 20 Jul 2001 19:15:41 +0200

Hi Brendan,
I guess you are trying to respond to me, but I wasn't in the receiver list.


Le jeudi 19 juillet 2001, ` 11:22, Brendan Younger a icrit :


I'm sorry, I'm completely confused. The bounds that you state would
make your image 2 pixels wide and 2 pixels tall which I doubt is the
case. I assume therefore that the numbers you quoted are scaling
factors.

Not at all. The frame of the view is (0,0)x(400,300), so 400 pixels wide. The bounds are (-1,-1)x(2,2) (exactly (-1.4, -1.1)x(2.8, 2.2)) and these are the internal (float) coordinate system of this view. That means that if I draw a square with rect (-1,-1)x(2,2), it will almost fill the view.

Now the point is that doesn't work correctly with [NSPrintOperation PDFOperationWithView]. When I call that as indicated in my method, the drawRect method of the view is called with aRect = (0,0)x(1,1), that is only 1/4th of the view.

I noticed that there are a number of NSView methods which are supposed to work along with printing:
- (BOOL)knowsPageRange:(NSRangePointer)range

- (NSPoint)locationOfPrintRect:(NSRect)aRect

- (NSRect)rectForPage:(int)pageNumber

I implemented these, but NONE of them is actually called, not for PDFOperationWithView or EPSOperationWithView as well. Did anyone has success using these methods? Some of them are not documented.

Also I tried to pass a NSPrintInfo argument to PDFOperationWithView where I did that before:
[printInfo setOrientation:NSLandscapeOrientation];
[printInfo setHorizontallyCentered:YES];
[printInfo setVerticallyCentered:YES];
but this didn't work.

For the moment, I managed to have the thing working by concatenating a translation in the drawRect method, and changing the rect to the current bounds, but it sound like a hack.
Also the EPS representation is still incorrect in many ways:
-- the drawing is not centered on the page (though it is now in the PDF); it is not even completly contained in the page;
-- the PS code is very odd, with a lot of dictionaries, etc. Illustrator complains it contains CMYK together with RGB (I don't use CMYK in my drawings).
-- there is no Bounding box at all.

Seems to me that all this part (printing/PDF/EPS) is still very buggy and incomplete in Cocoa...


Thomas Lachand-Robert
********************** email@hidden
The Commandant Project: http://lachand.free.fr/
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.


  • Prev by Date: Re: [Help] How to get instance of instantiated Controller in nib from Controller in another nib? (Java)
  • Next by Date: Abracadabra (solving NSTableView and setDoubleAction)
  • Previous by thread: Re: Creating PDF from a view with custom bounds
  • Next by thread: Re: Creating PDF from a view with custom bounds
  • Index(es):
    • Date
    • Thread