Monday Aug 06, 2007

Ripped Crosstabs

[Read More]

Wednesday Aug 01, 2007

PDF Data Entry - Part III

[Read More]

Monday Jul 30, 2007

PDF Data Entry - Part II


Last time we looked at building and pre-filling the PDF data entry form. We now need to look at how we can allow the user to 'submit' the data they have entered back to the server and to then let them know that their data has been received.

There are a several of ways that Adobe will allow you to post data from a form.


Im using Adobe 6 you may be on another version, things should be similar thou. The properties dialog, for a button reveals the folloiwn submission methods:

  • FDF - this is Adobe's 'Form Data Format' - you can get more info on this here. It's a proprietory format for sending (and receiving) form data and comments. Im not going to deal with this format.
  • HTML - need I say more except Im not going to deal with this either
  • XFDF - XML Forms Data Format. Yep, you guessed it, it's Adobe's proprietory XML format for the forms data - now this we can and will use. Not the friendliest format but guess what? We have an API for that.
  • PDF - you can just submit the complete PDF form. This is useful if you wanted to store a copy of a form created by a user. Even better if they signed the form with a digital signature - as good as a paper signature. Of course we need to scrape the data out of the form too - yep, we have an API for that too and we're going to try that too.

Now I guess you could use the HTML format and Adobe provides an SDK to parse the FDF format but why bother, Publisher has all you need for for the last two formats and they have enough information.

Using the properties dialog we can choose XFDF or PDF. Initially I chose XFDF, I need to POST the XFDF to some CGI process on a web server. I elected to use a servlet. Looking at the graphic above you'll see I have entered a URL. Therein lies an issue, I have hardcoded the URL on the button - you got it. We have an API for that, now I have to admit this one is hidden and again I lent on Incheol for information.

We have an undocumented class FieldEditor, as the name suggests you can edit fields with it - that includes adding fields too. So, we can  create the button in its entirity and enter the submission destination and format and then put it on the page.

We first need to instantiate a PDFParser object, this takes the file we want to edit as an input. We then create a FieldEditor object and add the button and then re-generate the form. The addButton method takes a series of parameters.


Most I hope are self explanatory except maybe:
btnCode - you can create a submit or javascript type button and here is where you pass either the

            //Add the button
            float[] btnCoords = {350f,350f,470f,380f};
            float fontSize = 16f;
            String btnName = "SUBMIT_BTN";
            String btnLabel = "Submit";
            String btnDest = "";
            int btnPg = 0;
            //Create a PDF Parser instance
            PDFParser pdfP = new PDFParser(pdfForm);
            //Create a FieldEditor instance
            FieldEditor fldEd = new FieldEditor(pdfP);
            //Add the button
            //Regenrate the form

Now the only drawback is that the API does not let you influence the look and feel of the button, so you get a flat button ... not exactly a nice beveled 'clickable' affair but it gets the job done. Before you ask, no there is not a method to update a button. We can look into that if enough of you scream loud enough. I also have to admit that we do not give you the control over the posting format of the button e.g. XFDF, PDF, etc. It defaults to HTML ... dang - Im logging an enhancement for this today.

Apologies for this tangent we got on to with buttons that led down a rather disappointing cul-de-sac. Next time, we get into receiving the contents of PDF via a servlet and letting the user know we got their information. 


Wednesday Jul 25, 2007


[Read More]

Thursday Jul 19, 2007

I want a default font!

[Read More]

Tuesday Jul 17, 2007

One Page Only Please

[Read More]

How to improve your image

[Read More]

Tuesday Jul 10, 2007

Dynamic Formatting Again


Question on the forum today asking how you might use some meta information stored in the incomng XML data to format the final output i.e. override any formatting you might have created in the RTF template. I covered how to do this if the XML is actually HTML e.g.

<TEXT><B>Report Title</B></TEXT> 

You can check that out here.

What to do if you have something like the following:

<?xml version='1.0'?>


<TITLE format="bold">The Crazy Dog</TITLE>

<TEXT format="italic">I've seen many strange dogs but this is the one. you should see some of the things hes done. I've seen him jump and try to eat sand. he had a mouth full of dirt as soon as he would land. if you saw him you'd probably giggle. if you do you have probably seen him squiggle. the strange thing is hes never snappy but he is always happy! every one knows him now and he says to you "bow wow!" </TEXT> </POEM>

Notice the format attributes specifying how the text shuld be formatted.
We need to use some of the techniques from the HTML formatting article to specify the formatting required using the XSLFO syntax. Keeping things simple we can just use simple conditional 'if' statements to check the value of the 'format' attributes. Using the TITLE element we can use:

 <xsl:attribute xdofo:ctx="block" name="font-weight">bold</xsl:attribute>
<?end if?>

Similar approach for the italic or any other attribute. You could build a subtemplate to handle all of the possible 'formatting' options to simplify your coding and making it more dynamic. Get ya example files here.

In case you're wondering, the poem is from my son about our new puppy.


Thursday Jun 21, 2007

Get Templates from Microsoft

[Read More]

Wednesday Jun 20, 2007

Template Builder Issues Fixed

[Read More]

Follow bipublisher on Twitter Find Us on Facebook BI Publisher Youtube ChannelDiscussion Forum

Join our BI Publisher community to get the most and keep updated with the latest news, How-to, Solutions! Share your feedback and let us hear your voice @bipublisher on Twitter, on our official Facebook page, and Youtube!


« May 2015