Customizing report letterhead

lamspc wrote on Friday, December 06, 2013:

Does anyone know how to customize the letterhead generated by the report function. I wanted to be able alter the standard output (showing facility id) and replace with my hospital’s standard letterhead template which includes a logo.

Any help appreciated.

cmswest wrote on Friday, December 06, 2013:

sure, just play around with this file:

you’ll see that you can comment out the facility stuff and insert a .png or other image file

fsgl wrote on Friday, December 06, 2013:

Hi Stephen,

It may be easier for Paul to just insert a single image of the hospital letterhead with the logo.

Would he delete lines 465 to 468?

Documents can store the image. Does Paul need to name that image as “practice logo” and change line 460 if the format is not .gif?

Just experimented on the 4.1.1 Demo, .png files are supported in addition to .jpeg files. Png files have higher resolution and better color retention.


Paul, please backup your data before you start customization.

In event that you are unaware, there is a utility for writing consult letters.

Go to Patient Summary. In the left Navigation Menu, toward the bottom, Popups will light up. Click Letter from the drop down menu and a dialog will appear. See attachment.

Text can be easily changed in the sample letter but another forum member will have to tell you how to add an image to the template. Can’t merely copy an image from Documents.

cmswest wrote on Friday, December 06, 2013:

I agree fsgl. Upload the image, can be .gif, .jpg, .jpeg, .png, to the custom subdirectory of the openemr document root

replace line 460 with:

$practice_logo = “…/…/…/custom/myletterhead.png”;

then comment out these lines if the image contains the info:

lamspc wrote on Sunday, December 08, 2013:

Thank you Stephen and fsgl. I am trying it out- just need to tweek it a bit. On initial upload of the logo, there was a big size discrepancy between the logo (87k) and the the generated document. Any suggestions before I trial and error?

The current location of the ‘practice_logo’ file will affect all sites in a multi-site setup - Unless the custom_report.php file is replicated inside each site subdirectory, along with the site-specific images, the suggestions above will impact all sites

many thanks for your comments
Paul

cmswest wrote on Sunday, December 08, 2013:

so you’d like a smaller image size? http://compressjpg.com/

for multisite use something like this:

$practice_logo = "../../../custom/" . "practice_logo.png" . $_SESSION['site_id'];

fsgl wrote on Sunday, December 08, 2013:

Please backup before experimenting since it will have an impact on multiple folders and sites. Best of luck.

cmswest wrote on Sunday, December 08, 2013:

maybe this would be more appropriate?

$practice_logo = “…/…/…/sites/” . $_SESSION[‘site_id’] . “/images/practice_logo.png”;

lamspc wrote on Sunday, December 08, 2013:

I think this should do it.

lamspc wrote on Sunday, December 08, 2013:

$practice_logo = “…/…/…/sites/” . $_SESSION[‘site_id’] . “/images/practice_logo.png”;

This does address the site specific logo issue.

However, two unresolved issues:

  1. despite using php comment prefixes (// or // or #), results from lines 465-8 continues to appear, along with the above prefixes. Can remove them by eliminating those lines all together.

  2. Once I reduce the logo to 960x200 pixels or less (standard width of letter doc is 960 pxls), there is a formatting problem in which patient name and encounter date appear to right of logo. Couldn’t fix it with extra “\n”

Any thoughts?

cmswest wrote on Monday, December 09, 2013:

comment out php by putting the slashes inside the escaped php commands, <?php // ... ?>

you must need those brs and br clear=‘all’ which have been deleted

lamspc wrote on Monday, December 09, 2013:

Thanks a lot!

aterad wrote on Thursday, October 16, 2014:

please i need help on this topic. I place the logo in openemr/custom
the logo is a .png and i named it letterhead.png also i edited the file as directed in the instruction above. Yet image is not showing in the printable version of patient report. Also,as i comment out line 465-468 in the custom_report.php, the address of the clinic that usually shows is no longer there yet the logo is not showing. Please What can be done?

cmswest wrote on Friday, October 17, 2014:

hi timothy, please post your changes to the file and i’d be glad to weigh in

thanks

aterad wrote on Saturday, October 18, 2014:

Thanks stephen, God bless u. I edited the codes as directed and placed the letterhead in the custom folder. Please see the 2 attached images. Thanks

fsgl wrote on Saturday, October 18, 2014:

Try this:

  1. Add a new Category, Custom, to Documents as described in attachments.
  2. Upload logo to this new Category.

cmswest wrote on Saturday, October 18, 2014:

looks good to me, what shows on the generated report? a broken link?

in the 4.1.3 code, custom_report has been upgraded to avoid placing in custom dir and instead uses the $OE_SITE_DIR variable, however, apache doesn’t have access to the /var/www that preceded the openemr root, so that has to be tweaked

aterad wrote on Saturday, October 18, 2014:

@fsgl, i have done your suggestion but was not working. Though there is no link between it and the report letterhead melee. Whats the way forward sir.

@stephen, yea thats the situation, i even changed the location to "…/…/…/interface/pic/letterhead.png and then place the image in the directory, no result. So what do i do, you were not definitive in your response sir. Thanks

cmswest wrote on Saturday, October 18, 2014:

so a broken link then, like the attached image?

sounds like a permission problem but on windows that seems unlikely, you can place a few echo statements in your code to make sure the file path is accurate

fsgl wrote on Saturday, October 18, 2014:

Are you using 4.1.2 (7) or 4.1.3?

What happened when you try to print the document from Report? Provide more details & if need be, screenshots.

In either case Stephen will have to help with the new script (“tweaking”) for your Windows 7 (?) machine.

If you are using 4.1.3; there is another option, Templates for Patient Documents, which does not involve coding because the template is generated from OpenOffice Writer.