• 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: Writing Files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing Files


  • Subject: Re: Writing Files
  • From: Tyson Tate <email@hidden>
  • Date: Mon, 30 Jun 2003 13:28:15 -0700

Nope, that doesn't fix it. I have no idea what's wrong with it. Here it is again, in it's entirety:



#import "PDF417Controller.h"
#import <Foundation/Foundation.h>
#import <pdf417lib.h>
#import <string.h>
#import <stdio.h>
#import <AppKit/AppKit.h>

@implementation PDF417Controller

- (IBAction)generateBarcode:(id)sender
{
pdf417param p;
FILE* f;
pdf417init(&p);

p.text = "hello";
p.options = PDF417_INVERT_BITMAP;
paintCode(&p);
if (p.error) {
pdf417free(&p);
}


NSSavePanel *savePanel;
NSString *documentDirectory = [[self documentPath] stringByDeletingLastPathComponent];
NSString *documentName = [[self documentPath] lastPathComponent];

savePanel = [NSSavePanel savePanel];
[savePanel setRequiredFileType:@"tiff"];
[savePanel setTreatsFilePackagesAsDirectories:NO];

if (NSOKButton == [savePanel runModalForDirectory:documentDirectory file:documentName])
{
f = fopen([[savePanel fileName] fileSystemRepresentation], "wb");

if (f != NULL) {
int cols = p.bitColumns / 8 + 1;
int k;
//fprintf(f, "/Times findfont\n12 scalefont setfont\n100 80 moveto\n(Am I gloating? Nahhhh...)show\n");
fprintf(f, "<</PageSize [ 6000 300 ]>> setpagedevice\n");
fprintf(f, "stroke\n0 0 translate\n%g %g scale\n", p.bitColumns/2.0, p.codeRows * 3/2.0);
fprintf(f, "%d %d 1 [%d 0 0 %d 0 %d]{<", p.bitColumns, p.codeRows, p.bitColumns, -p.codeRows, p.codeRows);
for (k = 0; k < p.lenBits; ++k) {
if (!(k % cols))
fprintf(f, "\n");
fprintf(f, "X", (int)p.outBits[k] & 0xff);
}
fprintf(f, "\n>}image\nshowpage\n");
fclose(f);
}
}

pdf417free(&p);
}

@end





On Monday, June 30, 2003, at 01:14 PM, Jan Van Tol wrote:

Is it possible you're not #importing AppKit.h? It's my guess that it doesn't recognize NSSavePanel.

-Jan Van Tol

--
Tyson Tate, Editor
Entropy Magazine
"Nourishment For The Starved."
http://www.entropymag.net
_______________________________________________
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.

  • Follow-Ups:
    • Re: Writing Files
      • From: Andy Lee <email@hidden>
References: 
 >Re: Writing Files (From: Jan Van Tol <email@hidden>)

  • Prev by Date: Re: Restrain size of NSWindow to NSToolbar only
  • Next by Date: Re: Writing Files
  • Previous by thread: Re: Writing Files
  • Next by thread: Re: Writing Files
  • Index(es):
    • Date
    • Thread