• 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
insert PostScript not working?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

insert PostScript not working?


  • Subject: insert PostScript not working?
  • From: Ruben Smits <email@hidden>
  • Date: Thu, 4 Apr 2002 17:08:45 +0200

Hi,

I am triing to insert PostScript during printing. I found the sample code in the develloper tools and tried to use that code for my own project, but it doesn't work as expected.

In top of the class I declared a
#define INCLUDE_POSTSCRIPT 1
to indicate I want to insert my own PS. When PostScript is supported by my printer (or by printing to a PS-file) a Boolean addPostScript is set.

By giving the print-command I reach a print-loop. From there a function DrawPage() is called.

In this function I wrote the next lines of code:

OSStatus status = noErr;

Str255 pageNumberString;
MoveTo(72,72);
TextFont(kFontIDHelvetica);
TextSize(24);
DrawString("\pSomeString, Page Number ");
NumToString(pageNumber, pageNumberString);
DrawString(pageNumberString);

This part of code is working OK. Printing to PDF or PS file, or direct to a PS-Printer, all result in the string "SomeString, Page Number 1".

After this code, I've got the next lines of code:

if (addPostScript)
{
Str255 postScriptStr1 = "\p/gsave Helvetica findfont 18 scalefont setfont 200 300 moveto (AnotherString) show grestore \r";


// Set PrintCenter ready to accept PS instead of PDF
status = PMSessionPostScriptBegin(printSession);

if (status == noErr)
{
// The actual PS data (in a char-pointer)
status = PMSessionPostScriptData(printSession, (char *)&postScriptStr1[1], postScriptStr4[0]);

if (status == noErr)
status = PMSessionPostScriptEnd(printSession); // End "PS-mode"
of printcenter
}
}


I put a breakpoint on the PMSessionPostScriptData(), this function is executed and status remains noErr. When I look at the resulting PostScript file, it makes no difference if I include this last PostScript part or not. The PostScript filesize is exactly the same. Also when I create a PDF from the PS, the AnotherString is not shown. While debugging, I can read the correct string in postScriptStr1.

So, the line of code seems to be executed, since there's no OSErr, but the code is not inserted in the PostScript. The current printsession is OK, since the first part of code (DrawString()) is working OK.
Unfortunately I can't read the PS, because the inserted code (also the first DrawString) is put in an encrypted part in the PS by the printcenter.

What am I missing here? Why isn't PMSessionPostScriptData() inserting the PS?
_______________________________________________
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: DO Crashing on received object
  • Next by Date: NSFileManager trouble?
  • Previous by thread: Re: Image Filtering Services
  • Next by thread: NSFileManager trouble?
  • Index(es):
    • Date
    • Thread