Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Download PDF from CD site

Can a PDF be embeded in a CD article for download by a site visitor?

John Duke
Sunday, March 23, 2003

Yep, I've got many pdfs in the site I maintain for the Down Syndrome Association of NSW. Check out this page:

I just drag 'n' drop them from Explorer into CityDesk, and create links to them in the usual way (Ctrl-K, then select the pdf file from the drop-down list).

The only hassle is when you want to replace an old version of the pdf with a newer one with the same name. Joel has said that he's working on providing a way to do this in the next version of CityDesk, though.

Feel free to ask me questions if you need any help.

Darren Collins
Monday, March 24, 2003

It can get a bit more complicated if you want to build a LIST of these files, however.  This can be very useful for some applications in which you have a whole series of PDF files from which the user might want to select a specific one. 

I think your application mught benefit from this.

I created a Folder called Files. 

I Inserted each PDF file into this Folder.

For each PDF file I created an Article in the same Folder:
    Body: The PDF file's Magic name
    Header: A useful name
    Teaser: A nice description for the file

I built a template that grabs all the Articles and built a table that had two columns:

    Column 1            Column 2
    <a href={$x.body$}> {$x.header$}  {$x.teaser$>

Of course, there is a row for each Article, x.

What I now have is a nice list of the Headers, as link, accompanied by the nice description of each file.

To add anther PDF file, the user simply has to Insert the PDF file and add the Article that describes it and containes its Magic Name as the Article's body.

Joel Finkel
Tuesday, March 25, 2003

Let me clear up my previous posting by being more specific.  Here is the code:

{$ foreach x (folder PDF_Files) SortAscendBy .keywords $}

<a href="{$x.body$}" target="pdf">{$x.header$}</a>

{$ next $}

Note that I sort by keywords.  I use this as a mechanism to determine the order that the PDF files are listed.  One could also order by the Articles' filenames, and preface them with sequential numerals.  In fact, this would be preferable in this case, because the ordering would be immediately visible to the user.  This filename is never displayed to the web visitor, so keeping it "pretty" is unimportant.

Joel Finkel
Tuesday, March 25, 2003

*  Recent Topics

*  Fog Creek Home