• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ColdFusion 2021, cfhtmltopdf & SegoeUI Font

New Here ,
Jul 16, 2021 Jul 16, 2021

Copy link to clipboard

Copied

ColdFusion 2021 and cfhtmltopdf fail to correctly render a PDF that uses the SegoeUI font.  ColdFusion Admin indicates the font is installed.  The PDF is generated but there is no visible text.  Inspection of the generated PDF indicates there are no embedded fonts.

 

Code to Reproduce Problem

 

<cfset fntPsName = "SegoeUI">

<cfsavecontent variable="pdfContent">
	<!DOCTYPE html>
	<html>
	<head>
		<style>
			body {
				<cfoutput>
				font-family: #fntPsName# ;
				</cfoutput>
				font-size: 18px;
				color: black;
				font-style: normal;
				font-weight: normal;
				background-color: white;
			}
		</style>
		<title><cfoutput>#fntPsName#</cfoutput></title>
	</head>

	<body>
		<cfoutput>
		<h1>#fntPsName#</h1>
		</cfoutput>

		<!--- https://www.lipsum.com/ --->
		<h1>What is Lorem Ipsum?</h1>
		<p><strong>Lorem Ipsum</strong> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
	</body>
	</html>
</cfsavecontent>

<cfhtmltopdf 
	name="pdfDoc"
	pageType="letter"
	orientation="portrait"
	destination="#fntPsName#.pdf"
	overwrite="true"
	>

	<cfoutput>#pdfContent#</cfoutput>
</cfhtmltopdf>

 

 

Environment

Server ProductColdFusion 2021
Version2021,0,01,325996
EditionDeveloper  
Operating SystemWindows 7  
OS Version6.1  

 

Question

How do I get ColdFusion 2021 to generate a PDF using the SegoeUI font?

Views

533

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
community guidelines
Community Expert ,
Jul 16, 2021 Jul 16, 2021

Copy link to clipboard

Copied

Adrian, I have good news: you can get that font to work, with CFHTMLtoPDF.

 

But the solution is that you should be specifying the "font family" name, not the "postscript name" or "font face" for the font.

 

If you look at the top of the CF admin page for the fonts, you will see it has those 3 cols. And for Segoe UI, while the "postscript name" value is indeed the "SegoeUI" as you were using, the "font family" value is instead "segoe ui". With the former (as the css font-family), you get the blank page. With the latter, you get what you expect.

 

BTW, if one tried to use the "font face" of "Segoe UI", that also would result in a blank page, for CFHTMLtoPDF at least . The only difference between what works and what fails there is literally the case.

 

FWIW, CFDocument WOULD work with this "Segue UI" value. But it's not that it accepts font faces. Instead I think it's just more fogiving about the case. They're indeed different PDF engines. 

 

And you may wonder why this wasn't a problem if you just used cfoutput todisplay your pdfContent variable to the browser instead. Indeed, some browsers are more lax and let you get away with naming a font-face or postscript name in the cff font-family element. CFHTMLtoPDF does not. (To be clear, the spec for CSS fonts does indeed say that "A font family name only specifies a name given to a set of font faces; it does not specify an individual face.", so it does seem CF is getting it "right" in this case, where the browser is lax.)

 

Anyway, back to your code, I notice that your varname holding the font is indeed fntPsName, so you were intentionally using the postscript name. 🙂 Try using the font family name and let us know how things go.


/Charlie (troubleshooter, carehart.org)

Votes

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
community guidelines
New Here ,
Jul 19, 2021 Jul 19, 2021

Copy link to clipboard

Copied

Try using the font family name and let us know how things go.

 

Thanks for the response Charlie.  Using the font family name produces the same result: a blank PDF 😞

Votes

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
community guidelines
Community Expert ,
Aug 03, 2021 Aug 03, 2021

Copy link to clipboard

Copied

I could reproduce the issue. I do believe it is a bug, and have reported it: https://tracker.adobe.com/#/view/CF-4212214 

Votes

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
community guidelines
New Here ,
Aug 03, 2021 Aug 03, 2021

Copy link to clipboard

Copied

The issue is not limited to SegoeUI.  A bunch of other fonts result in the same behavior (a blank PDF).  An incomplete list of other fonts that produce the problem are -

  • Calibri
  • ComicSansMS
  • Consolas
  • GoudyOldStyleT-Regular
  • LucidaFax
  • LucidaSans
  • Marlett (produces a corrupted PDF)
  • MicrosoftSansSerif
  • MS-Gothic
  • MSOutlook

 

Votes

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
community guidelines
Community Expert ,
Aug 04, 2021 Aug 04, 2021

Copy link to clipboard

Copied

Thanks, @Adrian Wright . Important remarks, which I have added to the ticket.

Votes

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
community guidelines
Community Expert ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

LATEST

Adobe has marked the issue to be fixed. It turns out the issue had been reported at least twice before:

 

https://tracker.adobe.com/#/view/CF-4211439 (March 2021) 
https://tracker.adobe.com/#/view/CF-4211764 (May 2021)

Votes

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
community guidelines
Resources
Documentation