OL Learn

PDF split - remove new line chars during metadata extraction

I want to use workflow to split one big PDF into multiple separate documents using extracted text which contains document Id.

I extract text identifying the document using using Metatada Fields Management: region(?,0.01041,0.89583,0.72916,2.73958,KeepCase,NoTrim)

Unfortunately this text is spread over several lines:


and I cannot use it as a valid output PDF name.

How can I remove new line (ASCII 10) and “##” characters during / after metadata extraction?

A script will let you do that.
Something like this should get you going (you’ll have to adjust, according to your metadata structure):

var myMeta = new ActiveXObject("MetadataLib.MetaFile");

var myGroup = myMeta.Job().Group(0);
for(var myDocs = new Enumerator(myGroup); !myDocs.atEnd(); myDocs.moveNext()) {
    var myDoc = myDocs.item();
    var myField = myDoc.FieldByName("myField").replace(/##/g,"").replace(/\n/g," ");

The script removes the ## characters and replaces new line characters with a space.

Thank you very much.