Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

doctype with cfdocument to create PDF

Posted on 2006-11-26
1
Medium Priority
?
635 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
1 Comment
 
LVL 12

Accepted Solution

by:
mmc98dl1 earned 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
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 anti-spam), the admin…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

916 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