• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Adding Text to A PDF document

New Here ,
Jan 03, 2013 Jan 03, 2013

Copy link to clipboard

Copied

My old code would print a certificate for a user once they pass a test stored in an Access Database. Once the provider upgrade to CF10 the cf_pdf changes to cfpdf and then that is where i get lost. This code no longer works and I do not know where to start to make this work. Any suggestion would be helpful. Once I change the tags to cfpdf, then I get more errors such as DDX which is new to me.

--------------------

<cfif GetAuthUser() is not "">

               <cfquery datasource="GetHelpNow" name="Get">

               SELECT * FROM Users WHERE user_id = #GetAuthUser()#

               </cfquery>

              

               <cfif (Get.recordcount is not 0) and (Get.user_certFailures is 0) and (Get.user_certCompleted is 1)>

                              <cf_pdf file="GetHelpNow-Certificate-#GetAuthUser()#.pdf">

                                             <cf_pdf_info file="Cert.pdf">

                                             <cfloop query="request.PDFInfo">

                                                            <cf_pdf_page width="#width#" height="#height#">

                                                                           <cf_pdf_read file="Cert.pdf" page="1" />

                                                                           <cf_pdf_text x="360" y="396" rotate="90" align="center" font="Arial" size="20" color="000000" bold="true"><cfoutput>#Get.user_fname# #Get.user_lname#</cfoutput></cf_pdf_text>

                                                                           <cf_pdf_text x="432" y="396" rotate="90" align="center" font="Arial" size="16" color="FFFFFF" bold="true"><cfoutput>#DateFormat(Get.user_certCompletedDate, "m/d/yyyy")#</cfoutput></cf_pdf_text>

                                                            </cf_pdf_page>

                                             </cfloop>

                              </cf_pdf>

                             

                              <cffile action="read" file="d:\websites\GetHelpNow.com\www\certification\api\GetHelpNow-Certificate-#GetAuthUser()#.pdf" variable="fileInfo">

                             

                              <cfheader name="Content-Type" value="pdf">

                              <cfheader name="Content-Disposition" value="attachment;filename=GetHelpNow-Certificate.pdf">

                              <cfcontent type="application/pdf">

                              <cfoutput>#fileInfo#</cfoutput>

               </cfif>

</cfif>

--------------------

thanks

TOPICS
Advanced techniques

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 03, 2013 Jan 03, 2013

Copy link to clipboard

Copied

cf_pdf is obviously a custom tag.  If it no longer works you have two choices.  You can try to make it work or you can abandon it and use cfpdf.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 03, 2013 Jan 03, 2013

Copy link to clipboard

Copied

I will abondon it, can you point me to an example

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2013 Jan 04, 2013

Copy link to clipboard

Copied

Marine71 wrote:

I will abondon it, can you point me to an example

That seems a hasty decision. As Dan has said, cf_pdf is a custom tag, hence a developer's tag. As such, it practically hs nothing to do with ColdFusion's own tag, cfpdf.

Reverse all the changes you made, returning the code to its original state. The existence of a custom tag, cf_pdf, implies the existence of a file named pdf.cfm, which contains the basic code. Copy that file to the same directory as the CFM file containing the code you've shown above. Now, run the original version of the above code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2013 Jan 04, 2013

Copy link to clipboard

Copied

LATEST

Oh, something else. Alternative places to look for the file, pdf.cfm (besides the current directory), are:

  • \cfusion\CustomTags\
  • Some other custom-tag directory specified in the ColdFusion Administrator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation