Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

Commit

Permalink
PDF conversion fix && printer select screen fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
nleven committed Dec 13, 2012
1 parent 876f5d2 commit daef3f9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
26 changes: 17 additions & 9 deletions src/com/engineering/printer/PrintCaller.java
Expand Up @@ -58,23 +58,31 @@ public List<String> getPrinters() throws IOException {
}

public void printFile(PrintJobInfo printJob) throws IOException {
//Prepare files for lpr command, convert if necessary
String doc_lpr = printJob.getRemoteFilename();
boolean converted_to_pdf = false;
if(printJob.getDocument().IsMicrosoft())
{
runCommand("libreoffice --headless --invisible --convert-to pdf \"" + printJob.getRemoteFilename() +"\" --outdir=~");
doc_lpr = printJob.getRemoteFilename() + ".pdf";
converted_to_pdf = true;
}
if (printJob.getOptions().isTimed()){
ArrayList<String> jobs = getTimedPrintCommand(printJob);
for (int i=0;i<jobs.size();i++){
runCommand(jobs.get(i) + " \"" + printJob.getRemoteFilename() + "\"");
runCommand(jobs.get(i) + " \"" + doc_lpr + "\"");
}

}
else {
String printCommand = getPrintCommand(printJob);

//Print document
if (printJob.getDocument().IsMicrosoft()) {
runCommand("unoconv --stdout \"" + printJob.getRemoteFilename() + "\" | " + printCommand);
}
else {
runCommand(printCommand + " \"" + printJob.getRemoteFilename() + "\"");
}
runCommand(printCommand + " \"" + doc_lpr + "\"");
}

//Cleanup temporary files.
if(converted_to_pdf)
{
runCommand("rm \"" + doc_lpr + "\"");
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/com/engineering/printer/PrinterSelectScreen.java
Expand Up @@ -196,9 +196,10 @@ && getIntent().getExtras().containsKey(
//Put local document into history
if(!mDocument.isRemote())
{
HistoryManager history = new HistoryManager(this, "SEASPrintHistory", "FileHistory", 7);
Uri uri = mDocument.getUri();
if(uri != null)
printerHistory.putHistory(uri.toString());
history.putHistory(uri.toString());
}

// Set file display name
Expand Down
2 changes: 1 addition & 1 deletion src/com/engineering/printer/SourceSelectScreen.java
Expand Up @@ -113,7 +113,7 @@ public void onCreate(Bundle savedInstanceState) {
public void onStart()
{
super.onStart();
HistoryManager history = new HistoryManager(this, "SEASPrintHistory", "PrintHistory", 7);
HistoryManager history = new HistoryManager(this, "SEASPrintHistory", "FileHistory", 7);
this.history_items = history.getHistory();
history_entries.clear();
if(history_items.isEmpty())
Expand Down

0 comments on commit daef3f9

Please sign in to comment.