Question

If I use the following code in my component:

<cfpdf action="merge" name="tender">
</cfpdf>

I get the following error:

Closing tag '' does not match the current parent item: 'cffunction'

However, if i change the code to:

<cfpdf action="merge" name="tender" />

I get no errors. Note that the only way I changed my code is the way I close the tag. Can anybody explain to me why that is and even better, tell me how to get around this?

The error is shown in CFEclipse in the "problems" view, but does not occur when I run the code on the server.

System setup: Win7, running Eclipse Indigo with CFEclipse v.1.4.3. Server runs Coldfusion 8.

Update 1:

If I simply ignore the parse error that CFEclipse shows and run the code on the server, it works as expected. I guess this suggest that it is indeed something with CFEclipse itself like Peter Boughton suggested, and not a problem in the code itself.

Just in case, here is the complete code for the function (note that this is not production code, I'm currently just testing in order to get the things I need working):

<cffunction name="GetTenderPDF" access="remote">
        <cfargument name="Info" type="String" required="true" />

        <cfset var Tender = {} />
        <cfset var InfoJson = URLDecode(Arguments.Info) />

        <cfif Not IsJSON(InfoJson)>
            <cfreturn Error(Messages.NOT_JSON) />
        </cfif>

        <cfset Tender = DeserializeJSON(InfoJson) />
        <cfset templatePath = "templates/tenderTemplate_"&Tender.GROUP&".cfm" />

        <cfheader name="Content-Disposition" value="attachment; filename=offert.pdf" />

        <cfdocument format="pdf" name="mydocument">

        <cfloop index="x" from="1" to="15">
              <p>
              lorem upsom doloras paris hilton is my hero loreum ipsom dsoio foom an to dht end of the world
              will anyone actually read this probably not but let me put more realtext in so it flows a bit nicely
                  <cfloop index="y" from="1" to="#randRange(1,9)#">This sentence will appear a random amount of time.</cfloop>
              </p>
            </cfloop>

        </cfdocument>
        <cfdocument format="pdf" name="base">
            <cfinclude template="#templatePath#" />
        </cfdocument>

        <!--- <cfpdf action="merge" name="tender" /> --->
        <cfpdf action="merge" name="tender">
            <cfpdfparam source="base" />
            <cfpdfparam source="mydocument" />
        </cfpdf>

        <cfcontent type="application/pdf" reset="true" variable="#toBinary(tender)#" /> 

    </cffunction>
Was it helpful?

Solution

This sounds like a bug in the CFEclipse dictionary files.

If you can confirm that the first code actually runs on CF8 then you can report it as a CFE bug, and someone can probably help you out with a fix.

To fix it yourself...

  1. Locate your eclipse plugins directory (e.g. /usr/lib/eclipse/plugins or c:/program files/eclipse/plugins or wherever).

  2. Inside your plugin dir look for the org.cfeclipse.cfml directory (it probably has a timestamp after the name, which depends on your version, but there should be only one*), and inside that there is a dictionary folder, containing a bunch of XML files.
    (*if there's multiple versions, go for the newest one - i.e. the highest number.)

  3. You want either cf8.xml or cf9.xml - depending on which one you have your project configured for (to check, in CFE navigator, right-click on project, select properties, then cfeclipse, and see what radio option is selected) - first create a backup of the file, then open it with any text/xml editor.

  4. Search for name="cfpdf" - there should be a single occurrence - and in the same tag you should see the attribute single="true" - change this to single="false" and save the file.

  5. Restart CFEclipse, and - if I haven't screwed up these instructions - then the error message should have gone away. :)

I haven't tested any of this (don't have CFE on this machine yet), but so long as you backup the dictionary file before editing there shouldn't be any problems.

OTHER TIPS

It could be something to do with the surrounding code or the code inside the <cfpdf></cfpdf> tags. Can you show more context?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top