Go Back   PTI Marketing Technologies User Community > Software-Related Talk > The JavaScript Library > Barcodes

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 1st, 2018, 03:10 PM
Mike Edwards Mike Edwards is offline
Forum n00b
 
Join Date: Mar 2018
Location: Des Moines, IA
Posts: 7
Default datamatrix help

Hi, everybody! First time posting. I've got a problem in getting a properly-formatted Datamatrix barcode to print for use with our intelligent inserter. It has to be of the format X999999SSTT where XX is a string, 999999 is a zero-padded sequence number, SS is a zero-padded number representing the current sheet, and TT is a zero-padded number representing the total sheets being inserted. Here is the code I came up with:

Code:
{
// Rule converted from XML Template "DataMatrix Barcode Rule":
/* The goal here is to generate the proper Datamatrix 2D barcode
 * using the established pattern for our Rival inserter.
 * FusionPro does not have the notion of simplex/duplex, so we
 * have to state up front what that is.
*/
// Choose the following values:
var JobIDseq	    = "INSCODE"; // Standard EDWARDS field name
var TotalSheets	    = "SHEETS"; // Standard EDWARDS field name
var Sides	    = "Simplex"; // Use Duplex here for duplex jobs. Mixed modes are not supported. :p
var EncodingMode    = "ASCII"; 
var PreferredFormat = "0"; 
var PointSize	    = 6; // "Font size (defaults to 10)": SingleLine
var NoFontTag	    = false; 
var Font	    = "IDAutomationDMatrix"; 
var ProcessTilde    = false;

var TotSheets	    = FormatNumber( "00", FieldOrRule( TotalSheets ) );

// For simplex jobs, the current sheet is simply the page number.
// For duplex jobs, we have to do some basic math.
var CurrSheet	    = Sides == "Simplex"
		    ? FormatNumber( "00", FusionPro.Composition.currentPageNumber )
		    : FormatNumber( "00", Math.ceil( FusionPro.Composition.currentPageNumber / 2 ) )
		    ;

var DataToEncode = FieldOrRule( JobIDseq ) + CurrSheet + TotSheets;
return MakeDataMatrixBarcode(
    DataToEncode, 
    ProcessTilde, 
    EncodingMode, 
    PreferredFormat, 
    PointSize, 
    NoFontTag, 
    Font
    );
}
Everything seems to work except for assigning CurrSheet. It appears that FusionPro.Composition.currentPageNumber is not returning the correct value. Either that or I'm using FormatNumber wrong.
Reply With Quote
  #2  
Old June 4th, 2018, 10:11 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,225
Default Re: datamatrix help

The FusionPro.Composition.currentPageNumber property returns the page number in the record, so if each record is outputting one or two pages, it will always be page one or two, in every record. You can use FusionPro.Composition.pageNumberInJob instead. But in an imposed job, you probably want FusionPro.Composition.impositionSheetNumber. The FusionPro.Composition.impositionSheetIsBack property may be useful as well.
__________________
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
  #3  
Old June 4th, 2018, 10:50 AM
Mike Edwards Mike Edwards is offline
Forum n00b
 
Join Date: Mar 2018
Location: Des Moines, IA
Posts: 7
Default Re: datamatrix help

Yes, I get that, and it's what I expect, but this code is returning "00" for CurrSheet in every instance. I was hoping someone could tell me if my syntax is wrong or what the problem might be.
Reply With Quote
  #4  
Old June 4th, 2018, 02:30 PM
Mike Edwards Mike Edwards is offline
Forum n00b
 
Join Date: Mar 2018
Location: Des Moines, IA
Posts: 7
Default Re: datamatrix help

Further testing shows that although when I run Validate during rule construction I get the correct value, when the job previews or is composed, it still shows "00" every time. Am I not understanding how this is supposed to work, or is there a bug?
Reply With Quote
  #5  
Old June 4th, 2018, 06:28 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,225
Default Re: datamatrix help

Quote:
Originally Posted by Mike Edwards View Post
Yes, I get that, and it's what I expect, but this code is returning "00" for CurrSheet in every instance. I was hoping someone could tell me if my syntax is wrong or what the problem might be.
Yes, "this" code, as in the only code you've posted so far, won't work.

Did you try using FusionPro.Composition.impositionSheetNumber instead, as I recommended?

Posting the template would probably be helpful than more rounds of back-and-forth like this.
Quote:
Originally Posted by Mike Edwards View Post
Further testing shows that although when I run Validate during rule construction I get the correct value
I don't see how you could possibly know that. First of all, there's no actual page or sheet number at rule validation time; it's just a rule, with no context of where you might be when actually composing.

Second, if you validate the rule you've posted, all you will get are some markup tags that make a DataMatrix barcode, which look something like this:
Code:
<f name="IDAutomationDMatrix"><z newsize="10"><leading newsize="100">AIHPDOCIHK<br>AEMONMCLLK<br>DLLDDDLDLL<br>
How do you know at validation time whether that's the correct value?
Quote:
Originally Posted by Mike Edwards View Post
when the job previews
Preview is a completely invalid test here as well, since you're not imposing the output, you're just previewing a single record, one-up.
Quote:
Originally Posted by Mike Edwards View Post
or is composed, it still shows "00" every time.
Again, how does it "show" this? Are you scanning the barcode? With what scanning device and software?

Perhaps posting a picture of the barcode would give me some idea of what you're talking about. Though as I said, the template would be better.
Quote:
Originally Posted by Mike Edwards View Post
Am I not understanding how this is supposed to work, or is there a bug?
We're not understanding each other, at least.

I'm trying to help. But I don't have your data, or the rest of your template. I don't know what you're seeing in the output, or how you're analyzing it. I can only look at the code you've posted and try to guess as to what's wrong. Please post the template so I can fully analyze the issue.
__________________
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)});

Last edited by Dan Korn; June 7th, 2018 at 11:35 AM..
Reply With Quote
  #6  
Old June 4th, 2018, 06:44 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,225
Default Re: datamatrix help

I think this will work:
Code:
var TotSheets = FormatNumber( "00", FusionPro.Composition.impositionTotalSheets );
var CurrSheet = FormatNumber( "00", FusionPro.Composition.impositionSheetNumber );
But you have to actually be making imposed output, not non-imposed output, and not a Preview, and validating the rule in the editor won't do you any good either.

Again, I don't have your job files, so I can't test this for you in the context of your job. But I do know that those properties work in the sample job posted here:
http://forums.pti.com/showpost.php?p=11530&postcount=3
That sample also shows how to put per-sheet post-press control barcodes and other such information on the imposed sheet, outside the area of the imposed page contents, which is probably what you want to do for your inserter anyway.
__________________
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
  #7  
Old June 5th, 2018, 07:22 AM
Mike Edwards Mike Edwards is offline
Forum n00b
 
Join Date: Mar 2018
Location: Des Moines, IA
Posts: 7
Default Re: datamatrix help

My apologies. I guess I wasn't being clear. There is no imposition on this job. Each record gets 6 letter-size pages duplexed on 3 sheets of paper as output. For our inserter equipment to properly read the barcode, a portion of the barcode must read 0103, 0203, and 0303 (sheet 1 of 3, 2 of 3, and 3 of 3). This tells the inserter when it is done with one record and can fold and insert, and move on to the next set. However, this code produces 0003 for every page. We checked it with a barcode scanning app known to work. It scans just fine, but the value returned is not what we need.

As a test of what currentPageNumber returns, I made a simple rule and inserted it into the cellphone.pdf tutorial piece:
Code:
var CurrPage = FusionPro.Composition.currentPageNumber;
return CurrPage;
When I click validate on that rule, it shows "1". When I preview it and when I compose it, it shows "0". It seems to me that it isn't returning what I think it should be.

I am new to these forums and am hesitant to post customer data and/or art in this public space. However, we did send it to Alex at Marcom support on Friday, but his response was word-for-word the same as your initial post here and we haven't heard a response to my follow-up.

If we weren't under a time crunch on this project, I wouldn't be following both methods of inquiry.

Thanks for your assistance.
Reply With Quote
  #8  
Old June 5th, 2018, 09:07 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,225
Default Re: datamatrix help

Can you specify the exact versions of FusionPro, Acrobat, and your operating systems?
Quote:
Originally Posted by Mike Edwards View Post
As a test of what currentPageNumber returns, I made a simple rule and inserted it into the cellphone.pdf tutorial piece:
Code:
var CurrPage = FusionPro.Composition.currentPageNumber;
return CurrPage;
When I click validate on that rule, it shows "1". When I preview it and when I compose it, it shows "0". It seems to me that it isn't returning what I think it should be.
You probably need to check the "Re-evaluate this rule for every text flow" box.
__________________
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
  #9  
Old June 5th, 2018, 10:46 AM
Mike Edwards Mike Edwards is offline
Forum n00b
 
Join Date: Mar 2018
Location: Des Moines, IA
Posts: 7
Default Re: datamatrix help

That checkbox solved the problem.

Thanks!
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 08:58 PM.


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