text_templates::create_pdf_content (public)

 text_templates::create_pdf_content -template_id template_id \
    -set_var_call set_var_call

Defined in packages/acs-tcl/tcl/pdf-procs.tcl

Create the pdf content from a template

Switches:
-template_id
(required)
The template to use for the preview. It is assumed that the template_id is the same as the revision_id to be used for the template.
-set_var_call
(required)
procedure-name which sets the variables used
Returns:
the pdf-file-name
Author:
Christian Langmann <C_Langmann@gmx.de>
Created:
2005-07-07

Partial Call Graph (max 5 caller/called nodes):
%3 ad_file ad_file (public) ad_tmpdir ad_tmpdir (public) parameter::get parameter::get (public) text_templates::create_html_content text_templates::create_html_content (private) text_templates::create_pdf_content text_templates::create_pdf_content text_templates::create_pdf_content->ad_file text_templates::create_pdf_content->ad_tmpdir text_templates::create_pdf_content->parameter::get text_templates::create_pdf_content->text_templates::create_html_content

Testcases:
No testcase defined.
Source code:
    
    # create html.file
    set html_content [create_html_content -template_id $template_id -set_var_call $set_var_call]
    set fp [file tempfile tmp_html_filename [ad_tmpdir]/pdf-XXXXXX.html]
    puts $fp $html_content
    close $fp

    # create pdf-file
    set tmp_pdf_filename "${tmp_html_filename}.pdf"
    set htmldoc_bin [parameter::get -parameter "HtmlDocBin" -default "/usr/bin/htmldoc"]
    if {[catch {exec $htmldoc_bin --webpage --quiet -t pdf -f $tmp_pdf_filename $tmp_html_filename} err]} {
        ns_log Error "Error during conversion from html to pdf: $err"
    }
    file delete -- $tmp_html_filename

    if {[ad_file exists $tmp_pdf_filename]} {
        return $tmp_pdf_filename
    } else {
        return ""
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: