Skip to main content
Participant
March 20, 2018
Answered

Cfdocument issue

  • March 20, 2018
  • 3 replies
  • 1368 views

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 has been closed for replies.
Correct answer tnct1988

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.

3 replies

tnct1988AuthorCorrect answer
Participant
March 27, 2018

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.

WolfShade
Legend
March 20, 2018

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.

^ _ ^

tnct1988Author
Participant
March 20, 2018

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.

WolfShade
Legend
March 20, 2018

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,

^ _ ^

WolfShade
Legend
March 20, 2018

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,

^ _ ^