明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: langjs

[讨论] 如何获得某台打印机的纸张列表呢?(已解决)

  [复制链接]
 楼主| 发表于 2011-4-20 12:40 | 显示全部楼层
本帖最后由 langjs 于 2011-4-20 12:43 编辑

回复 Andyhon 的帖子

这是我的测试程序,返回结果不正确。是不是我调用您的程序调用错了?测试版本:CAD2004、CAD2008恳请老大指点,谢谢!看不懂Vlisp程序,一头雾水
;;;  测试程序
;;;  电脑安装的打印机,两个。
;;;  "pdfFactory Pro"
;;;  "HP LaserJet 5000 Series PCL"
(defun C:TT (/ ad uu)
  (vl-load-com)
  (setq ad (vla-get-activedocument (vlax-get-acad-object)))
  (setq uu (GetCanonicalMediaNamesOfConfigname ad "pdfFactory Pro")) ; 列表p
                                       ; dfFactory Pro打印机的纸张类型
  (princ "\n  pdfFactory Pro打印机的纸张类型为:\n")
  (princ uu)
  (princ)
)
;;; 得到uu的列表为:(User256 User281 User280 User279 User278 User277
;;; User276 User275 User274 User273 User272 User271 User270 User68 User67
;;; User66
;;; User65 User64 User63 User62 User61 User60 User59 User58 User57 User56
;;; User55
;;; User54 User53 User52 User51 User50 User47 User46 User45 User44 User43
;;; User42
;;; German Legal Fanfold German Std Fanfold US Std Fanfold 6 3/4 Envelope
;;; Envelope
;;; Monarch Envelope Envelope B6 Envelope B5 Envelope B4 Envelope C65
;;; Envelope C6
;;; Envelope C4 Envelope C3 Envelope C5 Envelope DL E size sheet D size
;;; sheet C
;;; size sheet Envelope #14 Envelope #12 Envelope #11 Envelope #10 Envelope
;;; #9 Note
;;; 11x17 10x14 Quarto Folio B5 (JIS) B4 (JIS) A5 A4 Small A4 A3 Executive
;;; Statement Legal Ledger Tabloid Letter Small Letter)
(defun GetCanonicalMediaNames (ad)
  (vla-RefreshPlotDeviceInfo (vla-get-activelayout ad))
  (vlax-safearray->list (vlax-variant-value
                                            (vla-GetCanonicalMediaNames
                                                                        (vla-item
                                                                                  (vla-get-layouts ad) "Model"
                                                                        )
                                            )
                        )
  )
)
(defun GetLocaleMediaNames (ad / mn mnl)
  (setq la (vla-item (vla-get-layouts ad) "Model"))
  (foreach mn (GetCanonicalMediaNames ad)
    (setq mnl (cons (vla-GetLocaleMediaName la mn) mnl))
  )
  (reverse mnl)
)
;;; (GetCanonicalMediaNamesOfConfigname ad "Acrobat PDFWriter")
(defun GetCanonicalMediaNamesOfConfigname (ad cn / oldcn al cmn)
  (setq al (vla-get-ActiveLayout ad))
  (setq oldcn (vla-get-configname al))
  (vla-put-configname al cn)
  (vla-RefreshPlotDeviceInfo al)
  (setq cmn (GetCanonicalMediaNames ad))
  (if (/= oldcn "None")
    (vla-put-configname al oldcn)
  )
  (setq CanPaperSizeLIst cmn)
  (setq layout al)
  (setq PaperSize '()
        index 0
  )
  cmn
)
;;; =================


发表于 2011-4-20 14:11 | 显示全部楼层
Google ..... then
如果您有解析注册表的功底
http://www.threatexpert.com/repo ... 9394c8178258b004c27
http://www.threatexpert.com/repo ... a2bd0c3a00409800378
http://www.threatexpert.com/repo ... 2630a30a88a3a1b8b35

未涉及这一环节,直以搜寻资料提供构思的参考
 楼主| 发表于 2011-4-21 08:30 | 显示全部楼层
感谢老大的帮助。谢谢
发表于 2012-12-20 17:01 | 显示全部楼层
太棒了,感谢langjs的分享,正是我需要的!
发表于 2023-11-14 22:43 | 显示全部楼层
langjs 发表于 2011-4-21 08:30
感谢老大的帮助。谢谢

大师,最终的源码在哪里?能给下吗
发表于 2024-1-23 20:12 | 显示全部楼层
你好,网络打印机怎么输入不了

(setq PaperSize (GetPaperList " \\192.168.0.142\左边"  ))

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-6 21:05 , Processed in 0.200848 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表