2017-03-02 17 views
0

私たちのアプリケーションの1つでは、ブラウザを介してユーザーに表示されるHTMLレポートを作成しています。これはその後、電子メールで送信するか、後で閲覧できるPDFファイルに変換されます。レポートは、医療/ライフスタイルとして分類することができます。私は、さまざまなPDF(s)の選択と埋め込みを許可するように求められています。さまざまな食事や練習をHTMLに組み込むことができます。このソフトウェアは、Python 2.7とwxPython 2.8で書かれています。私はHTMLにPDFを埋め込んで表示し、すべてを最終的なPDFに変換する方法を見つけようとしています。HTMLへのPDFのインポート/埋め込み

答えて

0

私は数ヶ月前にこの分野で広範な研究を行った。あなたがHTMLを使用してPDFを表示したい場合は、あなたの目標は、私は戻ってPDFを生成して送信するためのサーバー側のソリューションであるhttps://github.com/fraserxu/electron-pdfをお勧めしますHTMLページからPDFを生成することであるならば、私は最初https://github.com/mozilla/pdf.js

になりますクライアントに送信します。

electron-pdfを使用すると、最高のレイテンシーでElectronインスタンスを実行し続けるNode.JS APIサーバーの後ろで実行することができます。または、CLIを使用してPythonコードからエクスポートを呼び出すこともできます。

Readmeには、基本的な使用方法が記載されています。 Linux上で実行されている、wkhtmltopdf
をチェックアウトする場合は、次のよう

0

はmanページには、次のとおりです。

Name: 
    wkhtmltopdf 0.12.2.4 

Synopsis: 
    wkhtmltopdf [GLOBAL OPTION]... [OBJECT]... <output file> 

Document objects: 
    wkhtmltopdf is able to put several objects into the output file, an object is 
    either a single webpage, a cover webpage or a table of content. The objects 
    are put into the output document in the order they are specified on the 
    command line, options can be specified on a per object basis or in the global 
    options area. Options from the Global Options section can only be placed in 
    the global options area 

    A page objects puts the content of a singe webpage into the output document. 

    (page)? <input url/file name> [PAGE OPTION]... 
    Options for the page object can be placed in the global options and the page 
    options areas. The applicable options can be found in the Page Options and 
    Headers And Footer Options sections. 

    A cover objects puts the content of a singe webpage into the output document, 
    the page does not appear in the table of content, and does not have headers 
    and footers. 

    cover <input url/file name> [PAGE OPTION]... 
    All options that can be specified for a page object can also be specified for 
    a cover. 

    A table of content object inserts a table of content into the output document. 

    toc [TOC OPTION]... 
    All options that can be specified for a page object can also be specified for 
    a toc, further more the options from the TOC Options section can also be 
    applied. The table of content is generated via XSLT which means that it can be 
    styled to look however you want it to look. To get an aide of how to do this 
    you can dump the default xslt document by supplying the 
    --dump-default-toc-xsl, and the outline it works on by supplying 
    --dump-outline, see the Outline Options section. 

Description: 
    Converts one or more HTML pages into a PDF document, *not* using wkhtmltopdf 
    patched qt. 

Global Options: 
     --collate      Collate when printing multiple copies 
             (default) 
     --no-collate     Do not collate when printing multiple 
             copies 
     --copies <number>    Number of copies to print into the pdf 
             file (default 1) 
    -H, --extended-help     Display more extensive help, detailing 
             less common command switches 
    -g, --grayscale      PDF will be generated in grayscale 
    -h, --help       Display help 
     --license      Output license information and exit 
    -l, --lowquality     Generates lower quality pdf/ps. Useful to 
             shrink the result document space 
    -O, --orientation <orientation>  Set orientation to Landscape or Portrait 
             (default Portrait) 
    -s, --page-size <Size>    Set paper size to: A4, Letter, etc. 
             (default A4) 
    -q, --quiet       Be less verbose 
     --read-args-from-stdin   Read command line arguments from stdin 
     --title <text>     The title of the generated pdf file (The 
             title of the first document is used if not 
             specified) 
    -V, --version      Output version information and exit 
関連する問題