tracker issue : CF-3333862

select a category, or use search below
(searches all categories and all time range)
Title:

cfdocument/cfpdf scale="100" shrinks content

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 09/19/2012

Components: Document Management, PDF generation

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final / 290682

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Win All

Vote Count: 0

Listed in the version 11.0.03.292480 Issues Fixed doc
Consider this pseudo-code (please see attached code):

<cfdocument format="pdf" name="myPDF" scale="100" pagewidth="#800/72#" pageheight="#200/72#"..>
<div style="width:800px;height:200px;background-color:blue;color:white">foobar</div>
</cfdocument>
<cfpdf action="thumbnail" source="myPDF" scale="100" resolution="high"..>

Just run the attached script and see:
1) Resultant image dimensions are 800x200 (good)
2) Blue 800x200 div does not fill the 800x200 image (bad)

I cannot install ColdFusion 10 Update 1 b/c it breaks the underlying ICE Browser functionality that I was using as a workaround for the above.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3333862

External Customer Info:
External Company:  
External Customer Name: itisdesign
External Customer Email:

Attachments:

  1. September 20, 2012 00:00:00: 1_index.cfm
  2. May 19, 2014 00:00:00: 2_cfpdfthumbnailshrinkscontent.zip
  3. November 15, 2014 00:00:00: 3_20141114_Bug_3333862_AlmostFixed.jpg
  4. November 15, 2014 00:00:00: 4_20141115_Bug_3333862_AlmostFixed.cfm

Comments:

I see this is marked BugVerified/ToFix!! w00t!!!!!!!!!!! I'm pumped!! =D =D
Comment by External U.
18060 | September 24, 2012 11:51:39 PM GMT
I was hoping this would be fixed in CF10's Update 3.. Once this is fixed I'll be able to install (and test) CF10's Updates in production. Thanks!, -Aaron
Comment by External U.
18061 | October 16, 2012 10:43:36 PM GMT
Can confirm this bug with other PDFs that I generated. Affects CF8 as well.
Comment by External U.
18062 | November 12, 2012 03:17:55 PM GMT
Hi, Can you please comment on the below mentioned points 1. The div created is in pixel dimensions. 2. The page size given in cfdocument should be in inches. And pixel to inches conversion depends on the resolution of the device. For example, if 300 DPI is used as resolution the resulting PDF and images are generated perfectly fine. To confirm, tried customer supplied reproducible case with and without scale="100" for CFDocument. But it is generating same PDF 3. Thumbnails are supposed to be small size images. It is not image extraction that is being performed. Here is the code which generated correct PDF -. Notice the difference in the value for pageWidth and pageheight for cfdocument tag. <cfsavecontent variable="myHTML"> <style>body {padding:0; margin:0;}</style> <div style="width:800px; height:600px; background-color:blue; color:white; font-size:24;">Div dimensions: 800 x 200</div> </cfsavecontent> <cfoutput>#myHTML#</cfoutput> <cfdocument format="pdf" filename="myPDF.pdf" overwrite="true" pagewidth="2.666" pageheight="2" pagetype="custom" margintop="0" marginright="0" marginbottom="0" marginleft="0" scale="100"><cfoutput>#myHTML#</cfoutput></cfdocument> <cftry> <cfhtmltopdf destination="myPDF-new.pdf" overwrite="true" pagewidth="2.666" pageheight="2" pagetype="custom" margintop="0" marginright="0" marginbottom="0" marginleft="0"><cfoutput>#myHTML#</cfoutput></cfhtmltopdf> <cfcatch type="any"> <cfoutput>#CFCATCH.message#</cfoutput> </cfcatch> </cftry> <cfpdf action="thumbnail" source="myPDF.pdf" imageprefix="myimg" format="png" overwrite="yes" scale="100" resolution="high" /> <p><img src="thumbnails/myimg_page_1.png" /></p> (Comment added from ex-user id:vnigam)
Comment by Adobe D.
18063 | December 04, 2013 02:15:37 AM GMT
Hi Viny, Splendor Public Beta's cfhtmltopdf still shrinks content. The blue div in the generated .png should be the same size on screen as the blue div from the HTML. It isn't, even w/ CF11's cfhtmltopdf. Do you have code which produces .png having same-size blue div? That is what we are needing. I've been asking for this ability in every prerelease I've been part of. While waiting, we were using CF's ICE Browser .jars directly.. but.. CF10's Update 1 changed those .jars and broke the behavior we were relying on. Thanks!, -Aaron
Comment by External U.
18064 | March 01, 2014 12:43:37 AM GMT
Hi Viny, Even in CF11 Final, the combination of cfhtmltopdf + cfpdf/action=thumbnail/scale=100 still shrinks content. Goal: To generate 800x200 completely blue png w/ crisp text from 800x200 blue div using cfhtmltopdf + cfpdf/action=thumbnail/scale=100. Problem (in below example): - When <cfset dpi = 72 />, generated png has same dimensions as div (good) but not completely blue (bad). - When <cfset dpi = 96 />, generated png is completely blue (good) but doesn't have same dimensions as div. The code: <div style="background-color:green;"> <!--- The dpi ---> <cfset dpi = 72 /> <!---<cfset dpi = 96 />---> <!--- The 800x200 div ---> <cfsavecontent variable="myHTML"> <style>body {padding:0; margin:0;}</style> <div style="width:800px; height:200px; background-color:blue; color:white; font-size:24;">800x200</div> </cfsavecontent> <!--- The cfhtmltopdf tag to convert div to PDF ---> <cfhtmltopdf name="myPDF" pagewidth="#800/dpi#" pageheight="#200/dpi#" pagetype="custom" margintop="0" marginright="0" marginbottom="0" marginleft="0"><cfoutput>#myHTML#</cfoutput></cfhtmltopdf> <!--- The cfpdf tag to convert PDF to image ---> <cfpdf action="thumbnail" source="myPDF" format="png" overwrite="yes" scale="100" resolution="high" hires="yes" /> <!--- The comparison (original div vs image generated from original div) ---> <cfoutput>#myHTML#</cfoutput> <p><img src="thumbnails/thumbnail_page_1.png" /></p> <!--- How do I get the img to look the same as the source div? ---> </div> Like sebumd confirmed (in comment below), this issue has existed at least since CF8. I have reported this in CF8's PR, CF9's PR, CF10's PR and CF11's PR. (of course, in CF8-CF10 I was using cfdocument instead of cfhtmltopdf) I really hope this is possible.. Thanks!, -Aaron
Comment by External U.
18065 | May 10, 2014 03:58:03 AM GMT
Hi Yashas, Uday and Viny, Verified <cfdocument> is fine (no bug). Verified <cfhtmltopdf> is fine (no bug). Verified <cfpdf action="thumbnail"> is not fine (bug). Attached cfpdfthumbnailshrinkscontent.zip contains repro code, workarounds, notes and suggestions. Just unzip, then run the root index.cfm, then click each link. Thanks!, -Aaron
Comment by External U.
18066 | May 19, 2014 04:27:08 AM GMT
This is _almost_ fixed in CF11 Update 3 (11,0,03,292024(PreRelease)). Repro: Please see attached 20141114_Bug_CF-3333862_AlmostFixed.jpg and run attached 20141115_Bug_CF-3333862_AlmostFixed.cfm. When cfpdf calls JPedal's setPageParameters(float scaling, int pageNumber), the scaling is currently 1.33 but should be 1.3334. Can that small correction please be made in CF11 Update 3? Thanks!, -Aaron
Comment by External U.
18067 | November 15, 2014 12:49:52 AM GMT
Verified this is fixed in CF11 Update 3 (11,0,03,292480). <cfpdf action="thumbnail" scale="100"..> now generates thumbnails having same dimensions as source PDF page, when source PDF page's width and height are evenly divisible by 4. Otherwise, thumbnail's width or height may be 1px too big or small (maybe due to the 96dpi-to-72dpi conversion?). This is totally fine w/ me. Please include CF-3333862 in CF11 Update 3's list of fixed tickets! Thanks very much! =D, -Aaron
Comment by External U.
18068 | December 07, 2014 02:10:55 AM GMT