[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LaTeX - some logos print, others don't.



Hi Stroller;

We only treat the default logos specially because we don't know where
the proper path is at install time.  It is likely that 1.3 will have a
more elegant solution (probably fixing the templates to use an
absolute path).

The preferred fix for the user templates is to do as follows:

Instead of:

\includegraphics[height=1cm]{logo-colour}

use:
\includegraphics[height=1cm]{/path/to/logo-colour}

I.e. use the absolute path.

Best Wishes,
Chris Travers

On 4/22/07, Stroller <..hidden..> wrote:
Ok,

I've condensed the description of my problem below, so it's worth re-
reading if you don't know what I'm on about.

Basically, this code:

     my $temphash;
     if ( $self->{format} =~ /(postscript|pdf)/ || $self->{media} eq
'email' ) {
         $temphash{out} = $self->{OUT};
         $self->{OUT} = "$self->{tmpfile}";
         File::Copy::copy(
             "$self->{templates}/logo.png",
             "${LedgerSMB::Sysconfig::tempdir}/"
         );
         File::Copy::copy(
             "$self->{templates}/logo.eps",
             "${LedgerSMB::Sysconfig::tempdir}/"
         );

from Form.pm treats the filenames logo.png and logo.eps specially,
when printing invoices. It didn't around SL 2.6.21 or so.

So a user template wanting to include other graphics b0rks out. As I
described in my previous reply to Chris' below comments <http://
tinyurl.com/2mjfqo>, full path names to additional graphics don't
_seem_ to work for me.

IE:
   # sudo grep logo /usr/local/ledger-smb/templates/stroller/invoice.tex
   \includegraphics[height=2cm]{logo}
   \includegraphics[height=2cm]{/usr/local/ledger-smb/templates/
stroller/logo-outline}
   \includegraphics[height=2cm]{/usr/local/ledger-smb/templates/
stroller/logo-outline.png}
   \includegraphics[height=2cm]{/usr/local/ledger-smb/templates/
stroller/logo-outline.eps}

_still_ only prints out the file called "logo".

Anyway, this is a problem, because here I use the ifpdf package to
determine whether to print my colour logo or my black & white one:

   \ifpdf
     \includegraphics[height=1cm]{logo-colour}
   \else
     \includegraphics[height=1cm]{logo-outline}
   \fi

This is because my full-colour logo looks rubbish when printed out on
my black & white laser printer. Customers get a full colour copy of
the logo when I email them the PDF version of the invoice - in black
& white the "outline" version of the logo looks much more professional.

Obviously, now I'm aware of the problem I can change "logo-colour.*"
to "logo.*" and I'm able to print something other than "SMB-Ledger"
at the top of my invoices.

To be honest, this isn't a massively big deal for me, as I only print
out my own copy of the invoice on my B&W laser printer, and this just
gets filed in my records, never to be seen by anyone important.

I assume that logo.png & logo.eps are treated special for security
reasons. I don't entirely understand this - if someone can inject my-
image.png. or .my-image.eps into both the templates directory & the
template itself, then can't they as easily just overwite the original
logo.* which you are trusting to be safe?

However, as I've demonstrated above, Chris' reply about the absolute
path doesn't _seem_ to be correct, so there's no way I can work
around it or for users to otherwise include multiple graphics in
their templates.

Stroller.



On 17 Apr 2007, at 06:28, Chris Travers wrote:
> ...
> In 1.2.2-3, you should change the LaTeX templates to use the absolute
> path to any custom logos.  We cant really parse the LaTeX to know
> which files to copy to /tmp/ and that would not be safe anyway.
> ...
>
> On 4/16/07, Stroller <..hidden..> wrote:
>> ...
>> Basically, my logos don't print in the invoice. The logo shipped with
>> L-SMB will print, but not mine ...
>>
>> ...
>>
>> It really frustrates me, because trying with this invoice.tex:
>>
>>    \documentclass{minimal}
>>    \usepackage[a4paper,landscape,dvips]{geometry}
>>    \geometry{a4paper,landscape,
>>              nohead,nofoot,
>>              left=15mm,right=15mm,top=1cm,bottom=1cm}
>>    \usepackage{graphicx}
>>    \begin{document}
>>    \noindent
>>    top-left\hfill top-right
>>    \noindent
>>    \includegraphics[height=2cm]{logo}
>>    \includegraphics[height=2cm]{logo-outline}
>>    \par \vfill
>>    \noindent
>>    bottom-left\hfill bottom-right
>>    \end{document}
>>
>> ... the logo shipped with Ledger-SMB (I created a new templates
>> directory for my user, based on the demo templates; I have nor
>> renamed or deleted or touched in anyway the L-SMB logos) prints fine,
>> but my logo (logo-outline) does not.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel