使用开发SDK输出印刷档案

yDot DLL SDK 使用说明 使用yDotPdfDll库可以让客户自行编写程序输出码图及印刷用pdf档案。码点格式为yDot码(Sonix 码不开放),需使用习碟科技点读笔方能点读。

 

一、 SDK档案包括

1. yDotPdfDll.h

2. yDotPdfDll.dll

3. yDotPdfDll.lib

4. yDotPdfDllTest目录 ……VC6 C++ 范例程序

5. yDotPdfDllTest_Csharp目录 ……VS2008 C# 范例程序

6. 06.jpg 图for测试

 

二、 VC6 C++ 范例程序

1.使用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,FALSE); 
 
 //Step 2. 设定进度条Callback 函数,请参看progressTest源码
 YdOT::setRunProgress(progressTest,(DWORD)&m_progress); 
 
 //产生20mm x 20mm 的底图
 double w=20.0;
 double h=20.0;
 DWORD hPdf=YdOT::pdfCreateW(w,h);
 
 long id=10001;
 int left=0;
 int top=0;
 int right= mm2px(w);
 int bottom= mm2px(h);

 //画方
 YdOT::ydDrawRect(hPdf,id,left,top,right,bottom,FALSE,FALSE);

 //画椭圆
 YdOT::ydDrawEllipse(hPdf,id,left,top,right,bottom,FALSE,FALSE);

 if(YdOT::writeToTif(hPdf,"t20x20.tif"))
      AfxMessageBox("Output t20x20.tif finished!");
 else
      AfxMessageBox("Output t20x20.tif failed!");

 YdOT::pdfRelease(hPdf);

 return;

三、 VS2008 C# 范例程序

1. 编译前设定

clip_image006

2. 范例说明 C# (From1.cs 内容)

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. 设定码点尺寸
int dpi=600;//码点分辨率设为600dpi; 目前只能设600或1200
int dotSzX=2,dotSzY=2;//码点大小 DotSize=2×2; 数值1至4
ret = setPatternFormat(dpi, dotSzX, dotSzY, true);

//Step 2. 设定进度条Callback 函数,请参看progressTest源码
setRunProgress(progressTest,1);

//Step 3. 读入底图example.jpg;背景图的解析读最好为300dpi
uint hPdf=pdfCreate(“example.jpg”);
//————————
{ //Step 4. 画码区块
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, “output.tif”);
MessageBox.Show(“Output output.tif finished!”);

//Step 5. 输出PDF=码图+底图
ret = writeToPdf(hPdf, “output.pdf”);
MessageBox.Show(“Output output.pdf finished!”);

//Step 6.释放记忆体
ret = pdfRelease(hPdf);
}
}