Create US Driver License PDF417 barcode using AAMVA data - barcode

I am trying to generate US DL barcode.
I've tried to read the original barcode with barcode parser, convert it to ASCII string, and re-generate a new PDF417 barcode with that string. The result barcode image was different with the original one.
I've also tried to parse it and many online parsing tools worked well.
Parsing the real barcode gives such data in AAMVA format.
<AAMVA>
<user>
<last e="DCS">Last Name</last>
<first e="DAC">First Name</first>
<middle e="DAD">Middle Name</middle>
<dob e="DBB">YYYY-MM-DD</dob>
<eyes e="DAY">BRO</eyes>
<sex e="DBC">M</sex>
...
<issued e="DBD">YYYY-MM-DD</issued>
<expires e="DBA">YYYY-MM-DD</expires>
</user>
<head>
<filetype name="File Type">ANSI</filetype>
<format name="Data Format">11</format>
<issuer name="Issuer Identification Number">xxxxxx</issuer>
...
</subfile>
<subfile designator="ZO" offset="248" length="65">
<element id="A" name="Optional field A">N</element>
<element id="B" name="Optional field B">N</element>
...
</subfile>
</AAMVA>
I need to edit this data and re-generate a valid PDF417 barcode.
How can I do this with free libraries or tools?

Related

Issue with xsl-fo :footnote when generating pdf/ua-1 document with fop.: "tagged PDF note id is missing"

I have an issue with <fo:footnote> when generating pdf/ua-1 document with fop.
The resulting pdf displays correctly the footnote in the page but don’t pass the pdf-ua validation. A severe error on pdf tag Note “id is missing” is raised so the document is not conformed. I'm using PAC3 for the conformance test.
In the example below I have extracted the basic <fo:footnote> element which has a unique id.
How can I generate the missing Id attribute in the pdf tagged Note element?
Here is the xsl-fo really simple footnote. Note that I used an id to reference the footnote.
some text...
<fo:footnote id="FNE0001">
<fo:inline font-size="6pt" baseline-shift="super">E0001</fo:inline>
<fo:footnote-body>
<fo:block>
<fo:inline>E0001</fo:inline><fo:inline > JO L 139 du 29.5.2002, p. 9.</fo:inline>
</fo:block>
</fo:footnote-body>
</fo:footnote> some text...
Apache FOP has been set to generate pdf-ua through the conf file as follow:
<renderers>
<renderer mime="application/pdf">
<!-- Before setting the pdf-ua-mode, we must insert metadata Title in FO declaration -->
<pdf-ua-mode>PDF/UA-1</pdf-ua-mode>
....
PAC3 is checking against the failure conditions in the Matterhorn Protocol; latest edition at https://www.pdfa.org/resource/the-matterhorn-protocol/.
PAC3 is probably reporting on failure condition 19-003, ID entry of the tag is not present.
fo:footnote-body can have an id property. You could try adding an ID to that. In the fo:inline for the footnote marker, you might also need to add an fo:basic-link that refers to that ID.
FWIW, your footnote does not cause that error when checking PDF/UA generated by AH Formatter, and I'm only guessing at what FOP would be doing differently. (PAC3 and I generally disagree when it complains about a footnote being a possibly incorrect use of a Note tag, but that's another story: PAC3 tries to automate checking the conditions that should be checked by a human, and it doesn't always get it right.)

BizTalk Mapping Fields to a Sequence

I am getting my hands on BizTalk and VS. My input schema looks something similar to this.
<root>
<order>
<orderid>
<orderdate>
...
...
and the output schema
<order>
<header:sequence>
<element name="orderid">
<element name="orderdate">
...
...
</header:sequence>
In short, in output, the header is a sequence of complex types and individual nodes in the source are enumerated as the sequence in the output.
How do we solve this in Visual Studio?
What you need to do is having a looping functoid that goes from each of the element being mapped and to the repeating destination element. And then two links from the source elements the first that is a standard link Copy text value, the second that goes to the name attribute, for which you change the link to Copy name.
Input
<root>
<order>
<orderid>1234567890</orderid>
<orderdate>2020-01-28</orderdate>
</order>
</root>
Output
<order>
<header>
<element name="orderid">1234567890</element>
<element name="orderdate">2020-01-28</element>
</header>
</order>
Note: You can change the order of what is output by using the reorder inputs in the Configure Looping Functoid.

How to get XmlInputParser work with self-closing XML tags?

I am trying to load XML files from SE data dump* into HDFS using MapReduce. These XML files consist of a number of <row> elements (enclosed in a top-level "category"), like so:
<badges>
<row Id="1" UserId="1" Name="Organizer" Date="2009-07-15T06:51:46.370" />
<row Id="2" UserId="3" Name="Organizer" Date="2009-07-15T06:51:46.387" />
<row Id="4" UserId="1" Name="Autobiographer" Date="2009-07-15T06:51:46.447" />
...
</badges>
I want each "row" to be processed by a separate map() function, and have configured org.apache.mahout.classifier.bayes.XmlInputFormat's start and end tags as below:
Configuration config = new Configuration();
config.set(XmlInputFormat.START_TAG_KEY, "<row>");
config.set(XmlInputFormat.END_TAG_KEY, "</row>");
However, this fails to parse the XML file, because the <row> element is self-closing. How do I get this to work, without artificially "closing" the self-closing tags?
Linking to SE blog rather than directly to the data dump, to prevent dead link in case location changes in future.
This is a somewhat ugly hack. Change the START_TAG_KEY and END_TAG_KEY as below:
config.set(XmlInputFormat.START_TAG_KEY, "<row");
config.set(XmlInputFormat.END_TAG_KEY, "/>");
The "keys" are being used like delimiters, and accept any string, rather than just XML tags. Not a "clean" solution, and may stop working on future implementations, but it gets the work done now.
Note: I figured it out while I was midway through posting the question. This seems rather obvious in hindsight, but I decided to go ahead with the post anyway, so that someone may find it useful in future.

how to read text in child elements if the parent element's name has dots in freemarker

I have an xml document that I would like to parse using freemarker. The XML document itself was auto generated using SAX in my smooks script. This smooks script created the following XML with element names derived from the actual java package names that I have in my workspace.
<map>
<entry>
<string>RunReportMsg</string>
<com.web.ws.messages.v1__2.RunReportMsg>
<analyticsReport>
<columns>
<com.web.ws.objects.v1__2.ReportColumn>
<dataType>
<id>
<id>10</id>
</id>
</dataType>
</com.web.ws.objects.v1__2.ReportColumn>
</columns>
<analyticsReport>
</com.web.ws.messages.v1__2.RunReportMsg>
</entry>
</map>
A similar question has been posted on this site about this. But I cannot figure out how this would solve my problem.
Access XML elements with names containing a period/dot in FreeMarker templates
I know how to access "RunReportMsg" text in the element "string".
${map.entry.string}
How do I access data in the following child element using dotted notation in freemarker? As the element "com.web.ws.messages.v1__2.RunReportMsg" has multiple periods, I am not sure how to traverse down through further child elements. I need a way to find out the number in the following "id" element.
<id>10</id>
I read the documentation on expressions in freemarker site on ".vars". I am not sure if this applies to my case.
Any help is deeply appreciated.
You can use this syntax:
${map.entry["com.web.ws.messages.v1__2.RunReportMsg"].analyticsReport.columns["com.web.ws.objects.v1__2.ReportColumn"].dataType.id.id}

Store data in txt/xml file, read/write to database?

My wordpress theme accepts skin files. These skin files all install into my main theme folder via a zip uploader that's part of my theme.
Each skin has a set of custom color codes (4 in all) that are stored in the wordpress options table like so...
Assume the skin name is "halloween"...These are the values in my options.php for one of my skin values...
halloween_color1 = 000000
halloween_color2 = ff0000
halloween_color3 = 777777
halloween_color4 = 333333
So I just need a means to store these values inside of each new skin's folder (the one that I send to people who use my theme) so that when they install the skin (via a simple zip extractor upload) I can place code into my zip extractor to write the skin's custom color values to the database.
I'm assuming a simple, colors.txt or colors.xml file will suffice.
How should I store the data in the text file in order to easily parse it and write it to the database? Name/value pairs or XML?
<skin>
<color name="halloween_color1" value="000000" />
<color name="halloween_color2" value="000000" />
<color name="halloween_color3" value="000000" />
<color name="halloween_color1" value="000000" />
</skin>
There are several options. Two that PHP can read natively are ini and CSV.
INI example:
[skin]
halloween_color1 = 000000
halloween_color2 = ff0000
halloween_color3 = 777777
halloween_color4 = 333333
CSV example:
halloween_color1;000000
halloween_color2;ff0000
halloween_color3;777777
halloween_color4;333333
For me personally, YAML has become the favourite format for human-readable configuration files.
YAML example:
skin:
halloween_colors:
- 000000
- ff0000
- 777777
- 333333
its advantages in my view are:
Parsing is very strict; it will exit immediately and throw an error if it doesn't like the file's structure
It supports nested data structures, the building of associative arrays, typing, and lists (Useful e.g. if you want to add a fifth halloween colour)
But, it needs a third party library. Whether that is justified, you have to decide.
See a list of PHP parser libraries here.

Resources