Solved

doctype with cfdocument to create PDF

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now