PDF documents are used by many organizations to both display and print health care claim forms like CMS-1500 and UB-04. Fillable PDF documents, also called PDF forms, are used to allow users the both view and edit documents before saving or printing. PDF forms are sometimes displayed directly in internet browsers.
EDI data from an 837 Professional EDI document, for example, represents a health care claim and can be used to initially populate fields in PDF claim forms. Users can then edit the fields, save or print the PDF claim as needed.
This blog will demonstrate how to take data from an 837 Professional EDI file and populate a fillable CMS-1500 PDF form.
Step 1 Loading the 837 Professional claim file into memory
The first step is loading the 837 Professional file into memory. We’ll use EDIValidator to accomplish this. Once the data is loaded we’ll use Typed Documents to get the data we need.
// Create a new instance of the EDIValidator
EDIValidator validate = new EDIValidator();
// Load 5010 837 Professional Rules
ediValidator.EDIRulesFile = "EDIFiles\\Rules_5010_837P_005010X222A1.Rules";
// Specify the EDI file to load
ediValidator.EDIFile = "EDIFiles\\sampleEDIFile.txt";
// Load and validate the EDI data
ediValidator.Validate();
// Convert the loaded EDI data into a Typed Document
Typed5010Document doc = new Typed5010Document(ediValidator.EDILightWeightDocument);
// Get the data we need using the new Typed Documents API
NM1 billProvName = doc.MainSection.GetSegment("INTERCHANGE HEADER/FUNCTIONAL GROUP/ST HEADER/2000A/2010AA/NM1");
// Construct the billing provider name
String box33Data = billProvName.NameLastOrOrganizationName + " " + billProvName.FirstName + " " + billProvName.MiddleName;
Step 3 Use the information from Step 2 to fill the fillable CMS-1500 PDF form
How is this accomplished? Each fillable PDF form has a collection of fields/value pairs that can be set. We’ll use a free .Net library called iText. iText allows us to get and set the fields. Each fillable PDF form will have different names for their fields. You should iterate over the fields and verify that you are setting the correct field.
In our example the field we want to set is called ‘doc_name’.
// Create a PdfReader and PdfWriter instance
PdfReader reader = new PdfReader("claim-form-cms-1500.pdf");
PdfWriter writer = new PdfWriter("FilledOutForm.pdf");
PdfDocument pdfDoc = new PdfDocument(reader, writer);
// Get the form fields
var form = PdfAcroForm.GetAcroForm(pdfDoc, true);
var fields = form.GetFormFields();
// Specify the EDI file to load
fields["doc_name"] = box33Data;
// Close the document
pdfDoc.Close();
The CMS-1500 PDF document is still editable and allows the users to make any necessary changes.


