• <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年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

            留言簿(3)

            隨筆檔案

            文章分類

            文章檔案

            COM相關技術

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            1.下載一個打印驅動.并修改里面的INF文件.

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

            4.通過spl文件結構,獲取EMF文件。

            5.把EMF文件轉換為其它圖片文件。

             
            QA:
            Q:如何修改打印驅動?我對里面的驅動格式一點都不熟悉。
            A:不用改了,我用的是HP LaserJet 4驅動,下載地址:
              http://h50176.www5.hp.com/support/C2001A/more_info_soar_lj631sc.html
              
              以下是inf內容:
            /////////////////////////////////////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]
            "虛擬打印機"                 = HPLJ4L.GPD.XP        ,Hewlett-PackardLaserC029,HP_LaserJet_4L
            ;Hewlett-PackardLaserC029是設備的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:為什么我在打印的時候, PrintDocumentOnPrintProcessor 沒有被調用?
            A:可能是因為在你的虛擬打印機設了脫機的原故,當時我就碰到了.
             

            Q:如何方便調試.
            A:因為genprint.dll是被Print服務占用的,因此,替換的時候需要停止改服務.
              Net Start "Print Spooler"
              Copy file file
              Net Stop  "Print Spooler"

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

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

            Q:最后我的OFFICE 2007里面的文字打印出來被擠得變形了。
            A:嘿嘿嘿,其實我已經放棄了這個方案了。使用OEMDLL里面的Bitmap例子來實現了。

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


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

            FeedBack:
            # re: 虛擬打印機方案1實現筆記.(printer process) 2009-10-17 21:44 codewarrior
            vista下可用么?  回復  更多評論
              
            # re: 虛擬打印機方案1實現筆記.(printer process) 2009-10-20 17:55 silekey
            @codewarrior
            沒試過,后面我是直接通過DDK里的Bitmap例子來做的,不過我想應該可以吧.  回復  更多評論
              
            久久精品午夜一区二区福利| 国产精品成人精品久久久 | 国产精品乱码久久久久久软件| 亚洲欧洲中文日韩久久AV乱码| 久久精品国产亚洲精品2020| 久久精品国产第一区二区三区| 色综合久久最新中文字幕| 国产毛片欧美毛片久久久| 国产精品日韩欧美久久综合| 久久精品中文无码资源站| 国产精品成人久久久久久久| 久久久久高潮综合影院| 国产91久久综合| 久久久久AV综合网成人| 亚洲国产婷婷香蕉久久久久久| 久久精品国产亚洲AV无码偷窥| 亚洲а∨天堂久久精品| 嫩草影院久久99| 久久99久久99精品免视看动漫| 亚洲精品99久久久久中文字幕 | 久久激情五月丁香伊人| 久久久国产精品网站| 久久久久久国产精品美女| 国产精品内射久久久久欢欢| 精品久久久久久国产| 国产精品VIDEOSSEX久久发布| 中文字幕日本人妻久久久免费| 亚洲国产成人乱码精品女人久久久不卡| 精品久久久噜噜噜久久久| 亚洲日本va中文字幕久久| 久久乐国产综合亚洲精品| 精品国产乱码久久久久软件| 久久精品18| 久久播电影网| 亚洲精品WWW久久久久久| 久久一区二区三区99| 天天躁日日躁狠狠久久 | 久久久久99精品成人片试看| 久久SE精品一区二区| 亚洲va久久久噜噜噜久久| 色综合久久久久综合体桃花网|