Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java PDF and Text file  RSS feed

 
amal joy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello folks!

I'm new in here and I hope that I posted my question in the right place!
I'm working in pdf files and trying to compare them with a list in a txt file. I have the pdf files sorted (1-10) some of them include names,those names are already existed in the text file as well.

My concern is I would like to match/find out when the name in the text file matches the name in the pdf file! if they are equal then print out the name and the pdf file number.





PDF MANAGER CLASS:



READER CLASS


your help would be appreciated!


 
Liutauras Vilda
Marshal
Posts: 4649
318
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You described your task in a complicated way, so clarification is needed. That is why probably you haven't got any answers yet.

Please clarify if this is what you want:
  • read text file in which specific pdf filenames are listed
  • open directory where actual pdf files are located
  • look for each filename listed in text file for its existence in pdf files directory
  • in case pdf file is found - print its name and the pdf file number

  • amal joy wrote:I have the pdf files sorted (1-10) some of them include names
    What do you mean by "some of them include names"? Each file has to have name. Extension in theory could be omitted.

    And what are the issues you're running into? You haven't stated any. Please provide in details. Thank you.
     
    Campbell Ritchie
    Marshal
    Posts: 55751
    163
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Another thing: beware of calling your class Reader. You are using classes from the java.io package, and there already is a Reader class in that package, so there is a potential risk of confusion.
     
    Campbell Ritchie
    Marshal
    Posts: 55751
    163
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    There is something very confusing about your code. Why have you got a method called toText are why are you searching that String? Why don't you give the class methods like getFileName? Can you get two files with the same name in any directory?
     
    Knute Snortum
    Sheriff
    Posts: 4073
    112
    Chrome Eclipse IDE Java Postgres Database VI Editor
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I think the "names" are not file names but personal names. I think the task is to search a PDF for a name like "Knute." Something like Apache PDFBox would probably be helpful.
     
    Campbell Ritchie
    Marshal
    Posts: 55751
    163
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Knute Snortum wrote:I think the "names" are not file names . . .
    Aaaaaaaaaaaaaaaaaaaaaaaaah!
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!