使用開發SDK輸出印刷檔案

Posted by root at 2013/01/28

Category: 開發應用

Tags: , ,

yDot DLL SDK 使用说明 使用yDotPdfDll库可以让客户自行编写程序输出码图及印刷用pdf档案。码点格式为yDot码(Sonix 码不开放),需使用习碟科技点读笔方能点读。 nike air max pas cher 一、 SDK档案包括 1. yDotPdfDll.h 2. yDotPdfDll.dll 3. yDotPdfDll.lib 4. ugg paillettes yDotPdfDllTest目录 ……VC6 C++ 范例程序 5. yDotPdfDllTest_Csharp目录 ……VS2008 C# 范例程序 6. 06.jpg 图for测试 二、 VC6 C++ 范例程序 1. asics aaron 使用Visual C++ 6.0 开启VC6目录下的yDotPdfDllTest.dsw 2. 编译前设定 clip_image002 3. 程序库设定 ..\yDotPdfDll.lib clip_image004 4. 范例说明 Visual C++ 6.0 (yDotPdfDllTestDlg.cpp 内容)  

//Step 1. 设定码点尺寸 long dpi=600;//码点解析度设为600dpi; 目前只能设600或1200 long dotSzX=2,dotSzY=2;//码点大小 DotSize=2x2; 数值1至4 YdOT::setPatternFormat(dpi,dotSzX,dotSzY,TRUE); //Step 2. 设定进度条Callback 函数,请参看progressTest源码 YdOT::setRunProgress(progressTest,(DWORD)&m_progress); //Step 3. 读入底图06.jpg;背景图的解析读最好为300dpi DWORD hPdf=YdOT::pdfCreate("06.jpg"); //------------------------ {//Step 4. 画码区块, (坐标单位) = (06.jpg的pixel单位) long id=10001; long left=219; long top=128; long right=819; long bottom=189; BOOL bFrame=TRUE; BOOL bNumber=TRUE; //画方 YdOT::ydDrawRect (hPdf,id,left,top,right,bottom,bFrame,bNumber); //画椭圆 YdOT::ydDrawEllipse (hPdf,id,123,289,187,357,bFrame,bNumber); //画多边形 long poly[]={208,469, 850,469, 850,532, 573,532, 573,598, 208,598}; YdOT::ydDrawPoly(hPdf,id,poly,6,bFrame,bNumber); } //------------------------ //Step 5. 输出码图 YdOT::writeToTif(hPdf,"06.tif"); AfxMessageBox("Output 06.tif finished!"); //Step 5. 输出PDF=码图+底图 YdOT::writeToPdf(hPdf,"06.pdf"); AfxMessageBox("Output 06.pdf finished!"); //Step 6.释放记忆体 YdOT::pdfRelease(hPdf);

三、 VS2008 C# 范例程序 1. Adidas soldes 编译前设定 clip_image006 2. 范例说明 C# (From1.cs 内容)

namespace yDotPdfDllTest_CSharp { public partial class Form1 : Form { delegate void ProgressVnt(int type, int pos, uint data); [DllImport("yDotPdfDll.dll", EntryPoint = "dllVersion")] static extern bool dllVersion(ref int mainVer, ref int subVer); [DllImport("yDotPdfDll.dll", EntryPoint = "setPatternFormat")] static extern bool setPatternFormat(long dpi, long dotSzX, long dotSzY, bool bBackCode); [DllImport("yDotPdfDll.dll", EntryPoint = "setRunProgress")] static extern void setRunProgress(ProgressVnt prog, uint data); [DllImport("yDotPdfDll.dll", EntryPoint = "pdfCreate")] static extern uint pdfCreate(string jpgImagePathName); [DllImport("yDotPdfDll.dll", EntryPoint = "pdfRelease")] static extern bool pdfRelease(uint hPdf); [DllImport("yDotPdfDll.dll", EntryPoint = "ydDrawRect")] static extern bool ydDrawRect(uint hPdf, int id, int left, int top, int right, int bottom, bool bFrame, bool bNumber); [DllImport("yDotPdfDll.dll", EntryPoint = "ydDrawEllipse")] static extern bool ydDrawEllipse(uint hPdf, int id, int left, int top, int right, int bottom, bool bFrame, bool bNumber); [DllImport("yDotPdfDll.dll", EntryPoint = "ydDrawPoly")] static extern bool ydDrawPoly(uint hPdf, int id, int[] pts, int ptsCnt, bool bFrame, bool bNumber); [DllImport("yDotPdfDll.dll", EntryPoint = "writeToTif")] static extern bool writeToTif(uint hPdf, string tifPathName); [DllImport("yDotPdfDll.dll", EntryPoint = "writeToPdf")] static extern bool writeToPdf(uint hPdf, string pdfPathName); public Form1() { InitializeComponent(); } const int SetPgsRange = 0; const int SetPgsPos = 1; const int SetPgsPosAdd = 2; void progressTest(int type, int pos, uint data) { System.Windows.Forms.ProgressBar pPrg = this.progressBar1; if (type == SetPgsPosAdd) { if (pPrg.Value + pos <= pPrg.Maximum) pPrg.Value = pPrg.Value + pos; } else if (type == SetPgsPos) { if (pos <= pPrg.Maximum) pPrg.Value = pos; } else if (type == SetPgsRange) { pPrg.Minimum = 0; pPrg.Maximum = pos; } } private void Ok_Click(object sender, EventArgs e) { if (false) { int mainVer = 0; int subVer = 0; bool b = dllVersion(ref mainVer, ref subVer); } if (true) { bool ret; //Step 1.  louboutin paris bottes ugg pas cher 设定码点尺寸 int dpi = 600;//码点解析度设为600dpi; 目前只能设600或1200 int dotSzX = 2, dotSzY = 2;//码点大小 DotSize=2x2; 数值1至4 ret = setPatternFormat(dpi, dotSzX, dotSzY, true); //Step 2. 设定进度条Callback 函数,请参看progressTest源码 setRunProgress(progressTest, 1); //Step 3. 读入底图06.jpg;背景图的解析读最好为300dpi uint hPdf = pdfCreate("06.jpg"); //------------------------ {//Step 4. nike air huarache pas cher 画码区块(坐标单位) = (06.jpg的pixel单位) int id = 10001; int left = 219; int top = 128; int right = 819; int bottom = 189; bool bFrame = true; bool bNumber = true; //画方 ret = ydDrawRect(hPdf, id, left, top, right, bottom, bFrame, bNumber); //画椭圆 ret = ydDrawEllipse(hPdf, id, 123, 289, 187, 357, bFrame, bNumber); //画多边形 int[] poly = new int[12] { 208, 469, 850, 469, 850, 532, 573, 532, 573, 598, 208, 598 }; ret = ydDrawPoly(hPdf, id, poly, 6, bFrame, bNumber); } //------------------------ //Step 5. 输出码图 ret = writeToTif(hPdf, "06.tif"); MessageBox.Show("Output 06.tif finished!"); //Step 5.