我無法設法讓pechkin或tuespechkin在我的天藍色網站上工作。在Azure中使用tuespechkin和MVC項目
每當我嘗試訪問站點時,它只是掛起而沒有錯誤信息(即使關閉customErrors)。有沒有進一步的設置我錯過了?一切都在當地完美運作
對於64位應用程序,我完成以下步驟:
- 創建一個新的空MVC應用程序有天青,使雲主機肯定選擇
更改應用到64位
登錄到蔚藍的門戶網站和升級應用基本存取,更改爲64位
- 安裝TuesPechkin.Wkhtmltox.Win64和TuesPechkin的NuGet包
添加一個單獨的類返回IConverter
public class TuesPechkinConverter { private static IConverter converter; public static IConverter Converter { get { if (converter == null) { converter = new ThreadSafeConverter( new PdfToolset( new Win64EmbeddedDeployment( new TempFolderDeployment()))); } return converter; } } }
添加家庭控制器與索引操作下面的代碼:
var document = new HtmlToPdfDocument { GlobalSettings = { ProduceOutline = true, DocumentTitle = "Pretty Websites", PaperSize = PaperKind.A4, // Implicit conversion to PechkinPaperSize Margins = { All = 1.375, Unit = Unit.Centimeters } }, Objects = { new ObjectSettings { HtmlText = "<h1>Pretty Websites</h1><p>This might take a bit to convert!</p>" }, new ObjectSettings { PageUrl = "www.google.com" } } }; byte[] pdfBuf = TuesPechkinConverter.Converter.Convert(document); return File(pdfBuf, "application/pdf", "DownloadName.pdf");
很抱歉,如果我誤解了,但我不認爲TuesPechkin實際工作的Azure網站(根據github頁面)https://github.com/tuespetre/TuesPechkin。原因是該庫使用的是GDI,它在azure下不可用。 – leon
啊,我發現現在 - 我可能需要使用第三方轉換服務:(開始調查它,因爲它在這裏提到http://stackoverflow.com/questions/23059144/pechkin-with-windows-azure – woggles
是還有其他任何可以將Azure上的HTML> PDF轉換爲快速且易於使用的替代方法嗎? – woggles