Well, Im having a PDF generated in and android application, but I need the title to have the date and time of the system. So I compiled this code:
public void createPDF()
{
Document doc = new Document();
try {
Date date = new Date();
String dateTime = DateFormat.getDateTimeInstance().format(date);
File sdCard = Environment.getExternalStorageDirectory();
File dir = new File (sdCard.getAbsolutePath() + "/Bitacora");
dir.mkdirs();
File file = new File(dir, "Bitácora "+idetotrocliente.getText().toString()+", "+dateTime+vwfecha1.getText().toString()+etsitio.getText().toString()+".pdf");
FileOutputStream fOut = new FileOutputStream(file);
But when I try to generate the PDF in the app, the log gives me this error:
08-28 21:32:38.950: E/PDFCreator(12425): ioException:java.io.FileNotFoundException: /mnt/sdcard/Bitacora/Bitácora ¡VALOR NECESARIO!, ago 28, 2013 9:32:24 p.m..pdf (Invalid argument)
And when I delete the "dateTime" variable, the PDF generates correctly, but I need the date to be in the title. What can I do? :(