• 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
Printing Problem (Was: Re: Generating PDFs....)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing Problem (Was: Re: Generating PDFs....)


  • Subject: Printing Problem (Was: Re: Generating PDFs....)
  • From: Dave DeLong <email@hidden>
  • Date: Wed, 29 Jun 2005 19:13:11 -0500

Hi everyone,

Thanks for the tips on how to make PDFs. I tried a couple different ways (drawing directly into an NSImage, typing into a hidden NSTextView and then getting PDF data), but I didn't have much success with either.

A friend of mine then pointed out I could try printing to a file, so we worked up some code that takes the NSTextView and saves it to a file (resulting in the wanted PDF). There's one glitch: every other page in the PDF is blank. I end up with a 66 page PDF instead of a 33 page PDF.

Here's my printing code (textView is my NSTextView containing all of the properly formatted text):

NSString * save = [@"~/Desktop/Preview.pdf" stringByExpandingTildeInPath];

    NSPrintInfo *printInfo;
    NSPrintInfo *sharedInfo;
    NSPrintOperation *printOp;
    NSMutableDictionary *printInfoDict;
    NSMutableDictionary *sharedDict;

sharedInfo = [NSPrintInfo sharedPrintInfo];
sharedDict = [sharedInfo dictionary];
printInfoDict = [NSMutableDictionary dictionaryWithDictionary:sharedDict];
[printInfoDict setObject:NSPrintSaveJob forKey:NSPrintJobDisposition];
[printInfoDict setObject:save forKey:NSPrintSavePath];
printInfo = [[NSPrintInfo alloc] initWithDictionary: printInfoDict];
[printInfo setHorizontalPagination: NSAutoPagination];
[printInfo setVerticalPagination: NSAutoPagination];
[printInfo setVerticallyCentered:NO];
printOp = [NSPrintOperation printOperationWithView:textView printInfo:printInfo];
[printOp setShowPanels:NO];
[printOp runOperation];


Any ideas as to what I'm missing?

Thanks!

Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Printing Problem (Was: Re: Generating PDFs....)
      • From: Scott Thompson <email@hidden>
References: 
 >Generating PDFs.... (From: Dave DeLong <email@hidden>)
 >Re: Generating PDFs.... (From: Scott Thompson <email@hidden>)
 >Re: Generating PDFs.... (From: Nicko van Someren <email@hidden>)

  • Prev by Date: subclass of NSSlider won't call action method
  • Next by Date: NSDocumentController Subclass Response
  • Previous by thread: Re: Generating PDFs....
  • Next by thread: Re: Printing Problem (Was: Re: Generating PDFs....)
  • Index(es):
    • Date
    • Thread