PDF Forms

From $1

Table of contents
No headers

PDF Forms is actually a little misnomer.  It refers to Synapse's (R213B3+) ability to take any one page document and turn that into a Synapse form which can be filled, or prefilled, and then printed - either the data alone, or the form with the data.  An example would be the CMS-1500 claim form which can be pre-populated with the default values, and allowing you to type in the other fields necessary to make the claim.  It is called PDF Forms because you will likely get the best results from starting with a PDF.  However, you can also turn a MS Word document into a form.

There are four basic steps involved:

  1. We take the document, and turn it into a PNG file that Synapse can load and display
  2. We take the document and turn it into a EPS file that we can view with GSView
  3. We need to map the top left of the PNG to the top left of the EPS and bottom right of the PNG to the bottom right of the EPS ( if you use the same software each time to create the PNG and EPS, then likely you only ever need to do this step once )
  4. We then need to create all the fields that we need to use to make the form usable.

To turn the document into a PNG file, we can install a program that does this for us.  I have used successfully PDF to DXF JPG TIFF Converter 1.3 on the one occasion I tried it.  Other programs I have tried with printer drivers that  turned the printout into an image, but I found that the text was not clear enough in the PNG produced.

To turn a PDF into EPS format, you can simply use GSView which has that as one of its options.  If the original file is not PDF, then you are more limited.  I used my printer driver for my Lexmark C510 color postscript printer which has an option to generate an EPS file.  You might also want to try Adobe's official postscript driver for Windows.

The next few steps are quite complicated and so I will walk you thru the process with creating a PDF Form.  The files I created and used are attached to this page.

For the purposes of this tutorial, I am going to use a PDF that is the application form  to apply for the use of Adalimumab, or Humira, in the treatment of rheumatoid arthritis.  Download this file to your PC.

I did use PDF to DXF JPG TIFF Converter 1.3 on this file, but on this particular PDF, it turns all the little boxes into *.  However, this does not matter as we will mask them all out with our widgets. Download this PNG to the same directory where you have synapse.exe

I created the EPS file by printing to the Lexmark C510 and setting the output options to EPS.  Download this EPS to the same directory as the PNG.

Now we are going to create the form record.

Navigate to Settings/Forms/PDF Forms, and click on the [Details] tab. Now fill in the bottom of the form as follows:

http://synapse-images.s3.amazonaws.com/adding-humira.png

 and click on the [Add New] button.  A message should pop up that you have added the form successfully.  However, a current limitation is that you won't see the new form until you restart Synapse.

When you restart Synapse, you should now see that the navigation tree now looks like this:

http://synapse-images.s3.amazonaws.com/humira-tree.png

and if you now click on the "Humira" leaf, the "Image" tab now shows the sa0812.png file as below.

http://synapse-images.s3.amazonaws.com/humira-preview-tab.png

We now need to determine the top left and bottom right coordinates on our PNG.

Switch to the "Layout" tab, and click on the [Setup] button.  This gives us some approximate coordinates, but we will change these to the following which we found by a little trial and error.

pagesize letter
at 11x27 check data true
at 223x340 check data true

Now, click on the [Render] button and you will see that a little check widget appears over the "A"  in the word "APPLICANT" at the top left of the image and a little check appears over the bottom right corner over the "1" of the fax number.

We need to transfer these coordinates to the Native Offsets fields.

Now with the image rendered, click on the [Dump] button, and copy the coordinate pairs to the PNG Image fields.

check at 44x108
check at 892x1360

Now we have little idea of what the EPS coordinate are, but we shall start with some defaults.  Use these values 38x729 for EPS top left and 602x69 for EPS bottom right.  Switch back to the "Layout" tab, and click on [Render], and then the [Print Form and Content] button.  If GSView is installed, we should now see the template.ps file in the www directory viewed in GSView.  We can see that the top left X appears over the "Address" word and the bottom right X   a couple of cms to the right and above the "1" of the fax number.  We now use a text editor to edit the www/template.ps file, and we want to change this part

newpath 38.0 729.0 moveto (X) show
newpath 602.0 69.0 moveto (X) show

 so that the X is over the same areas as in the PNG.  We can experiment and save the template.ps file, and GSView will show us the new preview.

And after some experimenation, we find that

newpath 26.0 768.0 moveto (X) show
newpath 552.0 36.0 moveto (X) show

gives us the X in the correct places ( note that postscript uses bottom left as 0x0, whereas the other coordinates we are using are 0x0 for top left ).

We can now save 26x768 and 552x36 in the EPS image fields and click on the [Update Layout & Coordinates] button to save them.

Our Details tab should now look like this

http://synapse-images.s3.amazonaws.com/humira-final-definition.png

With all our coordinates correctly working, any widget we draw to the PNG should now appear in the same place on the postscript file.

And our final code in the layout that places all the defaults and checkboxes over the PNG is as follow:

pagesize letter
at 27x33 field 40 (config/doctor)
at 27x40 field 40 (mystreet1fld/text)
at 20x47 field 60 (mystreet2fld/text)
at 20x54 field 60 (mycityfld/text)
at 32x62 field 40 (myfxfld/text)
at 30x69 field 40 (myregistrationfld/text)
at 110x26 field 40 (ssnfld/text)
at 110x33 field 40 (fnamesfld/text)
at 110x40 field 40 (surnamefld/text)
at 110x47 field 20 (dobfld/text)
at 100x55 field 40 (street1fld/text)
at 100x63 field 40 (street2fld/text)
at 100x70 field 40 (townfld/text)
at 100x79 field 40 (cityfld/text)
at 15x115 check data true
at 15x125 check data true
at 15x135 check data true
at 15x146 check data true
at 21x164 check data none
at 21x174 check data true
at 21x191 check data true
at 21x201 check data none
at 21x216 check data true
at 21x226 check data none
at 15x239 check data true
at 105x330 field 40 (form now/date)

Now, if you have managed to follow this tutorial correctly, then with this layout code, click on the [Render] button, and all the widgets should appear in their correct places as well as the default text.  Click on [Print Form & Content] should invoke GSView on the generated PS file and show you a representation of the original form with our data overlaid.

The other buttons - [Print Form Only] does that with no patient data, [Pre-printed Form] only shows our data, and [PDF Editor] turns the postscript file into a PDF, and invokes your default PDF program which may allow you to "ink" over the PDF.