Solved

doctype with cfdocument to create PDF

Posted on 2006-11-26
1
621 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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