DSpace-Labs / SAFBuilder

Builds a Simple Archive Format package from files and a spreadsheet
https://wiki.duraspace.org/display/DSPACE/Simple+Archive+Format+Packager
45 stars 35 forks source link

Rename files to end in .pdf, to make it clear they are files #19

Closed peterdietz closed 5 years ago

peterdietz commented 5 years ago

I think it looks a bit awkward for the sample CSV to not have filenames with file format endings, so I added .pdf to each file, and then regenerated new PDF's to match each filename.

Previously it was:

filename dc.title
Alabama Alabama
Alaska Alaska

And now it is Alabama.pdf, Alaska.pdf, ...

Screen Shot 2019-03-12 at 12 55 49 AM

Here's the little python script I ran to generate a new PDF for each row, with contents of each PDF to say the state name. It's unimportant, but I'll leave it here.

from fpdf import FPDF
import pandas as pd

df = pd.read_csv('AAA_batch-metadata.csv')
for index,row in df.iterrows():
  name=row[1]
  pdf = FPDF()
  pdf.add_page()
  pdf.set_xy(0,0)
  pdf.set_font('arial', 'B', 13.0)
  print(name)
  pdf.cell(ln=0,  h=5.0,  align='L', w=0, txt=name, border=0)
  pdf.output(name+'.pdf',  'F')