30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using YLErp.Models;
|
|
|
|
namespace YLErp.Helpers
|
|
{
|
|
public class ConvertToPdfHelper
|
|
{
|
|
public static void ConvertPDFByApi(string templatePath, string outputFilePath)
|
|
{
|
|
var baseUrl = Environment.GetEnvironmentVariable("BondOmsInterface_BaseUrl");
|
|
var apiPath = $"/clientOrder/wordToPdf?inPath={templatePath}&toPath={outputFilePath}";
|
|
if (!string.IsNullOrEmpty(baseUrl))
|
|
{
|
|
var httpHelper = new HttpHelper(baseUrl, null);
|
|
// http 请求 Web项目接口
|
|
var result = httpHelper.GetRequestNoAuth<ApiResponse>(apiPath).Result;
|
|
if (result != null && !result.success)
|
|
{
|
|
LogFactory.GetLogger("PDF转换").Info("PDF转换失败:" + result.message);
|
|
throw new ServiceException("PDF转换失败:" + result.message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|