The 'function get_title_auto_from_pdf' is splited into 2 functions
"pdf2text" and "get_title_auto_from_text".

-----------------------------------------
There is different function to create text from the pdf and
other to get doi from this text.

pdf2text will be use to search the pdf file line by line so it
was necessary to create own function.
Bugfix: return code equals 0.

--------------------------------
remove, does not work
install, works

magnus@maximus:~/Dropbox/workspace/pubmexproject/pubmex$ remove poppler-utils
[sudo] password for magnus:
Reading package lists... Done
Building dependency tree

magnus@maximus:~/Dropbox/workspace/pubmexproject/pubmex$ pubmex.py
DEBUG - temp generated
Please, install pdftotext! Pdftotext is a part of the proper-utils package.
For debian-based linux systems run 'sudo apt-get install poppler-utils' and start pubmex again. Good luck!

install install poppler-utils

magnus@maximus:~/Dropbox/workspace/pubmexproject/pubmex$ pubmex.py
DEBUG - temp generated
{'keywords': None, 'rename': False, 'automatic': None, 'PMID_or_DOI': None, 'filename': None}
Usage: pubmex.py [options] id
Add simple rude test bash script.

----------------------------------
magnus@maximus:~/Dropbox/workspace/pubmexproject/pubmex$ ./test.sh
# get a title based on PMID
python pubmex.py -p 20533529
DEBUG - temp generated
[..]
# get data based on a given pdf file, show a new new, DO rename
pubmex.py -a -f demo/demo01.pdf -r
DEBUG - temp generated
{'keywords': None, 'rename': True, 'automatic': True, 'PMID_or_DOI': None, 'filename': 'demo/demo01.pdf'}
FILENAME:	demo/demo01.pdf
temp is going to be opened
10.1016/J.CEB.2009.01.022
IdList ['19223165']
PMID: 19223165
TITLE: 		Russel.Sali-The.structural.dynamics.macromolecular.processes-CurrOpinCellBiol.2009.pdf
RENAME:		demo/demo01.pdf -*DO*-> demo/done/Russel.Sali-The.structural.dynamics.macromolecular.processes-CurrOpinCellBiol.2009.pdf

revert the demo folder ...

`demo/done/Russel.Sali-The.structural.dynamics.macromolecular.processes-CurrOpinCellBiol.2009.pdf' -> `demo/demo01.pdf'
Minor edits: delete unused variables.

----------------------------------
hmm.. its simple, noting here complex
in progress... do amend!
It looks it can be 99 (netbook, debian) or 0 (maximus, ubuntu).
Bugfix: wrong <tab><tab>.
Add -d option. Global variable DEBUG is removed. Verboses are removed.

------------------------------------------
If you want to get debug msg use -d options. There is not DEBUG global
variable anymore. Verboses are replace with debugs.
The output can be customize with LJUST, LJUST_SPACER.
Minor edit of output msg to a user.

---------------------------------
# get data based on a given pdf file, show a new new, DO NOT rename
python pubmex.py -a -f demo/demo01.pdf
the title is ...  Russel.Sali-The.structural.dynamics.macromolecular.processes-CurrOpinCellBiol.2009.pdf
CAUTION! THE FILE WAS NOT RENAME, ADD -r OPTION TO RENAME THE FILE. IF YOU USE -r THE PUBMEX WILL DO
mv demo/demo01.pdf --> demo/done/Russel.Sali-The.structural.dynamics.macromolecular.processes-CurrOpinCellBiol.2009.pdf

# get data based on a given pdf file, show a new new, DO rename
pubmex.py -a -f demo/demo01.pdf -r
the title is ...  Russel.Sali-The.structural.dynamics.macromolecular.processes-CurrOpinCellBiol.2009.pdf
mv  demo/demo01.pdf --> demo/done/Russel.Sali-The.structural.dynamics.macromolecular.processes-CurrOpinCellBiol.2009.pdf
Minor edit: TODO changed to 'experimental'.
You can slightly customize a title.

---------------------------------------
before:

Kosinski.Plotz-Identification.Lynch.syndrome.mutations.MLH1-PMS2.interface.that.disturb.dimerization.mismatch.repair-HumMutat.2010.pdf

after:

Kosinski.Plotz.Identification.Lynch.syndrome.mutations.MLH1-PMS2.interface.that.disturb.dimerization.mismatch.repair.HumMutat.2010.pdf
Rename examples to examples-test. Remove test-qu*.sh

----------------------------------
It was not consisted with DRY rule. The code from examples was
duplicated in test-qu*.sh.

To test app run examples-test.sh

magnus@netbook:~/Dropbox/workspace/pubmexproject/pubmex$ ./examples-test.sh
# get a title based on PMID
python pubmex.py -p 20533529
Kosinski.Plotz.Identification.Lynch.syndrome.mutations.MLH1-PMS2.interface.that.disturb.dimerization.mismatch.repair.HumMutat.2010.pdf

# get data based on PMID, change a title to keywords
'python pubmex.py -p 20533529 -k MLH1,PMS2'
Kosinski.Plotz.MLH1.PMS2.HumMutat.2010.pdf

# get data based on PMID, change a title to keywords + debug info
'python pubmex.py -d -p 20533529 -k MLH1,PMS2'
debug:.............. on
options: ........... {'rename': False, 'filename': None, 'debug': True, 'PMID_or_DOI': '20533529', 'keywords': 'MLH1,PMS2', 'automatic': None}
arguments: ......... []
summary_dict........ {'DOI': '10.1002/humu.21301', 'Title': 'Identification of Lynch syndrome mutations in the MLH1-PMS2 interface that disturb dimerization and mismatch repair.', 'Source': 'Hum Mutat', 'PmcRefCount': 1, 'Issue': '8', 'SO': '2010 Aug;31(8):975-82', 'ISSN': '1059-7794', 'Volume': '31', 'FullJournalName': 'Human mutation', 'RecordStatus': 'PubMed - indexed for MEDLINE', 'ESSN': '1098-1004', 'ELocationID': '', 'Pages': '975-82', 'PubStatus': 'ppublish', 'AuthorList': ['Kosinski J', 'Hinrichsen I', 'Bujnicki JM', 'Friedhoff P', 'Plotz G'], 'EPubDate': '', 'PubDate': '2010 Aug', 'NlmUniqueID': '9215429', 'LastAuthor': 'Plotz G', 'ArticleIds': {'medline': [], 'mid': 'NIHMS212166', 'pubmed': ['20533529'], 'eid': '20533529', 'pmc': 'PMC2908215', 'rid': '20533529', 'pmcid': 'pmc-id: PMC2908215;manuscript-id: NIHMS212166;', 'doi': '10.1002/humu.21301'}, u'Item': [], 'History': {'medline': ['2010/10/21 06:00'], 'pubmed': ['2010/06/10 06:00'], 'entrez': '2010/06/10 06:00'}, 'LangList': ['English'], 'HasAbstract': 1, 'References': [], 'PubTypeList': ['Journal Article'], u'Id': '20533529'}
Kosinski.Plotz.MLH1.PMS2.HumMutat.2010.pdf

# get data based on DOI
python pubmex.py -p 10.1038/embor.2008.212
Kelley.Scott.The.evolution.biology.shift.towards.engineering.prediction-generating.tools.away.traditional.research.practice.EMBORep.2008.pdf

# get data based on a given pdf file, show a new new, DO NOT rename
python pubmex.py -a -f demo/demo01.pdf
the title is ...  Russel.Sali.The.structural.dynamics.macromolecular.processes.CurrOpinCellBiol.2009.pdf
CAUTION! THE FILE WAS NOT RENAME, ADD -r OPTION TO RENAME THE FILE. IF YOU USE -r THE PUBMEX WILL DO
mv demo/demo01.pdf --> demo/done/Russel.Sali.The.structural.dynamics.macromolecular.processes.CurrOpinCellBiol.2009.pdf

# get data based on a given pdf file, show a new new, DO rename
pubmex.py -a -f demo/demo01.pdf -r
the title is ...  Russel.Sali.The.structural.dynamics.macromolecular.processes.CurrOpinCellBiol.2009.pdf
mv  demo/demo01.pdf --> demo/done/Russel.Sali.The.structural.dynamics.macromolecular.processes.CurrOpinCellBiol.2009.pdf