Skip to main content
Participant
Mar 20, 2018 10:04 AM UTC
Answered

Cfdocument issue

I am facing problem with size in generated PDF is not same with the sample HTML.

Coldfusion version is 11,0,0,289974(developer) and adobe driver version is 5.1.1 (Build 0001)  .

Below is my code;

<CFOUTPUT>

     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

     <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=shift_jis">

     <CFDOCUMENT format="pdf"  overwrite="yes" fontembed="Yes" pagetype="A4" marginLeft="0" margintop="0" marginright="0" marginbottom="0">

     <HTML>

     <HEAD>

     <TITLE>TEST</TITLE>

     </HEAD>

     <style type="text/css">

          html, body

          {padding:0; margin: 0;}

     </style>

     <BODY>

     <FORM NAME="MEI202"  ACTION="" METHOD="POST" style="padding:0; margin: 0;">

     <table style="position:relative;width:188mm; height:283mm; border:1px blue solid;margin-left:11mm;margin-top:7mm;">

     </table>

     </FORM>

     </BODY>

     </HTML>

     </CFDOCUMENT>

     </CFOUTPUT>

Now, table size in generated PDF bigger than HTML. What is the possible reason and how to fix it.

Thanks.

This topic is closed to new replies. Start a new post to keep the conversation going.
tnct1988Correct answer
Participant
Mar 27, 2018 9:39 AM UTC

I tried to use WKHTMLTOPDF and found that the result was better than cfdocument.

However, there is problem with letter-spacing.

If letter-spacing is less than 0.1 em, letter-spacing  property will be ignored by WKHTMLTOPDF.

Other than that, WKHTMLTOPDF is working well.

9 replies

tnct1988AuthorCorrect answer
Participant
Mar 27, 2018 9:39 AM UTC

I tried to use WKHTMLTOPDF and found that the result was better than cfdocument.

However, there is problem with letter-spacing.

If letter-spacing is less than 0.1 em, letter-spacing  property will be ignored by WKHTMLTOPDF.

Other than that, WKHTMLTOPDF is working well.

Translate
WolfShade
Legend
Mar 20, 2018 1:56 PM UTC

Oh, and one more thing that I just now noticed.  Try putting the CFOUTPUT just around the FORM tags, making sure that there is nothing between the start of the document and the doctype declaration.

^ _ ^

Translate
tnct1988Author
Participant
Mar 20, 2018 2:22 PM UTC

Thank you for the reply.

Actually, HTML form which is I intend to convert to PDF was designed according to IE6. Currently, user use HTML form to print out name card. That name card's measurement is in mm. I will try to convert mm to px. I am curious about this issue related to developer version or not.

Translate
WolfShade
Legend
Mar 20, 2018 2:55 PM UTC

As far as I know, it's not related to Developer Edition of ColdFusion Server.  Primarily the only difference between Developer Edition and Professional Edition is things like watermarked PDFs and such.  Otherwise, the Developer Edition is a full functioning version of CF Server, single license version (ie, not Enterprise Edition.)

V/r,

^ _ ^

Translate
WolfShade
Legend
Mar 20, 2018 1:54 PM UTC

It's been ages since I've worked with CFDOCUMENT, so can't really say for sure what is going on.  However, two things come to mind.

First is doctype declaration.  You're using the HTML4 declaration.  Try using HTML5: <!DOCTYPE html>

Second is your inline CSS using mm instead of px.  I've never used mm before, so can't really say that mm is causing the issue, but I wonder if using px would change anything.

HTH,

^ _ ^

Translate