Split pdf further process and reports

Hi,

In my job/output presets. I split the pdfs based on pages.

This is loaded in the workflow, now is there a way to get details of each pdf splits?

For eg: The output produced 2 sets of pdf:

  • 1-6_pages.pdf
  • 6-plus_pages.pdf

Now I would like get number total pages of each record within each pdf stream.

In the end It would create 2 report files such as follows:

1-6_pages.rpt

ID, pages
cus1, 2
cus2, 5 

6-plus_pages.rpt

ID, pages
cus3, 7
cus4, 10 

Is this possible at all? Or at least a workaround without needing to split the data prior to processing.

Thanks
E

This has been resolved.

Using the rest API to get content sets , and getting pages information from it.

I’m glad to hear that.

Can you let us know please how you were able to achieve this? Were you for example able to achieve this by using the following URL?

<origin>/rest/serverengine/entity/contentsets/<contentSetId>/pages?detail=true

Source: ‘Get Page Details for Content Set - PReS Connect 2022.1 REST API Cookbook (link)’

Yes that is correct Marten.

Basically, gets the contentSets that got created by the Create print content task. Loops through them and query the API after the results comes back , you do what you need to do in the handler function.

var  metaFile = new ActiveXObject("MetadataLib.MetaFile");
metaFile.LoadFromFile (Watch.GetMetadataFilename());
var metaJob = metaFile.Job();

// TODO handle multiple content sets
for (var idx1=0; idx1 < metaJob.Count; idx1++) {
   metaGroup = metaJob.Group(idx1);
   Watch.log(idx1.toString(),3);
   var contentsetid = metaGroup.FieldByName("_vger_contentset_id");

   // Get Data Records for Data Set
   var xhttp = new ActiveXObject("Microsoft.XMLHTTP");
   var url = Watch.GetVariable("global.rest_base_url") + "/entity/contentsets/" + contentsetid + "/pages?detail=true";
   Watch.log(url,3);
   xhttp.open('GET',url,false);
   xhttp.setRequestHeader('Content-Type', 'application/json');
   xhttp.setRequestHeader("Authorization", Watch.GetVariable("global.rest_auth_string"));
   xhttp.onreadystatechange = handlerGetDataRecord;
   xhttp.send();

   // Save the metadata back to file
   metaFile.SaveToFile (Watch.GetMetadataFilename());

}

function handlerGetDataRecord(){
      ... json.responseText
      .., do something here loop each contentitem
}

Hi @edanting, thank you for sharing your solution. I am glad to hear that you were able to solve your question.

1 Like