• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 3  文章 - 8  trackbacks - 0
            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            常用鏈接

            留言簿(3)

            隨筆檔案

            文章分類

            文章檔案

            COM相關(guān)技術(shù)

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            1.下載一個(gè)打印驅(qū)動(dòng).并修改里面的INF文件.

            2.修改DDK 里面的例子 genprint, 并使用ddk里的build命令直接build.
              (順帶說一下,執(zhí)行build程序要先執(zhí)行Windows XP Checked Build Environment 這樣的環(huán)境設(shè)置BAT)
              修改的地方是:winprint.c 里的 PrintDocumentOnPrintProcessor 函數(shù),將其中 調(diào)用PrintEMFJob的地方更改為我們處理的函數(shù).
              一般會(huì)將這個(gè)函數(shù)放在另一個(gè)DLL中.
             
            3.更改注冊(cè)表,使其spl文件名根據(jù)job id生成.這樣我們通過其JOB ID就可以得到相應(yīng)的SPL文件.
              參考:http://www.undocprint.org/winspool/spool_files#reading_job_data 里面的 Force JobID in Spoolfile names

            4.通過spl文件結(jié)構(gòu),獲取EMF文件。

            5.把EMF文件轉(zhuǎn)換為其它圖片文件。

             
            QA:
            Q:如何修改打印驅(qū)動(dòng)?我對(duì)里面的驅(qū)動(dòng)格式一點(diǎn)都不熟悉。
            A:不用改了,我用的是HP LaserJet 4驅(qū)動(dòng),下載地址:
              http://h50176.www5.hp.com/support/C2001A/more_info_soar_lj631sc.html
              
              以下是inf內(nèi)容:
            /////////////////////////////////////inf start///////////////////////////////////////
            ;Hewlett-Packard LaserJet combined printer driver INF file for Windows XP and 2000
            ;Copyright Hewlett-Packard 2001
            ; List of supported printers, manufacturers
            [Version]
            Signature="$Windows NT$"
            Provider=%虛擬打印%
            ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
            Class=Printer
            DriverVer=1/18/2002,02.00.12.02
            ; Manufacturer section.
            ;
            ; This section lists all of the manufacturers
            ; that we will display in the Dialog box
            [Manufacturer]
            %虛擬打印%=DefaultInstall

            ;
            ; MS Driver Core installs
            ;
            ; These sections are used by Printer OEMs to install MS provided drivers
            ; Installer Sections
            ;
            ; These sections control file installation, and reference all files that
            ; need to be copied. The section name will be assumed to be the driver
            ; file, unless there is an explicit DriverFile section listed.
            ;
            ; Note: Pulling HPLJ4.GPD via Needs= directive to get pcl5eres.dll from XP
            ;       drivers.cab file due to XP defect whereby this file wasn't listed
            ;       This also takes care of pjlmon.dll, ttfsub.gpd, UNIDRV sections
            ;       but unavoidably brings with it the unneeded hplj4.gpd file.
            ;     
            ;   In the case of the LJ4 install does Needs=HPLJ4.GPD overwrite the
            ;   just copied newer version of hplj4.gpd??? In this case perhaps, use
            ;   Needs=HPLJ4L.GPD to avoid this issue?
            ;
            ; Phase II GPDs
            [DefaultInstall]
            "虛擬打印機(jī)"                 = HPLJ4L.GPD.XP        ,Hewlett-PackardLaserC029,HP_LaserJet_4L
            ;Hewlett-PackardLaserC029是設(shè)備的ID
            ;
            ; XP
            ;Old CopyFiles statement before use of Includes= & Needs= ...
            ;CopyFiles=HPPRPROC,UI,RENDER,@HPLJ4.GPD,@hpc02.ini,RES_COMMON,HELP,UNIDRV,PJLMON.DLL,@TTFSUB.GPD
            [HPLJ4L.GPD.XP]
            CopyFiles=HPPRPROC,@HPLJ4L.GPD,@hpcstr02.dll
            Include=NTPRINT.INF
            Needs=HPLJ4.GPD
            DataSection=HP_UNIDRV_BIDI_DATA
            DataFile=HPLJ4L.GPD
            PrintProcessor=%PRINT_PROCESSOR%

            ; Copy Sections
            ;
            ; Lists of files that are actually copied. These sections are referenced
            ; from the installer sections, above. Only create a section if it contains
            ; two or more files (if we only copy a single file, identify it in the
            ; installer section, using the @filename notation) or if it's a color
            ; profile (since the DestinationDirs can only handle sections, and not
            ; individual files).

            [RES_COMMON]
            pcl5eres.dll
            hpcstr02.dll

            [HPPRPROC]
            genprint.dll,,,0x00000020

            ;
            ; Data Sections
            ;
            [HP_UNIDRV_DATA]
            DriverFile=UNIDRV.DLL
            ConfigFile=UNIDRVUI.DLL
            HelpFile=UNIDRV.HLP
            ; Data section that attaches PJLMON as the driver Lang Monitor
            [HP_UNIDRV_BIDI_DATA]
            DriverFile=UNIDRV.DLL
            ConfigFile=UNIDRVUI.DLL
            HelpFile=UNIDRV.HLP
            LanguageMonitor=%PJL_MONITOR%

            ;
            ; Call SetupSetDirectoryId with 66000 to set the target directory at runtime
            ; (depending on which environment drivers are getting installed)
            ;
            [DestinationDirs]
            DefaultDestDir=66000
            HPPRPROC=66001
            PJLMON.DLL=66002
            ;
            ; Control Flags
            ;
            [ControlFlags]
            ExcludeFromSelect = HWP20D0, HWP21A0, HWP2140, HWP20F0
            ;
            ;  Source Disk Section
            ;  This was added to enable Web Point&Print.
            ;  All files added to this must also be added to Layout.INF
            ;
            [SourceDisksNames]
            1=%DiskID1%,,,""
            [SourceDisksFiles]
            ;
            ; MS Files
            ;
            PCL5ERES.DLL = 1
            UNIDRV.DLL   = 1
            UNIRES.DLL   = 1
            UNIDRVUI.DLL = 1
            STDNAMES.GPD = 1
            UNIDRV.HLP   = 1
            TTFSUB.GPD   = 1
            ;
            ; Phase II
            ;
            HPCUI02.DLL  = 1
            HPCRD02.DLL  = 1
            HPCFNT02.DLL = 1
            HPCSTR02.DLL = 1
            genprint.dll  = 1
            HPCLJX02.HLP = 1
            HPC02.INI    = 1
            HPOEMUI.DLL  = 1
            HPCMBOX.INI  = 1
            HPLJ4L.GPD   = 1
            ;
            ; Localizable Strings
            ;
            [Strings]
            PrinterClassName="Printers"
            DiskID1="虛擬打印安裝盤"
            PJL_MONITOR="PJL Language Monitor,PJLMON.DLL"
            ;PRINT_PROCESSOR="HPPRN02,hpprn02.dll"
            PRINT_PROCESSOR="Vprint,genprint.dll"
            虛擬打印="虛擬打印"

            //////////////////////////inf end//////////////////////////




            Q:為什么我在打印的時(shí)候, PrintDocumentOnPrintProcessor 沒有被調(diào)用?
            A:可能是因?yàn)樵谀愕奶摂M打印機(jī)設(shè)了脫機(jī)的原故,當(dāng)時(shí)我就碰到了.
             

            Q:如何方便調(diào)試.
            A:因?yàn)間enprint.dll是被Print服務(wù)占用的,因此,替換的時(shí)候需要停止改服務(wù).
              Net Start "Print Spooler"
              Copy file file
              Net Stop  "Print Spooler"

            Q:從SPL中分離出EMF文件需要注意什么嗎?
            A:一定會(huì)用到的三個(gè)結(jié)構(gòu) SPL_HEADER(SPL頭)、SMR(SPL記錄)、ENHMETAHEADER(EMF頭).

            Q:我不能用acdsee等軟件打開分離出的EMF,但為什么用IE是可以打得開的?
              也許你用的是SMR::nSize 來做為EMF的write size
              而不是使用ENHMETAHEADER::nBytes 來做為EMF的write size
             
            Q:我想通過GDI+把EMF文件轉(zhuǎn)為BMP,為什么文字部份顯視黑屏?
            A:不知道,我是用IPicture 讀取,并且Render到DC后再保存為BMP的,這樣也不行,在Render內(nèi)存的時(shí)候就不行了。
               最后我用的是CXImage 這個(gè)庫(kù)做的轉(zhuǎn)換.

            Q:最后我的OFFICE 2007里面的文字打印出來被擠得變形了。
            A:嘿嘿嘿,其實(shí)我已經(jīng)放棄了這個(gè)方案了。使用OEMDLL里面的Bitmap例子來實(shí)現(xiàn)了。

            網(wǎng)上的資料:
            http://www.undocprint.org                               95%以上的資料來源.
            http://www.microsoft.com/india/msdn/articles/130.aspx   有個(gè)專門的函數(shù)取得相關(guān)的SPL文件名.
            http://fxh7622.blog.51cto.com/63841/d-3                 最先找到的網(wǎng)址,里面的例子部分是用DELPHI的,我的INF文件就是從這里拷的


            posted on 2008-12-22 18:03 鹿哥 閱讀(10097) 評(píng)論(2)  編輯 收藏 引用

            FeedBack:
            # re: 虛擬打印機(jī)方案1實(shí)現(xiàn)筆記.(printer process) 2009-10-17 21:44 codewarrior
            vista下可用么?  回復(fù)  更多評(píng)論
              
            # re: 虛擬打印機(jī)方案1實(shí)現(xiàn)筆記.(printer process) 2009-10-20 17:55 silekey
            @codewarrior
            沒試過,后面我是直接通過DDK里的Bitmap例子來做的,不過我想應(yīng)該可以吧.  回復(fù)  更多評(píng)論
              

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            99久久精品免费看国产| 国产精品99久久久久久宅男| 青青草国产精品久久久久| 久久99精品国产99久久| 久久久久久久综合日本亚洲| 精品久久久久久国产牛牛app| 亚洲国产精品综合久久一线| 国内精品伊人久久久久AV影院| 久久综合综合久久狠狠狠97色88| 亚洲美日韩Av中文字幕无码久久久妻妇 | 欧美亚洲国产精品久久| 伊人久久精品无码av一区| 精品久久久久久亚洲| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 久久久久AV综合网成人| 狠狠色综合网站久久久久久久| 久久无码专区国产精品发布| 一本久久a久久精品综合夜夜 | 久久伊人精品青青草原高清| 久久婷婷色综合一区二区| 国产精品永久久久久久久久久 | 久久精品国产亚洲一区二区| 亚洲中文字幕无码久久综合网| 亚洲嫩草影院久久精品| 无码伊人66久久大杳蕉网站谷歌 | 久久AAAA片一区二区| 人妻少妇久久中文字幕| 综合久久一区二区三区| 久久久WWW成人免费精品| 久久国产精品99久久久久久老狼| 97久久婷婷五月综合色d啪蜜芽 | 国产亚洲精久久久久久无码| 亚洲va久久久噜噜噜久久天堂| 色偷偷88欧美精品久久久| 久久久久久综合一区中文字幕 | 日韩中文久久| 亚洲午夜精品久久久久久浪潮| 久久亚洲AV无码西西人体| 久久久久亚洲AV成人网人人软件| 久久青青草原综合伊人| 亚洲国产精品一区二区久久|