Solved

doctype with cfdocument to create PDF

Posted on 2006-11-26
1
618 Views
Last Modified: 2013-12-24

 I have a well formatted page using css that looks good in HTML.  I am attempting to open the page within CFDOCUMENT type="PDF" but the formatting is all broken.  

 By adding and removing the style sheet and other items in the file, I found that the DOCTYPE is somehow related.

 This is the doc type I am using with my HTML file...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 When I remove this line from the HTML file the page breaks and looks very much like the CFDOCUMENT's PDF file that doesn't look good.  So I assume that CFDOCUMENT either isn't reading this DOCTYPE or isn't compatible with it or something...
Is it in the right place?
 

 Here is my CFDOCUMENT statement..


<cfdocument pagetype="letter"
            format="PDF"
            unit="IN"
      marginbottom="0.3" margintop="0.4"
      overwrite="yes"
            fontembed = "Yes"
            orientation="portrait"
            encryption = "none"
           scale="85">
<!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>
<link href="/layout/css/stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>




 Thanks !
0
Comment
Question by:gdemaria
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
mmc98dl1 earned 500 total points
ID: 18024322
CSS has never been very well supported in PDF with cfdocument. You can read the comments on the livedocs page http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000236.htm and see some of the issues.

The best approach to this (if you really have to use a PDF) is create a CSS file for a printable version in HTML form then use that in PDF. Kind of like we used to do in the old days when pdf generation was really hard and you had to reload the page with the print css.

Sounds boring but trust me you will save yourself some pain.
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Coldfusion Datefield problem 2 124
How to switch email hosts (part 2) 11 71
Intranet and Kerberos Authentication (not sharepoint!) 8 152
Internal to DMZ IIS Authentication. 3 59
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question