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 RandhawaCEOAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gurpreet Singh RandhawaCEOAuthor 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
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Gurpreet Singh RandhawaCEOAuthor 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 RandhawaCEOAuthor 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 RandhawaCEOAuthor 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 RandhawaCEOAuthor 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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.