Sie zeigen eine alte Version dieser Seite an. Zeigen Sie die aktuelle Version an.

Unterschiede anzeigen Seitenhistorie anzeigen

« Vorherige Version anzeigen Version 4 Aktuelle »

globe with meridians Language: Deutsch · English

open book FileProvider

Print, save and create NuclosFiles from byte arrays.

REFERENZ DEVELOPER UPDATED: JUL 2026 APPLIES TO NUCLOS 4.2026.X

On this page

What is the FileProvider for?

The FileProvider contains methods to process NuclosFiles – printing, saving on the server and converting.

Output formats

Only NuclosFiles in the output format File or Screen can be stored as attachments. For the printer the format (default) printer client/server is required – possibly two output formats per report/form.

print(file[, printername])

Sends the NuclosFile to the default or a named printer.

public static void print(NuclosFile file) throws BusinessException;
public static void print(NuclosFile file, String printername) throws BusinessException;

save(file, directory)

Saves the NuclosFile on the server in the given directory.

public static void save(NuclosFile file, String directory) throws BusinessException;
package org.nuclet.businessentity; 

import org.nuclet.printout.FormularAbschlussAuftragPO;
import org.nuclos.api.common.NuclosFile;
import org.nuclos.api.provider.PrintoutProvider;
import org.nuclos.api.provider.FileProvider;

public class AbschlussAuftragRegel implements InsertFinalRule {

   public void insertFinal(InsertContext context) throws BusinessException { 
        
		Auftrag a = context.getBusinessObject(Auftrag.class);
      	
		NuclosFile result = PrintoutProvider.run(FormularAbschlussAuftragPO.Deutsch_PDF, a.getId());
        
		// store file in FTP-Directory
		FileProvider.save(result, "/home/ftp/");
		// Print file on default printer
        FileProvider.print(result);
    }
}

Convert byte[] to NuclosFile

Use FileProvider.newFile(File) to turn a byte array into a NuclosFile:

public static NuclosFile writeArrayToNuclosFile(String filename, byte[] content) throws BusinessException {
    File file = null;
    try {
        file = new File(filename);
        FileUtils.writeByteArrayToFile(file, content);
        return FileProvider.newFile(file);
    } catch (IOException exception) {
        throw new BusinessException("Fehler beim Erzeugen der Datei " + file.getName() + ": " + exception.getMessage());
    }
}

Related pages

gear QueryProvider


Daten laden.

Open →

gear BusinessObjectProvider


BOs schreiben.

Open →

gear DatasourceProvider


run data sources.

Open →

  • Keine Stichwörter