Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 13th, 2020, 12:02 PM
mjlongo mjlongo is offline
Junior Community Member
 
Join Date: Jul 2013
Location: Rochester NY
Posts: 43
Default Output a reference text file along with the PDF

Hello,


We have a need to be able to create a reference csv file that would be output preferably at the same time our FusionPro file composed. Can this be done?

We would be creating a final PDF with anywhere from as little as 200 to as many as over 200,000 single page files whereby each page would contain data related to a UserID. Our mailing/inserting equipment sources this PDF for printing data inline as it inserts items into envelopes, etc. We need a "lookup" csv file that would state that UserID is page XX in the PDF. As the mailing/inserting machine is running it would then know that when it scanned the barcode for a UserID, the lookup file would tell the machine that it has to print page XX of the PDF.

Any assistance would be appreciated.

Thanks!
-Mike
Reply With Quote
  #2  
Old April 13th, 2020, 12:11 PM
mjlongo mjlongo is offline
Junior Community Member
 
Join Date: Jul 2013
Location: Rochester NY
Posts: 43
Default Re: Output a reference text file along with the PDF

I just wanted to follow-up that yes, we can create something that works with how the data was initially read into FusionPro but we want more of an assurance that page numbers are in sync with the user. We cannot afford any missed pages, etc.
Thanks!
Reply With Quote
  #3  
Old April 13th, 2020, 02:24 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,504
Default Re: Output a reference text file along with the PDF

There's no capability to output a CSV file. However, you can output an XML log file which has information about each output record, the number of pages in it, and any arbitrary data you want.

In OnJobStart, just call FusionPro.Composition.CreateXMLLogFile(). This will create an XML file for the job. You can specify a file name if you want; if not, ".xml" is appended to the main log file name. (In a FusionPro Server job, you can set the CFG file setting "XMLLogFile".)

In OnRecordStart, you can call FusionPro.Composition.LogXMLMetadata() with a key and a value, something like this:
Code:
FusionPro.Composition.LogXMLMetadata("UserID", Field("UserID"));
And the data will appear for each record in the XML file.

That said, it's my understanding that, instead of generating a secondary output file, the usual way to track printed pages in a job like this is to put a barcode on each page, encoding something like "Record X, Page Y of Z". You probably want the UserID instead of the record number.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #4  
Old April 13th, 2020, 03:01 PM
mjlongo mjlongo is offline
Junior Community Member
 
Join Date: Jul 2013
Location: Rochester NY
Posts: 43
Default Re: Output a reference text file along with the PDF

Dan,
I had forgotten about the XML file and got it working fine for the UserID. The XML solution would work fine for us as we could re-format the XML into a simple csv file.

However, I cannot seem to log the page number of the job. I'm sure my issue is nothing more than using the proper command. I tried this within the OnRecordStart:




Code:
var pgnum = FusionPro.Composition.currentPageNumber;

FusionPro.Composition.LogXMLMetadata('MPID',Field("MPID")); //WORKS
FusionPro.Composition.LogXMLMetadata('PageNum',pgnum); //DOESNT WORK
Reply With Quote
  #5  
Old April 13th, 2020, 03:33 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,504
Default Re: Output a reference text file along with the PDF

Quote:
Originally Posted by mjlongo View Post
I had forgotten about the XML file and got it working fine for the UserID. The XML solution would work fine for us as we could re-format the XML into a simple csv file.
That sounds like a good solution.
Quote:
Originally Posted by mjlongo View Post
However, I cannot seem to log the page number of the job. I'm sure my issue is nothing more than using the proper command.
Yeah, that's because the logging is per-record, not per-page.

But since you have one page per record, you could also just output the record number:
Code:
FusionPro.Composition.LogXMLMetadata('PageNum', FusionPro.Composition.outputRecordNumber);
Or, you could just keep a counter when you're parsing the XML and write out that number to each line in the CSV.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #6  
Old April 13th, 2020, 04:50 PM
mjlongo mjlongo is offline
Junior Community Member
 
Join Date: Jul 2013
Location: Rochester NY
Posts: 43
Default Re: Output a reference text file along with the PDF

Awesome! Thanks Dan.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:25 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.