保存轴测图
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,12 @@
|
||||
using Aspose.Words.Rendering;
|
||||
using BLL;
|
||||
using Model;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UglyToad.PdfPig;
|
||||
using UglyToad.PdfPig.Content;
|
||||
using UglyToad.PdfPig.Writer;
|
||||
@@ -64,37 +67,7 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
{
|
||||
return;
|
||||
}
|
||||
using (var pdf = PdfDocument.Open(fileUrl))
|
||||
{
|
||||
|
||||
for (int i = 0; i < pdf.NumberOfPages; i++)
|
||||
{
|
||||
var page = pdf.GetPage(i + 1);
|
||||
var rotation = page.Rotation;
|
||||
|
||||
var outputPath = $"{rootPath}/File/page_{i + 1}.pdf";
|
||||
|
||||
using (var writer = new PdfDocumentBuilder())
|
||||
{
|
||||
PdfPageBuilder newPage = null;
|
||||
if (rotation.Value != 0 && rotation.Value != 180)
|
||||
{
|
||||
newPage = writer.AddPage(page.Height, page.Width);
|
||||
}
|
||||
else
|
||||
{
|
||||
newPage = writer.AddPage(page.Width, page.Height);
|
||||
}
|
||||
|
||||
newPage.CopyFrom(page);
|
||||
// 3. 关键:清除旋转标记 + 反向旋转内容(修正视觉方向)
|
||||
// 清除 /Rotate 标记
|
||||
newPage.SetRotation(new PageRotationDegrees(rotation.Value));
|
||||
var newPdf = writer.Build();
|
||||
File.WriteAllBytes(outputPath, newPdf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,7 +76,71 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
{
|
||||
Grid1.Hidden = true;
|
||||
contentPanel1.Hidden =false ;
|
||||
string rootPath = Server.MapPath("~/");
|
||||
Dictionary<string,List<int>> dic= new Dictionary<string, List<int>>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
if (!dic.ContainsKey(row["pipe_no"].ToString()))
|
||||
{
|
||||
dic.Add(row["pipe_no"].ToString().Trim(),new List<int>());
|
||||
}
|
||||
dic[row["pipe_no"].ToString().Trim()].Add(int.Parse(row["page_no"].ToString()));
|
||||
}
|
||||
using (var pdf = PdfDocument.Open(fileUrl))
|
||||
{
|
||||
|
||||
for (int i = 0; i < pdf.NumberOfPages; i++)
|
||||
{
|
||||
var page = pdf.GetPage(i + 1);
|
||||
var rotation = page.Rotation;
|
||||
|
||||
string outputPath = "";
|
||||
string isono = "";
|
||||
foreach (string key in dic.Keys)
|
||||
{
|
||||
if (dic[key].IndexOf(i+1) >= 0)
|
||||
{
|
||||
isono = key;
|
||||
outputPath = $"{rootPath}/File/PDF/Pipe/" + key;
|
||||
if (!Directory.Exists(outputPath))
|
||||
{
|
||||
Directory.CreateDirectory(outputPath);
|
||||
}
|
||||
outputPath = $"{outputPath}/" + key + dic[key].IndexOf(i) + ".pdf";
|
||||
}
|
||||
}
|
||||
|
||||
using (var writer = new PdfDocumentBuilder())
|
||||
{
|
||||
PdfPageBuilder newPage = null;
|
||||
if (rotation.Value != 0 && rotation.Value != 180)
|
||||
{
|
||||
newPage = writer.AddPage(page.Height, page.Width);
|
||||
}
|
||||
else
|
||||
{
|
||||
newPage = writer.AddPage(page.Width, page.Height);
|
||||
}
|
||||
|
||||
newPage.CopyFrom(page);
|
||||
// 3. 关键:清除旋转标记 + 反向旋转内容(修正视觉方向)
|
||||
// 清除 /Rotate 标记
|
||||
newPage.SetRotation(new PageRotationDegrees(rotation.Value));
|
||||
var newPdf = writer.Build();
|
||||
File.WriteAllBytes(outputPath, newPdf);
|
||||
|
||||
var isoInfo = Funs.DB.HJGL_PW_IsoInfo.FirstOrDefault(x => x.ISO_IsoNo == isono && x.ProjectId==CurrUser.LoginProjectId);
|
||||
if (isoInfo != null)
|
||||
{
|
||||
//保存文件到附件
|
||||
|
||||
UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(outputPath.Replace(rootPath, ""), 10, null), outputPath.Replace(rootPath, ""), Const.HJGL_PipelineManageMenuId, isoInfo.ISO_ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void btnAudit_Click(object sender, EventArgs e)
|
||||
@@ -112,37 +149,40 @@ namespace FineUIPro.Web.HJGL.DataIn
|
||||
contentPanel1.Hidden = true;
|
||||
btnAudit.Hidden = true;
|
||||
btnSave.Hidden = false;
|
||||
JObject jobject = JObject.Parse(resultdata.Value);
|
||||
JArray jArray = jobject.Value<JArray>("material_rows");
|
||||
dt = new DataTable();
|
||||
dt.Columns.Add("id");
|
||||
dt.Columns.Add("pipe_no");
|
||||
dt.Columns.Add("drawing_number");
|
||||
dt.Columns.Add("seq_no");
|
||||
dt.Columns.Add("category");
|
||||
dt.Columns.Add("description");
|
||||
dt.Columns.Add("spec");
|
||||
dt.Columns.Add("qty");
|
||||
dt.Columns.Add("page_no");
|
||||
dt.Columns.Add("remark");
|
||||
|
||||
// 遍历并提取数据
|
||||
foreach (JObject item in jArray)
|
||||
if (!string.IsNullOrEmpty(resultdata.Value))
|
||||
{
|
||||
var row = dt.NewRow();
|
||||
row["id"] = item.Value<string>("id");
|
||||
row["pipe_no"] = item.Value<string>("pipe_no");
|
||||
row["drawing_number"] = item.Value<string>("drawing_number");
|
||||
row["seq_no"] = item.Value<string>("seq_no");
|
||||
row["category"] = item.Value<string>("category");
|
||||
row["description"] = item.Value<string>("description");
|
||||
row["spec"] = item.Value<string>("spec");
|
||||
row["qty"] = item.Value<string>("qty");
|
||||
row["page_no"] = item.Value<string>("page_no");
|
||||
row["remark"] = item.Value<string>("remark");
|
||||
dt.Rows.Add(row);
|
||||
JObject jobject = JObject.Parse(resultdata.Value);
|
||||
JArray jArray = jobject.Value<JArray>("material_rows");
|
||||
dt = new DataTable();
|
||||
dt.Columns.Add("id");
|
||||
dt.Columns.Add("pipe_no");
|
||||
dt.Columns.Add("drawing_number");
|
||||
dt.Columns.Add("seq_no");
|
||||
dt.Columns.Add("category");
|
||||
dt.Columns.Add("description");
|
||||
dt.Columns.Add("spec");
|
||||
dt.Columns.Add("qty");
|
||||
dt.Columns.Add("page_no");
|
||||
dt.Columns.Add("remark");
|
||||
|
||||
// 遍历并提取数据
|
||||
foreach (JObject item in jArray)
|
||||
{
|
||||
var row = dt.NewRow();
|
||||
row["id"] = item.Value<string>("id");
|
||||
row["pipe_no"] = item.Value<string>("pipe_no");
|
||||
row["drawing_number"] = item.Value<string>("drawing_number");
|
||||
row["seq_no"] = item.Value<string>("seq_no");
|
||||
row["category"] = item.Value<string>("category");
|
||||
row["description"] = item.Value<string>("description");
|
||||
row["spec"] = item.Value<string>("spec");
|
||||
row["qty"] = item.Value<string>("qty");
|
||||
row["page_no"] = item.Value<string>("page_no");
|
||||
row["remark"] = item.Value<string>("remark");
|
||||
dt.Rows.Add(row);
|
||||
}
|
||||
BindGrid();
|
||||
}
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user