4

I want to transfer pdf/zip file through mirh.

I am using file reader connector as source and file writer as destination connector.

can any one help me how to send/transfer pdf/zip file?

Rikin Patel
  • 8,848
  • 7
  • 70
  • 78

2 Answers2

7
  • Set Incoming data: Delimited text
  • File type: Binary
  • Outgoing filetype also has to be Binary, otherwise the data are corrupted.
  • Outgoing template has to be ${message.rawData}

see screen shot for more info.

Channel settings [summary]

enter image description here

Channel settings [Source]

enter image description here

Channel settings [Destination]

enter image description here

Rikin Patel
  • 8,848
  • 7
  • 70
  • 78
  • Does this work for .zip files. I have similar requirement. – Sid Apr 13 '16 at 11:19
  • It is not working for ZIP files. A zip file is generating without any files in it. If you guys find a solution for it pls let me know. I do have a similar requirement – Vibin Guevara Nov 15 '16 at 12:20
  • @Sid Just passed through this post once again. I achieved zip files by writing the JAVA code. https://hl7engine.wordpress.com/2017/11/27/how-to-create-zip-file-with-multiple-files-in-mirth/ – Vibin Guevara Feb 02 '18 at 13:20
0
var source = "D:/ftproot/PDF/Source";
var fileName = $('fieldId')+".pdf";
var srcpath=source +"\\"+ fileName
var directory = "D:/ftproot/PDF/Target" 
var outFileName = $('fieldId')+".pdf";
var destination = directory +"/" + outFileName

importPackage(java.io);
importPackage(org.apache.commons.io);
//var file = new java.io.File(directory);
var inputFile = new File(srcpath);
var outputFile = new File(destination);
FileUtils.copyFile(inputFile,outputFile);

For Transfer your PDF file from one location to another location .You don't need to bother about that.

Place the above code in your Destination trasfarmer .

The above code will pic the PDF file D:/ftproot/PDF/Source from this path and copied the PDF file in to the another mentioned location i.e D:/ftproot/PDF/Target .You can directly read the file in Mirth using

importPackage(java.io);
importPackage(org.apache.commons.io);

Copy the PDF file using

FileUtils.copyFile(inputFile,outputFile);
Suresh Gopineni
  • 139
  • 2
  • 6