• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Problem trying to create a Postscript File

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic