Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem trying to create a Postscript File  RSS feed

 
kartik krishnan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am trying to create a Post script file having a valid content that a Postscript viewer software can show. But the file that I create is never show or the program does not load with the required data. I am writing to a File using a FileOutputStream. I would be grateful for any help.

Thanks,

Karthik

 
Urs Waefler
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure if you understand this line properly:

File file = File.createTempFile("test", ".ps");

I replaced it like that:

File file = new File("test.ps");

Your code does never create an object, I have the feeling. Maybe that could be the reason, you do not get a file saved on your machine.

I tried my code, I got a file, it is saved on my machine.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Urs Waefler:
I am not sure if you understand this line properly:

File file = File.createTempFile("test", ".ps");

I replaced it like that:

File file = new File("test.ps");

Your code does never create an object, I have the feeling. Maybe that could be the reason, you do not get a file saved on your machine.

I tried my code, I got a file, it is saved on my machine.


Well that method creates the file in the temp directory that is /tmp or /var/tmp in Unix based systems. I am sure that the Java program does not have a problem but it is the file that is written is not appropriate either syntax wise or some other data is missing.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As pointed out above, temp files can be deleted at any time. Try creating the file in a more permanent location.

On an unrelated matter, using a StringBuffer doesn't do any good if you then use a long succession of string concatenations in its append parameter.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!