yoshismokey
Programmer
Hi,
I would like to display a web page from my cold fusion application in a PDF file to be viewed by the user when they click on a button. I have the following code which partially works:
<cfif IsDefined("form.Preview")>
<!--- You can pass a URL in the URL string --->
<cfparam name="url.target_url" default="<cfoutput>
<cfhttp url="#url.target_url#" resolveurl="yes">
<cfdocument format="pdf">
<cfdocumentitem type="header">
<cfoutput>#url.target_url#</cfoutput>
</cfdocumentitem>
<!--- Display the page --->
#cfhttp.filecontent#
</cfdocument>
</cfoutput>
</cfif>
This application has security in it so that the user has to log in before viewing any of the pages. The user is actually logged in at the time that he pushed this Preview button.
The problem arises when the url is called in the above code though. The PDF file is shown but not with the correct page(UPRSummary). Instead, the login page is shown. This I believe is because of the application.cfm file which checks the value of the session.LoggedIn variable and if it is "False", it sends the user to the login page. For some reason, when calling the url from this cfdocument code, the session.LoggedIN variable must be set back to "False" and the user login page is displayed, thus messing up my PDF file.
I know this is the case because I disabled the application.cfm file (renamed it application1.cfm) and ran the above code and it worked!! I also tried setting Session.LoggedIn to "TRUE" in the UPRSummary code, which didn't work either.
Do you have any idea how I could disable the application.cfm code within my code temporarily so this cfdocument procedure would work?
Thanks in advance.
I would like to display a web page from my cold fusion application in a PDF file to be viewed by the user when they click on a button. I have the following code which partially works:
<cfif IsDefined("form.Preview")>
<!--- You can pass a URL in the URL string --->
<cfparam name="url.target_url" default="<cfoutput>
<cfhttp url="#url.target_url#" resolveurl="yes">
<cfdocument format="pdf">
<cfdocumentitem type="header">
<cfoutput>#url.target_url#</cfoutput>
</cfdocumentitem>
<!--- Display the page --->
#cfhttp.filecontent#
</cfdocument>
</cfoutput>
</cfif>
This application has security in it so that the user has to log in before viewing any of the pages. The user is actually logged in at the time that he pushed this Preview button.
The problem arises when the url is called in the above code though. The PDF file is shown but not with the correct page(UPRSummary). Instead, the login page is shown. This I believe is because of the application.cfm file which checks the value of the session.LoggedIn variable and if it is "False", it sends the user to the login page. For some reason, when calling the url from this cfdocument code, the session.LoggedIN variable must be set back to "False" and the user login page is displayed, thus messing up my PDF file.
I know this is the case because I disabled the application.cfm file (renamed it application1.cfm) and ran the above code and it worked!! I also tried setting Session.LoggedIn to "TRUE" in the UPRSummary code, which didn't work either.
Do you have any idea how I could disable the application.cfm code within my code temporarily so this cfdocument procedure would work?
Thanks in advance.