Import Template into MapForce
This topic explains how to import a PDF extraction template and a PDF instance file into MapForce and how to map PDF data to a sample XML file. Note that PDF components in MapForce are compatible only with the Built-In transformation language.
Import existing template and instance files into MapForce
MapForce enables you to import an existing PDF extraction template in any of the following ways:
•You can drag the template into the mapping area directly.
•You can click the toolbar command or select the menu command Insert | PDF Document in MapForce. In both cases, this opens a dialog that enables you to select an existing template (the Open existing PDF extraction template file option below).
To check or change a PDF instance file associated with the template, open the PDF Component Settings. For information about ways to create a new PDF extraction template, see Create a New Template.
Note that a PDF component can only be used as a data source in MapForce. Therefore, any PDF component has only output connectors and no input connectors (mapping below).
Add a target file
The next step is to add a target XSD schema called GardenInvoice.xsd (screenshot below) to the mapping area. The schema has been created in Altova XMLSpy. For details about how to insert an XML component into your mapping, see XML and XML Schema.
Connect source and target
The next step is to connect the nodes of the source and target components. As a result, the mapping looks as follows:
Edit template
If you want to edit your template, you can choose any of the following ways to open the template in the PDF Extractor:
•You can open your PXT file directly in the PDF Extractor.
•You can click Edit in the Component Settings of the PDF component in MapForce. Clicking Edit opens the template in the PDF Extractor.
•You can also right-click the PDF component header and select Edit PDF Extraction Template from the context menu (screenshot below). Clicking this command opens the template in the PDF Extractor.
Preview output
The Output pane shows that the PDF data has successfully been mapped to the target and can now be saved as an XML document. An extract of the output file is illustrated below:
<Invoice xsi:noNamespaceSchemaLocation="file:///C:/MF_TutorialFiles/GardenInvoice.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>GARDENING SERVICES INVOICE</Header>
<BillTo>Oswald Grim
17 Darkwood St.
Boston, MA 02128
+1-617-8767675</BillTo>
<InvoiceNo>4560123</InvoiceNo>
<Date>2023-09-05</Date>
<Service>
<Description>Garden design</Description>
<Hours>6</Hours>
<Rate>50</Rate>
<Amount>300</Amount>
</Service>
<...>
<Total>972</Total>
<Terms>Payment is due within 14 (fourteen) days of the invoice issue date. Interest on overdue invoices shall accrue at a rate
of 10% per day until full payment is received.</Terms>
</Invoice>
For your convenience, the mapping is saved as Tutorial\GardenInvoice.mfd.