5 Replies - 8069 Views - Last Post: 10 February 2012 - 09:57 AM Rate Topic: -----

#1 minir  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 30-November 11

Coldfusion pdf question

Posted 10 February 2012 - 08:15 AM

I have a huge coldfusion form to be filled .I want it in printable format after it is filled and so I decided to convert it into pdf format.But since form is so huge and has many non filled fields there are lot of pages to print and so I want only the filled fields to be converted into pdf instead of the whole form? Is that possible.?

Thanks a much in advance.
Is This A Good Question/Topic? 0
  • +

Replies To: Coldfusion pdf question

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1866
  • View blog
  • Posts: 3,385
  • Joined: 13-January 08

Re: Coldfusion pdf question

Posted 10 February 2012 - 08:30 AM

Yes, it's possible. Your question is a little non-specific though and the answer would depend upon how knowledgeable you are with CF and what version of Coldfusion you're using.

The reason for the second question is that starting with MX7, Adobe added the CFDOCUMENT tag to their repertoire. What you can do is decide which form field submissions you wish to include (whether that's a static list or whether the inclusions are based on what the user filled out) and then drop the results into a CFDOCUMENT block...and you should be set.

Now, that answer is very simplistic because you can structure and style the hell out of whatever it is you're committing to a .pdf or other such document file format. What you probably need to do is to set up a sample page (model it on the example(s) shown in the link above) and see what it does. Once you see what you can do with it, you'll have a much better idea for how to solve your issue.

Good luck!
Was This Post Helpful? 0
  • +
  • -

#3 minir  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 30-November 11

Re: Coldfusion pdf question

Posted 10 February 2012 - 08:39 AM

View PostCraig328, on 10 February 2012 - 08:30 AM, said:

Yes, it's possible. Your question is a little non-specific though and the answer would depend upon how knowledgeable you are with CF and what version of Coldfusion you're using.

The reason for the second question is that starting with MX7, Adobe added the CFDOCUMENT tag to their repertoire. What you can do is decide which form field submissions you wish to include (whether that's a static list or whether the inclusions are based on what the user filled out) and then drop the results into a CFDOCUMENT block...and you should be set.

Now, that answer is very simplistic because you can structure and style the hell out of whatever it is you're committing to a .pdf or other such document file format. What you probably need to do is to set up a sample page (model it on the example(s) shown in the link above) and see what it does. Once you see what you can do with it, you'll have a much better idea for how to solve your issue.

Good luck!



I do not want the static fields to be displayed in the pdf.I want only the form filled fields to be produced in pdf format dynamic it will be different for different form.I am well aware of code how to convert cfm into PDF format.Thanks for your reply.
Was This Post Helpful? 0
  • +
  • -

#4 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1866
  • View blog
  • Posts: 3,385
  • Joined: 13-January 08

Re: Coldfusion pdf question

Posted 10 February 2012 - 08:59 AM

View Postminir, on 10 February 2012 - 10:39 AM, said:

I do not want the static fields to be displayed in the pdf.I want only the form filled fields to be produced in pdf format dynamic it will be different for different form.I am well aware of code how to convert cfm into PDF format.Thanks for your reply.


Ah. As I said, your original post was a little non-specific. So really what you're asking is "how can I tell from a form submission what fields have been filled out and which have not?". Is that correct?
Was This Post Helpful? 0
  • +
  • -

#5 minir  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 30-November 11

Re: Coldfusion pdf question

Posted 10 February 2012 - 09:10 AM

View PostCraig328, on 10 February 2012 - 08:59 AM, said:

View Postminir, on 10 February 2012 - 10:39 AM, said:

I do not want the static fields to be displayed in the pdf.I want only the form filled fields to be produced in pdf format dynamic it will be different for different form.I am well aware of code how to convert cfm into PDF format.Thanks for your reply.


Ah. As I said, your original post was a little non-specific. So really what you're asking is "how can I tell from a form submission what fields have been filled out and which have not?". Is that correct?


Correct.Sorry for mistaken question..Thanks
Was This Post Helpful? 0
  • +
  • -

#6 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1866
  • View blog
  • Posts: 3,385
  • Joined: 13-January 08

Re: Coldfusion pdf question

Posted 10 February 2012 - 09:57 AM

N/P. We just want to make sure we're addressing the correct question.


You'll notice that when you do a form submit in CF you'll see the form scope in your debug output (if you have it set to show the form scope and if you have debugging on). It'll look something like this:
Posted Image

The highlighted portion of that image is what we're interested in now: fieldnames. You'll see that it's a string of comma delimited text values (where the values are the other form fields submitted). In CF this is also a list...and with this we can do something like this:
<cfloop list="#form.fieldnames#" index="j">
   <cfoutput>Form field is called: [#j#]<br></cfoutput>
</cfloop>


So, what good does it do us to be able to spit out the field names from the form scope? Well, CF has the handy practice of storing all the variables scopes (including form) in structs. This means, we can use struct notation and little inventiveness to figure out which of the form fields have values in them and which do not. We do so like this:
<cfloop list="#form.fieldnames#" index="j">
   <cfset formValue = Form["#i#"]>
   <cfif Trim(formValue) NEQ "">
      <cfoutput>Form field is called: [#j#] and has a value of #Trim(formValue)#<br></cfoutput>
   </cfif>
</cfloop>


In one small CFLOOP sequence you can loop over the form struct and determine which of the form fields has a value, what that value is and what the name of the field is. With that in hand you should be able to make your document generator print only the values you wish to include even when you don't know the names of the form elements being sent to it.

Give that a spin and if it works for you, you can probably figure out how to adapt it to what you're doing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1