• 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
Simple PDF generation code not working as intended
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple PDF generation code not working as intended


  • Subject: Simple PDF generation code not working as intended
  • From: Devarshi Kulshreshtha <email@hidden>
  • Date: Thu, 13 Oct 2011 12:20:51 +0530

Hi all,

I am trying a simple application to generate pdf from contents in a
text view.

I am using below code:

        NSPrintInfo *pdfDisplayInfo = [[NSPrintInfo alloc]
initWithDictionary:[NSDictionary
dictionaryWithObjectsAndKeys:@"YES",NSPrintHeaderAndFooter,nil]];
        [pdfDisplayInfo setVerticalPagination:NSAutoPagination];
        [pdfDisplayInfo setHorizontalPagination:NSAutoPagination];
        [pdfDisplayInfo setVerticallyCentered:NO];
        NSFileManager *filemanager = [NSFileManager defaultManager];
        NSMutableData *dataObtained = [[NSMutableData alloc] init];
        NSPrintOperation *printOperation = [NSPrintOperation

    PDFOperationWithView:contentView

    insideRect:[contentView frame]

    toData:dataObtained printInfo:pdfDisplayInfo];

        [printOperation runOperation];
        [filemanager createFileAtPath:[@"~/Documents/SamplePrint.pdf"
stringByExpandingTildeInPath] contents:dataObtained attributes:nil];

Problem is:

Though I have used setVerticalPagination as NSAutoPagination, content
in pdf generated is not distributed among multiple pages.

Can anyone suggest me - if I am doing anything wrong or missing
something?

Here is the link for, code :
http://db.tt/L9rM8NU7<http://www.google.com/url?sa=D&q=http://db.tt/L9rM8NU7&usg=AFQjCNHabIMFPDDOLl2BOEJk27GkVyW_0g>


Thanks,
Devarshi
_______________________________________________

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

  • Follow-Ups:
    • Re: Simple PDF generation code not working as intended
      • From: Martin Wierschin <email@hidden>
  • Prev by Date: Re: Keeping grayscale image grayscale
  • Next by Date: Animating a UITableViewCell changing size
  • Previous by thread: Using layers is very slow when using sandboxing
  • Next by thread: Re: Simple PDF generation code not working as intended
  • Index(es):
    • Date
    • Thread