8 Replies Latest reply on Mar 25, 2008 11:58 AM by Oğuz Demirkapı

    Images and text in a pdf

    ronbn14
      Hello everyone,

      I have a problem I have not been able to solve. I have a client that needs to dynamically generate a page based on a query that will include up to 4 records with images. That part works just fine. The problem is with the pdf that needs to be generated in the next step. the pdf needs to have a hi-res background and the records-with hi-res images need to be layed over that background. I've tried cfdocument and cfpdf without any luck. Are the pdf functions in CF appropriate at all for this task? Can anyone suggest a third party utility if not? Thanks!
        • 1. Re: Images and text in a pdf
          Oğuz Demirkapı Level 1
          If you have CF8 these request can be apply with some little tricks. But if you are working with old CF version you can try to check out Adobe Exchange or cftagstore.com for commercial solutions.

          If you can share some of your problems we can trey to figure out together.
          • 2. Images and text in a pdf
            Oğuz Demirkapı Level 1
            Sorry for second post. There is a lag on Adobe servers and needed to hit twice.
            • 3. Re: Images and text in a pdf
              ronbn14 Level 1
              Thanks for the reply! We are using CF 8. I tried setting the backgound of the page with a hi-res image to create a background and generate the page from that, but it took about 30 seconds to load (too long for the client). I would not be opposed to using a pdf and cfform tag, as long as I can remove the white text areas (so they show like labels) and I can insert the images from the query. Or just writing to the pdf that already has a background would work too. just need to get it working.
              • 4. Re: Images and text in a pdf
                Oğuz Demirkapı Level 1
                First I can suggest to check the demos in Ray Camden's blog for PDF usage.

                http://www.coldfusionjedi.com/index.cfm/2007/7/9/ColdFusion-8-Working-with-PDFs-Part-1

                You can find some related post below.

                Second, please share some code that we can see what would be the part that may need optimization.
                • 5. Re: Images and text in a pdf
                  ronbn14 Level 1
                  I actually went through those tutorials last night, but didn't see a way to do what I need to do. Long story short, I need the following to output on a pdf with a high-res background image;

                  <meta http-equiv="Content-type" content="text/html; charset=utf-8">

                  <!---Insert a test image name if field is undefined--->
                  <cfdocument format="pdf" orientation="landscape" saveAsName="test.pdf">
                  <html>
                  <head>
                  </head>
                  <cfoutput>
                  <body>
                  <!---Create the pdf--->
                  <p>Memo: #memo#</p>
                  <table align="left">
                  <tr>
                  <td><p>#form.name1#</p><br/></td>
                  <td><p>#form.name2#</p><br/></td>
                  </tr>
                  <tr>
                  <td><p><img src="#image1#" ></p><br/></td>
                  <td><p><img src="#image2#" ></p><br/></td>
                  </tr>
                  <tr>
                  <td><p>#content1#</p><br/></td>
                  <td><p>#content2#</p><br/></td>
                  </tr>
                  <tr>
                  <td><p>#form.name3#</p><br/></td>
                  <td><p>#form.name4#</p><br/></td>
                  </tr>
                  <tr>
                  <td><p><img src="#image3#"></p><br/></td>
                  <td><p><img src="#image4#"></p><br/></td>
                  </tr>
                  <tr>
                  <td><p>#content3#</p></td>
                  <td><p>#content4#</p></td>
                  </tr>
                  </table>
                  </body>
                  </cfoutput>
                  </cfdocument>
                  • 6. Re: Images and text in a pdf
                    Oğuz Demirkapı Level 1
                    I have tried following code to generate a background image in CF8 and it worked without any problem.

                    <cfdocument format="PDF" pagetype="letter" margintop="0" marginbottom="0" marginright="0" marginleft="0" orientation="landscape" backgroundvisible="yes">
                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                    <html xmlns=" http://www.w3.org/1999/xhtml">
                    <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    <title>cfDocument Test</title>
                    <style type="text/css">
                    <!--
                    body {
                    background-image: url(flashflexair.jpg);
                    margin:0;
                    padding:2em;
                    }
                    -->
                    </style></head>

                    <body>
                    Unicode ğĞüÜıİşŞöÖçÇ
                    </body>
                    </html>
                    </cfdocument>


                    "flashflexair.jpg" is an image with the size of 3200 px.

                    Yes the load was a bit longer than normal process but I think this is a general issue with other server side solutions.
                    • 7. Re: Images and text in a pdf
                      ronbn14 Level 1
                      Thanks for the reply Oguz. The background I am using is 8.5x11. Do you think DDX might work for this?
                      • 8. Re: Images and text in a pdf
                        Oğuz Demirkapı Level 1
                        As I know there is a "Background" feature in DDX. I would expect having same functionality.