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

CFHTMLTOPDFITEM Header

New Here ,
Jan 13, 2021 Jan 13, 2021

Copy link to clipboard

Copied

Hello,

 

Has anyone had success with centering or spanning the entire PDF with a header image?  When I add a header image with the code below, it is always left aligned no matter if I use the align attribute (which says it is for text) or if I increases the width of the image (it appears to be cropped).

 

<cfhtmltopdfitem type="header" image="pathto/simple_head.png" />

 

I would like to use the Coldfusion to PDF capability because I need to deliver my user accessible PDF's on demand.

 

Thanks!

TOPICS
Reporting

Views

212

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 ,
Jan 15, 2021 Jan 15, 2021

Copy link to clipboard

Copied

@jfkerwin , you're right. I have verified that ColdFusion doesn't respond to the align attribute when the header or footer is an image. Only when the header or footer's content is text.

 

Counterintuitive, yes. But we should perhaps have expected it. The cfhtmltopdfitem documentation says the align attribute is for "Alignment of the text".

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 ,
Jan 15, 2021 Jan 15, 2021

Copy link to clipboard

Copied

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
Enthusiast ,
Jan 15, 2021 Jan 15, 2021

Copy link to clipboard

Copied

We've been using WKHTMLTOPDF for all PDF generation (since ColdFusion 9) and when centering any images, we use HTML and a DIV with "margin:0 auto;".  (I'm sharing this because I understand that CFHTMLTOPDF is black-boxed version of an older version of WKHTMLTOPDF.)

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 ,
Jan 16, 2021 Jan 16, 2021

Copy link to clipboard

Copied

LATEST

I would second Jamo 's suggestion. But if, for what ever reason, you're stuck with cfhtmltopdf or if the project has to be delivered urgently, then you could work around the problem as follows:

  •  create a copy of the header/footer image that has the appropriate amount of whitespace to the left 

 

Something like:

BKBK_0-1610793750795.png

 

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