• 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 a Webview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing a Webview


  • Subject: Printing a Webview
  • From: Greg Hulands <email@hidden>
  • Date: Fri, 6 Feb 2004 16:33:13 +1000

Hi,
I am making a simple web cafe solution that allows the client machine
to print the current web page in a Web View. Because we don't want the
person to be able to get access to the standard print panel, because
they can just leave without paying for it, I am trying to get the web
view to return itself as a formatted pdf.

But when I view the pdf, it only shows what was seen on the screen, not
the whole page.

- (void)print:(id)sender
{
NSMutableData *data = [NSMutableData data];
NSPrintInfo *info = [NSPrintInfo sharedPrintInfo];
[info setOrientation:NSPortraitOrientation];
[info setPaperSize:[NSPrintInfo sizeForPaperName:@"A4"]];

NSPrintOperation *op = [NSPrintOperation PDFOperationWithView:webview
insideRect:[webview frame]
toData:data
printInfo:info];

if ([op runOperation])
{
[cafeController client:self printPDF:data];
}
else
{
NSRunAlertPanel(@"Error Printing", @"There was an error printing the
page.", @"OK", nil, nil);
}
}

I have tried the webview's bounds as well, but no luck. I have tried
getting the webview to return the pdf inside a rect, but no luck. Is it
at all possible to achieve this without displaying the print panel?


Any help is greatly appreciated,

Regards,
Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: descender for glyph
  • Next by Date: Re: Programmatically disabling/enabling keyboard shortcuts inmain menu?
  • Previous by thread: OT: Special Characters... menu item missing
  • Next by thread: Re: Programmatically disabling/enabling keyboard shortcuts inmain menu?
  • Index(es):
    • Date
    • Thread