Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: java component to generate the report file in post script format

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java component to generate the report file in post script format

    We have migrated the Application from Solaris to Linux,We would print the file from application by executing the below command.
    Example: lp -d 10.220.230.80:MB000155 -c /usr/bin/prc_Test2.prc
    From java end, we are exporting the print file in pcl format and while calling the print command, solaris convert the file from pcl to post script format before sending it to print server. now problem is linux did not convert the file. So Application unable to print the file successfully.

    We would like to export the print file as post script format from application to get the print functionality works. Please let us know the possiblity in java end.

    or is there any command in linux with above required property.

    regards,
    siva


  2. #2
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: java component to generate the report file in post script format

    I have no experience with any Java packages that make it "easy" to write PostScript files from Java applications. How "easy" it is would depend on what kind of files are being created by the application. Text files with different font faces and sizes? Some adornment (lines, etc.)? Graphics figures? Embedded graphics files? What?

    I'm a little curious:
    What kind of package (if any) was used to make it "easy" to write pcl files? What was its API? Knowing that might make it easier to find a functional replacement for creating PostScript or PDF files. If it was all raw, brute-force PCL-specific stuff embedded in the application, well, I can't think of any way to help.

    However...
    As a non-Java solution, similar to your previous method, you could try GhostPDL from here GhostScript GhostPDL Download page

    I used it for a project that had a lot of PCL5 files and I needed something viewable and printable on my Centos Linux workstation. Using that program to convert pcl to pdf worked (most of the time). Did not have access to source to see how the original project actually created the pcl files. (It wasn't Java.)

    Building the executable was a snap ("./configure" followed by "make") with GNU gcc version 4.1.2. Never had to touch any of the C source files.

    There were a couple of flaky pcl files that, for some reason, created pdf files that could be viewed with Adobe acroread, but wouldn't print. (All of them that I had would print OK from kGhostView. Go figure.) Files had various graphics shapes and adornments as well as almost-chaotic fontamonium and color and stuff like that.

    There are scripts supplied in the "tools" directory so that the conversion from pcl to pdf is easy to automate, and there is a Java-based viewer, Gview, under the tools/viewer directory for rendering a pcl file to the screen without having to convert. (You can print from Gview if you want to, rather than converting to pdf and viewing and/or printing the pdf file.)


    Cheers!

    Z
    Last edited by Zaphod_b; October 26th, 2012 at 08:24 AM.

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java component to generate the report file in post script format

    Hi,

    Thanks for you comments,

    We are using root-river.jar(Licensed jar) for create the .pcl file as PCL5 format.

    Issue: After migrate the application from SOLARIS, WAS4 to Linux, WASCE server, Application is not print the file.

    we are executing the lp command through application in Linux for printing the file. have raised this printing issue to support team for investigation, Also find the support team commands below,

    Application exports its file in a PCL format for printing. This needs to be converted to PS before being sent to a printer. lp on Solaris converts the format transparently just before sending the file to the printer.

    In Linux : lp -d 10.220.230.80:MB000155 -c prc7686.pcl
    lp: unable to print file: server-error-service-unavailable

    The easiest way should be, from an sys-admin point of view, that application export files directly in PostScript format. This way allows us to easily set up a system allowing to print exactly as the users were used to on Solaris.

    As you said we have one more solution by using the GhostPDL(Non java). Please let me know(step to do) how to implement it our application.


    Quote Originally Posted by Zaphod_b View Post
    I have no experience with any Java packages that make it "easy" to write PostScript files from Java applications. How "easy" it is would depend on what kind of files are being created by the application. Text files with different font faces and sizes? Some adornment (lines, etc.)? Graphics figures? Embedded graphics files? What?

    I'm a little curious:
    What kind of package (if any) was used to make it "easy" to write pcl files? What was its API? Knowing that might make it easier to find a functional replacement for creating PostScript or PDF files. If it was all raw, brute-force PCL-specific stuff embedded in the application, well, I can't think of any way to help.

    However...
    As a non-Java solution, similar to your previous method, you could try GhostPDL from here GhostScript GhostPDL Download page

    I used it for a project that had a lot of PCL5 files and I needed something viewable and printable on my Centos Linux workstation. Using that program to convert pcl to pdf worked (most of the time). Did not have access to source to see how the original project actually created the pcl files. (It wasn't Java.)

    Building the executable was a snap ("./configure" followed by "make") with GNU gcc version 4.1.2. Never had to touch any of the C source files.

    There were a couple of flaky pcl files that, for some reason, created pdf files that could be viewed with Adobe acroread, but wouldn't print. (All of them that I had would print OK from kGhostView. Go figure.) Files had various graphics shapes and adornments as well as almost-chaotic fontamonium and color and stuff like that.

    There are scripts supplied in the "tools" directory so that the conversion from pcl to pdf is easy to automate, and there is a Java-based viewer, Gview, under the tools/viewer directory for rendering a pcl file to the screen without having to convert. (You can print from Gview if you want to, rather than converting to pdf and viewing and/or printing the pdf file.)


    Cheers!

    Z
    Last edited by siva.wins; November 1st, 2012 at 06:53 AM.

  4. #4
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: java component to generate the report file in post script format

    Quote Originally Posted by siva.wins View Post
    ...using the GhostPDL(Non java). Please let me know(step to do) how to implement it our application.
    Assuming you have a .pcl file from somewhere:

    Get things into a state that you can convert and print from a command line. Here's what I did with my Centos 5.8 Linux system with a "normal" CUPs network printer installation for my color LaserJet printer:

    Download untar and build ghostpdl from the link that I gave you. For this report I used ghostpdl-9.06.tar.gz.


    From the download directory, I executed

    tar zxvf ghostpdl-9.06.tar.gz
    cd ghostpdl-9.06
    ./configure 2>& 1 | tee configure.log
    make 2>& 1 | tee make.log
    sudo make install 2>& 1 | tee make_install.log


    If there are problems with any of these steps, get your System Administrator to help. For example if you don't have sudo or if you don't have su privileges, you can install pcl6 somewhere other than the default /usr/local/bin by using command-line options for the configure script. Or you can get someone with su privileges to do the "make install" thing. Stuff like that.

    Anyhow...

    At this point I have a program named pcl6 in /usr/local/bin.

    If you are still with me, and assuming that /usr/local/bin is on your $PATH, you can test converting on a command line like this:

    In the ghostpdl-9.06/tools directory there are some pcl files that you can use for testing.

    So...

    From the ghostpdl-9.06 directory:

    cd tools
    pcl6 -sDEVICE=pswrite -oowl.ps owl.pcl


    This creates owl.ps in that directory by converting owl.pcl in that directory

    Print it the way you print any PostScript file on your system. For mine it's just

    lp owl.ps


    Taa-daa!

    You could make a special script (named, perhaps, lppcl) that invokes pcl6 to do the conversion relatively painlessly and then prints the PostScript file. Or some such thing.

    Now, from a Java program that creates a pcl file, you can add code that uses the exec() method of the Java Runtime class to use pcl6 to convert the generated .pcl file to .ps. (I would probably make a simple shell script similar to the pcl2pdf script in the tools directory and invoke that from the Java program.)

    Whatever...


    Bottom line: IWFMYMMV! (It Works For Me; Your Mileage May Vary!)



    Cheers!

    Z

  5. #5
    Junior Member
    Join Date
    Oct 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java component to generate the report file in post script format

    Hi

    Thanks a lot. Now we have resolved this issue with help of your input.

Similar Threads

  1. Replies: 1
    Last Post: June 26th, 2012, 12:04 AM
  2. modification to core java file: javax.script.AbstractScriptEngine
    By amughost in forum Java Theory & Questions
    Replies: 0
    Last Post: June 13th, 2012, 11:37 AM
  3. Replies: 0
    Last Post: May 8th, 2012, 10:51 PM
  4. How to up load java file when you post??
    By zhen1606 in forum Collections and Generics
    Replies: 1
    Last Post: February 23rd, 2012, 08:12 AM
  5. How to generate 13 digit numbers to text file
    By duanedtp in forum Java Theory & Questions
    Replies: 3
    Last Post: April 27th, 2011, 11:30 AM