in reply to tk canvas to postscript error
I've had a quick look into this this morning - the Tk::Canvas docs state that The Postscript is created in Encapsulated Postscript form using version 3.0 of the Document Structuring Conventions.
I'm going to (first) assume that the PostScript you've posted isn't all of your output (see later if it is). I've run your code snippets and I get some 311 lines, including a definition for a subroutine AdjustColor. If that's all your PostScript, then something is going critically wrong with your Canvas widget somewhere before the call to output the postscript. I've literally created a MainWindow, a Canvas, and used your call to output the .ps file.
Assuming that, and looking elsewhere for a problem, there are two different formats for postscript files: EPS, and EPSI. EPS (Encapsulated Postscript), which Tk::Canvas is outputting, is a PostScript file that describes a single, self-contained page. ESPI is similar to this, but includes a graphical preview such that systems that can't directly render PostScript can still represent the file.
According to the Ghostscript bug discussion forum (and other sources that go into this in more depth), an issue occurs with Ghostscript in that it can't correctly recognise an EPS file. Apparently it's possible to force it to display by changing the extension to .eps and (potentially) also using the -c showpage flag on the command line when loading Ghostscript. I'm not sure how far this goes to start explaining the error you're seeing, but I'm certain it wouldn't help matters at all.
This is now fixed in versions above 7.32 beta of Ghostscript.
A suggested fix, then, is to try saving the file with a .eps extension, perhaps using the -c showpage flag and seeing if that helps. That seems a small thing to me, and I'm not convinced it'll solve anything, but it can't hurt to try. Either that, or try a new(er) version of Ghostscript ...
If it's not safe to assume that you're getting a much larger .ps file out, I'd suggest that you try doing what I did - make sure you can get the larger file out (as I said, I get 311 lines from your call). Ensure that you're not accidentally overwriting anything in the file. You can then slowly factor back in all the original code until you reach a point where you're again getting the reduced file out - and at that point you're in a much better position to know where your problem lies.
If you can't get a larger file out at all, including a defintion of AdjustColor, among other things, I'd suggest that you perhaps have a bad installation of Tk::Canvas, and it might be worth looking deeper into that module.
Hope that helps some .. I know I've learnt something today :)
-- Foxcub
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: tk canvas to postscript error
by TooNewbie (Acolyte) on Dec 18, 2002 at 17:10 UTC |