Solved

doctype with cfdocument to create PDF

Posted on 2006-11-26
1
578 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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

12 Experts available now in Live!

Get 1:1 Help Now