Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    template2pdf 0.6.5

    Download button

    No screenshots available
    Downloads: 375  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Yasushi Masuda | More programs
    LGPL / FREE
    June 28th, 2011, 12:41 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    template2pdf description

    Modules to render tRML template to PDF

    template2pdf generates PDF via trml2pdf using template engine(s): Superceding django_trml2pdf.

    Usage:
    Write your own tRML as a template

    < !DOCTYPE document SYSTEM "rml.dtd" >
    {% load pdf_tags %}
    < document filename="{{ pdf_name }}" >
     {% block template %}
     < template pagesize="({% block pagesize %}595, 841{% endblock %})"
     showBoundary="0" >
     {% block template_content %}
     < pageTemplate id="main" >
     {% block page_graphics %}
     < pageGraphics >
     {% block header %}
     {% endblock header %}
     {% block footer %}
     {% endblock footer %}
     < /pageGraphics >
     {% endblock page_graphics %}
     {% block frame %}
     < frame id="content"
     x1="{{ content_x1|default:"40" }}"
     y1="{{ content_y1|default:"60" }}"
     width="{{ content_width|default:"515" }}"
     height="{{ content_height|default:"710" }}"/ >
     {% endblock frame %}
     {% block extra_frames %}
     {% endblock extra_frames %}
     < /pageTemplate >
     {% endblock template_content %}
     < /template >
     {% endblock template %}
     {% block stylesheet %}
     < stylesheet >
     {% block styles %}
     < paraStyle name="Normal"
     fontName="{% firstof normal_font_name font_name "Serif" %}"
     fontSize="{% firstof normal_font_size font_size|default:"9" %}"
     textColor="{% firstof normal_text_color text_color "black" %}"
     wordWrap="CJK"
     / >
     {% endblock styles %}
     {% block extra_styles %}
     {% endblock extra_styles %}
     < /stylesheet >
     {% endblock stylesheet %}
     {% block story %}
     < story >
     {% block story_content %}
     {% block content %}
     < para style="Normal" >
     This is main content
     < /para >
     {% endblock content %}
     {% endblock story_content %}
     < /story >
     {% endblock story %}
    < /document >


    Note:

    * you may use of full-power of Django template: inheritance, filters, tags.
    * Unfortunately tRML does not support cross references.

    Render it in a view

    # coding: utf-8

    from django.http import HttpResponse
    from template2pdf.dj import direct_to_pdf

    def myview(request, template_name='somewhere/yourtemplate.rml'):
     params = {}
     # ... populate params in your order.
     return HttpResponse(
     direct_to_pdf(request, template_name, params),
     mimetype='application/pdf')


    Hint:

    * Setting Content-Disposition will tell your browser to download content as a file, instead of opening in it.


    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    PDF generator | tRML template | tRML renderer | template | PDF | generator

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM