The SimpleInvoices forum has moved to Google Plus - this forum is now read-only
PDF multipage invoice. header and footer [Feature:Open]
  • January 1970 Edit

    Hi guys,

    Generated pdfs need to have header and footers for multipage invoices.

    Later,
    Ruben

    PS : how about I start collecting all the feature requests, add them to the wiki and prioritize them ?

  • aplysiaaplysia June 2007

    Already thought about this. But didn't start to implement it. Would be a great idea. Will send you an e-mail with more features.

  • RubenRuben June 2007

    Great! Already started on the wiki.

  • SuperRoachSuperRoach June 2007

    That would be hard to do... I'm imagining the pdf printer grabs the webpage, and doesn't know/care when the next page begins and ends. You could lock in values, but then if they don't print A4 you'll run into the size not being right :/

    A hard workaround may be a recursive/looping webpage, that if there is more than one page, seperates it so it re-places the footer and header..

  • aplysiaaplysia June 2007

    I'm more thinking about such stuff...
    http://www.w3schools.com/css/css_ref_print.asp

    or changing the pdf after creation for example with zend_pdf

  • RubenRuben June 2007

    Should the info used to generate the pdf not just be grabbed from the database directly instead of being parsed from the html page ?

  • aplysiaaplysia June 2007

    That's in principal a good idea. But how do you define the design of a page? So it's the easiest to take the print-preview and make a pdf out of it.

  • SuperRoachSuperRoach July 2007

    agreed with aplysia, having things output to a html page is a semi-godsend, it lets you play with css and other things to make your own templates...

  • SuperRoachSuperRoach July 2007

    not sure if this will help, but you can page seperate using css apparantly:
    http://www.ucl.ac.uk/is/documents/printcss/

    Relevant part:
    This can be used to force a page break within a document. So you might want all

    (Heading1) elements to begin on a new page:

    h1 {
    page-break-before: always;
    }

    Alternatively you may want to use it in a class and manually apply it to certain elements to improve the presentation of the content in print form:

    .pagebreak {
    page-break-before: always;
    }


    Would css pagebreaking be picked up in the pdf parser though?

  • justinjustin July 2007

    Hey SuperRoach

    thanks for the links

    re pagebreak being picked up
    - pdf should pick it up
    - but we cant guarantee where page breaks should go - as in invoice may have unknown amounts of invoice items (which force a new page) adding a page break specifiy somewhere may make some invoices look funny

    re Ruben - pdf from db
    - making pdfs in php is not easy - but using html2pdf to grab a webpage and convert is very easy :)

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • SuperRoachSuperRoach July 2007

    and html2pdf is great for the css styling side too ;)

    Good point where a x amount of invoice items would break a page size.

    A hack would be after y items (y being the amount of lines on a a4 page it takes to break a page), insert a linebreak type tag into the html.

  • RubenRuben July 2007

    BUT !! html2ps is the biggest resource hogger/slowpoke in si and that alone should be reason enough to get rid of it. Off to bed now. Really.

  • aplysiaaplysia July 2007

    @Ruben: That's true. But we need an other tool. Any suggestions?

  • SuperRoachSuperRoach August 2007

    I done a google search, and couldn't find much.

    http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html.html

    Is a alternative, java based and rather complex looking to install. i read through the pages however, and it appears that it lets you set header and footer margins, and all kinds of neat stuff.

    This one seems a bit better:
    http://www.reportlab.org/downloads.html
    But I don't know anything about it.

  • justinjustin August 2007

    Thanks SuperRoach,

    a couple of more liks - these are php solutions

    http://www.easysw.com/htmldoc/pdf-o-matic.php
    http://www.phpclasses.org/browse/package/2905.html
    http://www.rustyparts.com/pdf.php
    http://www.digitaljunkies.ca/dompdf/
    http://html2fpdf.sourceforge.net/

    i had a look at the dompdf solution a while ago and it didnt convert the invoices very well

    if anyones got any time feel free to check out these solution and let us know if anyone them are any good for us

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • awiese2007awiese2007 March 2008

    Hi guys,

    first of all i would like to thank you for your great work. i am using si for almost a year now and it is simply great, keep up the good work :D

    ...but this multipage footer and header issue is reaaaaaaaaaallllllyyy important. why? in many countries it is mandatory thru the laws to
    have certain information on every business document (like invoices). if they are missing the the invoice is invalid and that can get you into
    serious trouble (costumer's accounting or in case of a review of your own accounting by the tax department...).

    i think the best solution for users would be the introduction of a specific css-class that indicates the head + footer (eg

  • justinjustin April 2008

    Thanks LG Andres,

    if anyone wants to help out developing for Simple Invoices - fixing this would be a great start

    Cheers

    Justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • gourgour March 2010

    Hello,

    I'm not sure what is the current status of this issue and I'll probably use GNUCash for my accounting/invoices, but since customizing reports in it require to learn some Scheme/Guile, I wanted to try some of the open-source invoicing apps to find one which could be used temporarily instead of GNUCash.

    SI is the only app I've been familiar with and would probably already deploy it, but missing support for Postgres was an issue for me.

    After some investigation I found the following post: http://www.opentech.dk/2009/09/07/implementing-an-open-source-multiuser-multiuser-invoice-system/ which lists several invoicing apps.

    I've started with Bamboo Invoice - I had too many issues to install it, but when installed it looks nice.

    However, the disappointment followed after I discovered that it cannot display Croatian characters (?,?,?,š,ž) in PDF due to using non-capable dompdf lib.

    I've tried the other packages, and both Siwapp & My Client Base use the same lib. :-(

    Even phpBMS could not properly display required characters, which leaves SI as clear winner. ;)

    So, in any case, pls. do not consider dompdf!!!


    Sincerely,
    Gour

  • justinjustin March 2010

    thanks gour

    i think converting Simple Invoices mysql to postgres would be easier than learning scheme/guile

    if you want postgres support for Simple Invoices just svn checkout our development release - install Simple Invoices - then get the mysql db structure and convert it to postgres

    then adjust the config/config.ini file to say your now using pdo_postgres and use Simple Invoices - when you come to an error then refer the relevant sql and write the postgres variant of it - and repeat till all of Simple Invoices is OK with Postgres

    just send me your gmail username and i'll add you to the svn commit list

    let me know your thoughts

    cheers

    justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • gourgour March 2010

    hello justin,

    i think converting Simple Invoices mysql to postgres would be easier than learning scheme/guile

    it might be, but gnucash provides more stuff.

    if you want postgres support for Simple Invoices just svn checkout our development release - install Simple Invoices - then get the mysql db structure and convert it to postgres

    i've tried to achieve that by converting from mysql to postgres with the help of mysql2postgres project (see http://github.com/maxlapshin/mysql2postgres), but i simply could not start SI...installer is not wanting to launch. :-(

    I posted about my problem sometime ago (see http://simpleinvoices.org/forum/discussion/1095/help-with-postgresql-port-needed/#Item_1), but did not receive any reply.

    Then I've become involved with GNUCash which brings database back-end in upcoming 2.4 version (I run 2.3.x trunk).

    You already put me on the list sometime ago, but then I didn't have time to play with it.

    For now, for the start I may use SI with mysql, but with the intention to migrate to GNUCash eventually.

    Let's hope that Postgres is interesting for someone else who can help more.


    Sincerely,
    Gour

  • nikolasnikolas January 2011

    for footer, use:
    div id="footer" style="position: fixed; bottom: -10mm; left: 0;"| FOOTER | end div
    for header use:
    div style="position: fixed; top: -10mm; left: 0pt;"| HEADER | end div

    I found this on http://www.tufat.com/docs/html2ps/samples/headfoot.html

    Thank you for this nice software, I also integrated sms functionality and it rocks!

  • dotjaydotjay May 2012

    Thanks for the help in this thread. I was able to get a footer in the generated PDF using a container div for the whole page and this CSS:
    #container {
    position: relative;
    }
    #footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    }

    But it doesn't display nicely in browsers. Since JavaScript is parsed by browsers, but not the PDF generator, I was able to override the CSS for rendering in browsers and emulate an A4 page:

    In your template HTML:

    <body>
    <script type="text/javascript">document.getElementsByTagName('body')[0].className = 'js';</script>

    In your CSS:

    /* Emulate A4 page */
    .js #container {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    }
    /* Anchor footer at the bottom */
    .js #footer {
    position: absolute;
    }

    It relies on JavaScript, but it works. I also spruced up the page with a CSS3 paper effect based on the ideas here:
    http://nicolasgallagher.com/css-drop-shadows-without-images/

    The CSS I use:

    body.js{
    background: #f6f6f6;
    }
    .js #container{
    position: relative;
    margin-top: 2em;
    margin-bottom: 4em;
    background: white;
    -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.05) inset;
    -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.05) inset;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.05) inset;
    -moz-border-radius: 1px;
    border-radius: 1px;
    }
    .js #container:before,
    .js #container:after{
    content: "";
    position: absolute;
    z-index: -2;
    bottom: 15px;
    left: 10px;
    width: 50%;
    height: 20%;
    max-width: 300px;
    -webkit-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.5);
    -moz-box-shadow: 0 15px 10px rgba(0, 0, 0, 0.5);
    box-shadow: 0 15px 10px rgba(0, 0, 0, 0.5);
    -webkit-transform: rotate(-3deg);
    -moz-transform: rotate(-3deg);
    -ms-transform: rotate(-3deg);
    -o-transform: rotate(-3deg);
    transform: rotate(-3deg);
    }
    .js #container:after{
    right: 10px;
    left: auto;
    -webkit-transform: rotate(3deg);
    -moz-transform: rotate(3deg);
    -ms-transform: rotate(3deg);
    -o-transform: rotate(3deg);
    transform: rotate(3deg);
    }

  • malikinammalikinam June 2012

    this forum is full of information and i like this forum very much and i hope you like to share some more with others which is helpful for me and others..
    thanks..

Categories