Highlighted

Cfdocument issue

Community Beginner ,
Mar 20, 2018

Copy link to clipboard

Copied

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.

Correct answer by tnct1988 | Community Beginner

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.

Views

670

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Cfdocument issue

Community Beginner ,
Mar 20, 2018

Copy link to clipboard

Copied

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.

Correct answer by tnct1988 | Community Beginner

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.

Views

671

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 20, 2018 0
LEGEND ,
Mar 20, 2018

Copy link to clipboard

Copied

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,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2018 0
LEGEND ,
Mar 20, 2018

Copy link to clipboard

Copied

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.

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2018 0
Community Beginner ,
Mar 20, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2018 0
LEGEND ,
Mar 20, 2018

Copy link to clipboard

Copied

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,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2018 0
LEGEND ,
Mar 20, 2018

Copy link to clipboard

Copied

And if the user is still using IE6, the user needs to upgrade to a modern browser, if for no reason other than security.  But also because IE6 will not support HTML5.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2018 0
Community Beginner ,
Mar 20, 2018

Copy link to clipboard

Copied

Now, user using IE11 but rendering HTML engine is still old IE(ie-emulate). I also tried cfhtmltopdf and result was worse from cfdocument. Cfdocument at least has setting for font embedded. Main reason why need to convert to pdf is because of font issue. Client bought license for custom font and installed it inside the server. I will try WKHTMLTOPDF. Changing current measurement from mm to px is the last resort.

Thanks.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2018 0
LEGEND ,
Mar 20, 2018

Copy link to clipboard

Copied

If the user is using Compatibility View to use this form, then the form should be updated to modern standards and the Compatibility View set to IE11.  Using an old doctype just so that the HTML renders for old code is very backwards.  I think you could be making way more work for yourself than is necessary.

Just my two cents.

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2018 1
Community Beginner ,
Mar 20, 2018

Copy link to clipboard

Copied

Thanks for your opinions.  I will try as suggested.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 20, 2018 0
Community Beginner ,
Mar 27, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 27, 2018 0