Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8109671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:29:32+00:00 2026-06-06T01:29:32+00:00

Im working on a Java Application that edits Pdf files. Furthermore a shell script

  • 0

Im working on a Java Application that edits Pdf files. Furthermore a shell script with ghostscript is used to make an image of the Pdf and after that the image is read in the Java Application as a Buffered Image. Of course the creating of the image takes some time. It is possible to avoid to save the Image on hard disk? Instead I want to use a virtual place that exist only in the RAM. I tried to search for this, but Im not sure for what keyword Im looking for.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:29:34+00:00Added an answer on June 6, 2026 at 1:29 am

    You can make Ghostscript to output the image (not to a disk file, but) to stdout. Then you could make another program (or your Java application) to read from stdin.

    As a result it would be easy to connect both applications through a pipe. A pipe is surely a ‘virtual place that only exists in RAM’, and you do not need to create an extra virtual file system for this.

    Ghostscript syntax (Linux, Unix, MacOSX):

    gs \
      -q \
      -dBATCH \
      -dNOPAUSE \
      -sOutputFile=%stdout \
      -sDEVICE=tiffg4 \
      -r600 \
      -dLastPage=1 \
       input.pdf \
    | \
    identify - 
    

    This will surely avoid writing the output file to disk…

    However, your main concern seems to be that actual writing to disk of the output (and again reading from disk) would cost you too much valuable processing time.

    It could be the case that Ghostscript’s actual processing is much slower than writing of the results to disk. In this case your net win wouldn’t be that great if you avoided the disk I/O.

    The good news is that you can easily measure and benchmark the difference between both approaches ((1) write file to disk with Ghostscript first and then read file from disk again with 2nd application; (2) write file to pipe and read directly from pipe with 2nd application) with some of your typical PDF input:

    First, the ‘write to disk and read again from disk’ approach:

    time \
    (gs \
      -q \
      -dBATCH \
      -dNOPAUSE \
      -sOutputFile=1.tiff \
      -sDEVICE=tiffg4 \
      -r600 \
      -dLastPage=1 \
       input.pdf \
    && \
    identify 1.tiff) 
    

    My result for a sample PDF:

    real  0m1.231s
    user  0m1.188s
    sys   0m0.024s
    

    Second, the ‘connect both programs through a pipeline, avoiding disk I/O overhead’ approach:

    time \
    gs \
      -q \
      -dBATCH \
      -dNOPAUSE \
      -sOutputFile=%stdout \
      -sDEVICE=tiffg4 \
      -r600 \
      -dLastPage=1 \
       input.pdf \
    | \
    identify - 
    

    My result for the same sample PDF:

    real  0m1.459s
    user  0m1.422s
    sys   0m0.036s
    

    Third, measure the time your 2nd program needs to read and process file from disk:

    identify 1.tiff
    

    My result in this example:

    real  0m0.023s
    user  0m0.011s
    sys   0m0.006s
    

    Of course, your results for your samples could be very, very different. But doing (and repeating a number of times) such measurements is the only way to determine if ‘avoiding disk I/O’ in your case would lead to a performance gain that is worth while, and also how much gain can be expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am working on a Java application that requires me to display PDF documents within
I'm working on a Java application that uses JavaSpace. We're developing this in Eclipse.
I am working on a Java Web Application that exposes a web service. This
I am working on a Java UI application that uses JDBC. I assume the
I am working on a Java/Struts application that uses Tomcat 6.0.10. It's a typical
I'm working on an application that intersperses a bunch of jython and java code.
I'm currently working on a project that is building a java-based desktop application to
I'm working on application that takes files from one zip and put them in
I'm working on a small application in Java that takes a directory structure and
I am trying to silent print PDF files from within a java application (more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.