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 3 of 3

Thread: problem with creating .pdf

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default problem with creating .pdf

    import java.io.*;
     
    public class PUdf{
    public static void main(String[] arguments){
    pdf1 v=new pdf1(arguments[0]);
    v.convert();
    }
    }
    class pdf1{
     
    String line;
    pdf1(String line)
    {
    this.line=line;
    }
    void convert()
    {
    try
    {
    int n=line.length();
    String line1=line.substring(0,n-4);
    FileOutputStream fil1=new FileOutputStream(line1+".pdf");
    FileInputStream fil=new FileInputStream(line);
    boolean eof=false;
    while(eof!=true)
    {
    int input=fil.read();
    if(input!=-1)
    fil1.write(input);
    else
    eof=true;
    }
    fil.close();
    fil1.close();
    }
    catch(FileNotFoundException f)
    {
    System.out.println("File Not Found");
    }
    catch(IOException ioe)
    {
    System.out.println("Error");
    }
    }
    }


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: problem with creating .pdf

    Do you have a question?

  3. #3
    Junior Member
    Join Date
    Jul 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: problem with creating .pdf

    The pdf produced by this code is corrupted .. How to solve this???
    Plzz help

Similar Threads

  1. Problem with the PDF file attachment subject
    By Tim84 in forum Java Theory & Questions
    Replies: 1
    Last Post: June 17th, 2013, 08:16 AM
  2. two constructor creating problem
    By shahrukh0603 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: June 15th, 2013, 06:20 AM
  3. Problem of retrieving pdf file from database using tomcat server
    By kalkumbenitin in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 26th, 2012, 06:16 AM
  4. display pdf file into jpanel problem
    By Jhovarie in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 12th, 2011, 03:29 PM

Tags for this Thread