2013-02-26 113 views
0

我想生成由Html定義的多媒體文檔(所謂的MIME)。
因此,我可以在a single mhtml (MIME) file here(如:mime_example.doc)中打包相關文件(例如htm,images ...)。
但我只得到了php implementation hereA basic MIME 1.0 class helper
(在 「基本MIME 1.0級幫手」 一節)
the method to generate的MHTML文件:如何用C++生成mhtml文件?

header('Content-Type: application/msword'); 
header('Content-disposition: filename=mydocument.doc') 
$doc = New mime10class(); 
$doc->addFile('mydocument.htm','text/html; charset="utf-8"','Hello, world !'); 
$doc->addFile('subdir\anotherfile.htm','text/html; charset="utf-8"','Hi there.'); 
echo $doc->getFile(); 

但如何實現這個用C++?
(有用的鏈接:MIME Encapsulation of Aggregate Documents, such as HTML (MHTML)

+1

http://code.google.com/p/chromium/codesearch#chromium/src/content/renderer/mh​​tml_generator.cc – 2013-02-26 11:00:30

+0

您可以隨時將正確格式化的文本轉換爲字符串(流)... – PlasmaHH 2013-02-26 11:01:13

+0

@aleguna :但我不想做一個鉻。 – Al2O3 2013-02-26 11:03:27

回答

0

我不知道是否是一個獨立的開源庫,做到這一點,但https://github.com/coolwanglu/pdf2htmlEX其將PDF轉換爲HTML和它得到選項打包相關文件(如HTM,圖片...)在一個單獨的html文件(默認情況下它不會),也許你可以使用這個項目的代碼作爲它的開源!