creating a ebook type with cfpdf

Hi, I have an scenario here where my try is to get all the records related to a single person of his recipe and create a PDF of his collected recipes and pur them available for Download. So whenever he/she changes his records, the pdf should get regenerated and then available for download again, can any experts guide me this way
LVL 16
Gurpreet Singh RandhawaWeb DeveloperAsked:
Who is Participating?
 
SidFishesCommented:
obviously you'll have some kind of db update query so just add a query to get the book info

<cfquery name="bookdata"...>
select * from recipes where authorid = 123
</cfquery>

output bookdata to a variable and format however is required
<cfsavecontent variable="mypdf">
   <cfoutput>
<h1>#bookdata.Recipetitle#</h1>
<p>#bookdata.Recipetext#</p>
or whatever
  </cfoutput>
</cfsavecontent>

write the pdf to afile location
<cfdocument format="pdf" pageheight="11" pagewidth="8.5" unit="in" orientation="portrait" filename="c:\temp\pdfs\Book_#authorid#.pdf">
   <cfoutput>
      #mypdf#
   </cfoutput>
</cfdocument>  

Move the file (or you can write directly to the final destination using cfdocument)
<cffile action="move" source="c:\temp\pdfs\Book_#authorid#.pdf" destination="d:\inetpub\wwwroot\mysite\pdfs\">

0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
hi Sid, Thanks for the headstart, But the Thing suppose at some point of time, i have to upgrade the pdf and ass/remove some recipes, but i do not want the whole cfdocument to render again, so will it be possible to do the same stuff with cfpdf tag, like merging/delete and i suppose i can add extra header/footers with it also right

0
 
SidFishesCommented:
yes i believe so but I've not used cfpdf all that much - I always just rerun the whole document. For my purposes it's easier.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
your example is a good one and i will certaintly accept it, but i will wait a little bit if any experts who worked more with cfpdf can help me in this
0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
i m using code and getting this issue

cfdocument tag has no body.
It must have a body or a source file or URL.

<cfdocument format="pdf" pageheight="11" pagewidth="8.5" unit="in" orientation="portrait"
      filename="#ExpandPath('../#Dir2#/#CreateUUID()#.pdf')#" overwrite="yes">
   <cfoutput>
      #recipePDF#
   </cfoutput>
</cfdocument>
0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
ok i solved it, but it is not including all the records, just the first one, why so?
0
 
SidFishesCommented:
I expect you'll need an output loop in your cfsavecontent - mine was just a generic example
0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
yeah, Solved it, added few header/footer section but still it creates the page break at anypoint while i want it to be broken at some poin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.