cad.net 读取pc3,pmp 读取pc3打印机文件
Posted jjbox
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cad.net 读取pc3,pmp 读取pc3打印机文件相关的知识,希望对你有一定的参考价值。
修改pc3文件还没做好..大家先look look怎么读....
首先弄一个控制台程序,
然后去下载 Ionic.Zip 这个东西...载到控制台...都很简单...
然后就是复制下面代码,看控制台显示和代码注释....
namespace ConsoleApp1 { class Program { static void Main() { string pc3Path = @"D:\\桌面\\DWG To PDF.pc3"; //cad2008的东西 Pc3PmpDecompress(pc3Path, pc3Path + ".txt"); //解压 } /// <summary> /// 解压pc3和pmp打印机文件 /// </summary> /// <param name="pc3OrPmpPath">打印机路径</param> /// <param name="txtPathOut">输出txt路径</param> public static void Pc3PmpDecompress(string pc3OrPmpPath, string txtPathOut) { using (FileStream fs = File.Open(pc3OrPmpPath, FileMode.Open, FileAccess.ReadWrite)) { //版本信息 int ver1 = 48; { byte[] buffer = new byte[ver1]; fs.Read(buffer, 0, ver1); string str = Encoding.Default.GetString(buffer); Console.Write(Environment.NewLine + "版本信息:" + Environment.NewLine + str); } //12字节=3个int,第一个记录 "校验和" "adler"方式 int ver2 = 4; { //"校验和"读取 byte[] checkSum = new byte[ver2]; fs.Read(checkSum, 0, ver2); //转为16进制再读 var ss = new List<string>(); for (int index = 0; index < checkSum.Length; index++) { var shiliu = ((int)checkSum[index]).ToString("X2"); ss.Add(shiliu); } Console.Write(Environment.NewLine + "压缩校验和:" + Environment.NewLine + string.Join(" ", ss.ToArray())); } int ver3 = 8; { //第二个是原始数据的字节数 //第三个是压缩后的字节数 BinaryReader br = new BinaryReader(fs); var ss = new int[2]; for (int i = 0; i < 2; i++) { ss[i] = br.ReadInt32(); } Console.Write(Environment.NewLine + "原始数据的字节数:" + Environment.NewLine + ss[0].ToString()); Console.Write(Environment.NewLine + "压缩后的字节数:" + Environment.NewLine + ss[1].ToString()); } int ver4 = ver1 + ver2 + ver3; //前面头信息不能解压 fs.Seek(ver4, SeekOrigin.Begin);//从新设置开始的位置,但是不设置也会自动读到这里 using (ZlibStream zs = new ZlibStream(fs, CompressionMode.Decompress))//zip流,解压 { using (StreamReader sr = new StreamReader(zs, Encoding.Default))//流读取器 乱码原因 { string str = sr.ReadToEnd(); //读到结束 using (FileStream fs_out = File.Open(txtPathOut, FileMode.Create, FileAccess.ReadWrite))//新建文本 { byte[] bys = Encoding.Default.GetBytes(str); var lenhth = Encoding.Default.GetBytes(str).Length; fs_out.Write(bys, 0, lenhth);//写入读取的信息 } Console.Write(Environment.NewLine + "压缩包内容:" + Environment.NewLine + str); } zs.Dispose(); } fs.Dispose(); } Console.ReadKey(); } } }
特别感谢的是找到方法的疯狂青蛙: http://www.cnblogs.com/cadlife
和不厌其烦教我怎么读16进制的e大: https://www.cnblogs.com/edata
然后是瞎几把翻译,原因是我还没读透这些东西....部分?号可能是乱码,具体还没设置好
meta 元数据{ user_defined_model_pathname 用户定义的模型路径="F:\\K01.惊惊盒子\\04.工作小工具\\2019dwgToPdf打印机\\DWG To PDF.pmp user_defined_model_basename 用户定义的模型基名=" driver_pathname 驱动程序路径名="C:\\Program Files (x86)\\AutoCAD 2008\\drv\\gdiplot9.hdi driver_version 驱动程序版本="1.1-9.1.51.0 driver_tag_line 驱动标记线 ="Windows 系统驱动程序 - 由 Autodesk 提供 toolkit_version 工具工具包版本=1 driver_type 驱动程序类型=1 canonical_family_name 简洁表达的家庭名称="System show_custom_first 先显示自定义=TRUE truetype_as_text 类型是文本=TRUE canonical_model_name 规范模型名称="System localized_family_name 本地化的家庭名称="系统 localized_model_name 局部模型名称="系统 file_only 只有文件=FALSE model_abilities 模型能力="555555555055 udm_description UDM描述=" win_device_name 视窗系统设备名称="pdfFactory Pro win_driver_name 视窗系统设备名称= "pdfFactory 6 short_net_name 短网名="pdfFactory Pro friendly_net_name 友好的网络名称="FPP6: dm_driver_version dm_驱动程序版本=1555 default_system_cfg 默认系统配置=FALSE platform 平台="2,6,1 locale 现场="4B00409 } mod{ media 媒体{ abilities 能力="100004455400144444000005005005000400000000000005000 caps_state caps状态="00000 ui_owner 拥有人="22212222121111212112221 size_max_x 纸张最大的规格的x=914.40002441 ( 0#.3C$ &[email protected]) size_max_y 纸张最大的规格的y=1219.2000732 ( X,P,DT 5‘@) description 描述{ 0{ caps_type=1 name 名称="ISO_A4_Portrait_210.00W_x_297.00H_-_(5,_17)_x_(205,_280)_=52600_MM media_bounds_urx 媒体边界x=210.0 media_bounds_ury 媒体边界y=297.0 printable_bounds_llx 可打印长边边界x=0.0 printable_bounds_lly 可打印长边边界y=0.0 printable_bounds_urx 可打印短边边界x=210.0 printable_bounds_ury 可打印短边边界y=297.0 printable_area 可打印面积=62370.0 dimensional 尺寸=TRUE } //其他的都是每个纸张的信息 1{ caps_type=1 name="ISO_A4_Landscape_297.00W_x_210.00H_-_(5,_17)_x_(292,_193)_=50512_MM media_bounds_urx=297.0 media_bounds_ury=210.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=297.0 printable_bounds_ury=210.0 printable_area=62370.0 dimensional=TRUE } 2{ caps_type=1 name="ISO_A3_Portrait_297.00W_x_420.00H_-_(5,_17)_x_(292,_403)_=110782_MM media_bounds_urx=297.0 media_bounds_ury=420.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=297.0 printable_bounds_ury=420.0 printable_area=124740.0 dimensional=TRUE } 3{ caps_type=1 name="ISO_A3_Landscape_420.00W_x_297.00H_-_(5,_17)_x_(415,_280)_=107830_MM media_bounds_urx=420.0 media_bounds_ury=297.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=420.0 printable_bounds_ury=297.0 printable_area=124740.0 dimensional=TRUE } 4{ caps_type=1 name="ISO_A2_Portrait_420.00W_x_594.00H_-_(5,_17)_x_(415,_577)_=229600_MM media_bounds_urx=420.0 media_bounds_ury=594.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=420.0 printable_bounds_ury=594.0 printable_area=249480.00000 ( $!T#D$:G ) dimensional=TRUE } 5{ caps_type=1 name="ISO_A2_Landscape_594.00W_x_420.00H_-_(5,_17)_x_(589,_403)_=225424_MM media_bounds_urx=594.0 media_bounds_ury=420.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=594.0 printable_bounds_ury=420.0 printable_area=249480.00000 ( $!T#D$:G ) dimensional=TRUE } 6{ caps_type=1 name="ISO_A1_Portrait_594.00W_x_841.00H_-_(5,_17)_x_(589,_824)_=471288_MM media_bounds_urx=594.0 media_bounds_ury=841.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=594.0 printable_bounds_ury=841.0 printable_area=499554.00000 ( (A]‘D&X?P) dimensional=TRUE } 7{ caps_type=1 name="ISO_A1_Landscape_841.00W_x_594.00H_-_(5,_17)_x_(836,_577)_=465360_MM media_bounds_urx=841.0 media_bounds_ury=594.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=841.0 printable_bounds_ury=594.0 printable_area=499554.00000 ( (A]‘D&X?P) dimensional=TRUE } 8{ caps_type=1 name="ISO_expand_A1_Portrait_594.00W_x_841.00H_-_(5,_10)_x_(589,_831)_=479464_MM media_bounds_urx=594.0 media_bounds_ury=841.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=594.0 printable_bounds_ury=841.0 printable_area=499554.00000 ( (A]‘D&X?P) dimensional=TRUE } 9{ caps_type=1 name="ISO_expand_A1_Landscape_841.00W_x_594.00H_-_(5,_10)_x_(836,_584)_=476994_MM media_bounds_urx=841.0 media_bounds_ury=594.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=841.0 printable_bounds_ury=594.0 printable_area=499554.00000 ( (A]‘D&X?P) dimensional=TRUE } 10{ caps_type=1 name="ISO_A0_Portrait_841.00W_x_1189.00H_-_(5,_17)_x_(836,_1172)_=959805_MM media_bounds_urx=841.0 media_bounds_ury=1189.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=841.0 printable_bounds_ury=1189.0 printable_area=999949.00000 ( !J$+D$QEP) dimensional=TRUE } 11{ caps_type=1 name="ISO_expand_A0_Portrait_841.00W_x_1189.00H_-_(5,_10)_x_(836,_1179)_=971439_MM media_bounds_urx=841.0 media_bounds_ury=1189.0 printable_bounds_llx=0.0 printable_bounds_lly=0.0 printable_bounds_urx=841.0 printable_bounds_ury=1189.0 printable_area=999949.00000 ( !J$+D$QEP) dimensional=TRUE } } } } del 删除{ media 美体{ abilities 能力="100004455400144444000005005005000400000000000005000 caps_state ="00000 ui_owner 拥有人="22212222121111212112221 size_max_x =914.40002441 ( 0#.3C$ &[email protected]) size_max_y=1219.2000732 ( X,P,DT 5‘@) } } udm{ calibration{ _x=1.0 _y=1.0 } media{ abilities="100004455400144444000005005005000400000000000005000 caps_state="00000 ui_owner="22212222121111212112221 size_max_x=914.40002441 ( 0#.3C$ &[email protected]) size_max_y=1219.2000732 ( X,P,DT 5‘@) } } hidden 隐藏的{ media 媒体{ abilities 能力="100004455400144444000005005005000400000000000005000 caps_state="00000 ui_owner="22212222121111212112221 size_max_x=914.40002441 ( 0#.3C$ &[email protected]) size_max_y=1219.2000732 ( X,P,DT 5‘@) } }
以上是关于cad.net 读取pc3,pmp 读取pc3打印机文件的主要内容,如果未能解决你的问题,请参考以下文章
2PC3PCPaxosRaftZABNWR一致性协议算法集合