leigh@alberta.uucp (leigh willard) (09/01/89)
I am having trouble "pasting" to a view. I use the method [pb readType:NXPostScriptPboard data:&data length:&length] and when I print out 'data' to a file, sure enough, it is a bunch of postscript code. When I send the code to the postscript previewer 'YAP' I get what I want to be pasted. However, I am not sure what to do to send the postscript code to my view. I am trying the following: [aView lockFocus]; DPSWritePostScript(DPSGetCurrentContext(), data, length); [aView unlockFocus]; And I get the error: (actually, I get it many times) DPS client library error: PostScript program error %%[ Error: rangecheck; OffendingCommand: get ]%% Any comments would be appreciated. leigh willard
ali@polya.Stanford.EDU (Ali T. Ozer) (09/01/89)
In article <1989Aug31.201848.20892@alberta.uucp> Leigh Willard writes: >I am having trouble "pasting" to a view. I use the method > [pb readType:NXPostScriptPboard data:&data length:&length] >and when I print out 'data' to a file, sure enough, it is a bunch >of postscript code. When I send the code to the postscript >previewer 'YAP' I get what I want to be pasted. However, I am >not sure what to do to send the postscript code to my view. I >am trying the following: > [aView lockFocus]; > DPSWritePostScript(DPSGetCurrentContext(), data, length); > [aView unlockFocus]; >And I get the error: (actually, I get it many times) > DPS client library error: PostScript program error > %%[ Error: rangecheck; OffendingCommand: get ]%% One thing Yap does differently is to bracket the execution of the code with a save/restore pair, right around the DPSWritePostScript. You might try that. Where does the PS on the pasteboard come from? If it comes from the execution of copyPSCode:... method in some other method, then it is likely to contain some definitions that are there to make the printers happy. These definitions redefine some Display PostScript operators; thus, to assure that you don't destroy your environment too badly, and also to assure you don't have all these extra definitions occupying memory, you need the save/restore. Take a look at the Yap code (YapOutput.m). Ali Ozer, NeXT Developer Support aozer@NeXT.com