jinshi是什么摩托车发动机总成的发动机

jinshixie的专栏
https://blog.csdn.net/
https://static-blog.csdn.net/images/logo.gif
https://blog.csdn.net/jinshixie
https://blog.csdn.net/
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
二程发动机
飞机的星型发动机
飞机螺旋桨与机枪同步图
环式真空泵
奎西发动机
马耳他十字机芯
喷气式发动机
喷射推进机
汽车万向节
汽轮蒸汽机
潜艇使用的斯特林发动机
曲柄连杆机构是发动机
三相电子绕组励磁
手枪原理图
双涵道涡轮风扇发动机
太阳能加热装置
外燃机:斯特林发动机原理
鱼雷炮艇驱逐舰火炮系统原理
转子发动机
火车的推进原理
舰炮弹药装填系统
汽车换挡机制
水平对置式发动机——汽缸排列在发动机相对的两个平面上,斯巴鲁,保时捷911用的是这种的6缸
转子发动机2
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
在linux进程间通信的方式中,共享内存是一种最快的IPC方式。因此,共享内存用于实现进程间大量的数据传输,共享内存的话,会在内存中单独开辟一段内存空间,这段内存空间有自己特有的数据结构,包括访问权限、大小和最近访问的时间等。
为什么说共享内存是最快的一种IPC方式呢?让我们一起来看一下下面的这张图:
从这张图中,我们可以看出,使用管道(FIFO/消息队列)从一个文件传输信息到另外一个文件需要复制4次。一是,服务器端将信息从相应的文件复制到server临时缓冲区中;二是,从临时缓冲区中复制到管道(FIFO/消息队列);三是,客户端将信息从管道(FIFO/消息队列)复制到client端的缓冲区中;四是,从client临时缓冲区将信息复制到输出文件中。
这个是对于不是共享内存的其他方式的消息传送过程,下面我们仔细来看一下对于共享内存而言,这种消息传送机制是怎样的呢?我们还是先看一下下面这张图:
从这张图中,我们可以看出,共享内存的消息复制只有两次。一是,从输入文件到共享内存;二是,从共享内存到输出文件。这样就很大程度上提高了数据存取的效率。
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
arch/arm/configs/ 默认.config 配置。
CROSS_COMPILE=arm-hismall-linux-
INSTALL_PATH=/home/hb/nfs/linux-2.6.24/kbuild
INSTALL_MOD_PATH=/home/hb/nfs/linux-2.6.24/kbuild
交叉编译的时候的三个makefeile参数。
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
用kill发个0信号是个好办法。
[admin@local ~]$ killall -0 bash
[admin@local~]$ echo $?
[admin@local~]$ killall -0 bash1
killall: bash1: no process killed
[admin@local~]$ echo $?
P O S I X . 1将信号编号0定义为空信号。如果s i g n o参数是0,则k i l l仍执行正常的错误检查,但
不发送信号。这常被用来确定一个特定进程是否仍旧存在。如果向一个并不存在的进程发送空
信号,则k i l l返回-1,e r r n o则被设置为E S R C H。
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
1.& 在创建的文件中写入进程的ID,如果机器非正常退出,重启后先读取这个文件,得到进程ID,再根据ID判定进程是否正在运行,如果不是,则把文件删除掉。这样就不会发生不删除文件,程序运行不起来的问题了。
2.& 打开一个文件,然后锁定,新运行的程序会试图再次锁定该文件,但是因为已经被锁定,所以会返回错误信息。据此就可以判断是否有程序已经运行。设置FD_CLOEXEC后,只要程序终止,都可以再次锁定。
通常精灵进程都使用这种方法,比如apache等等,而且默认都会在/var/run目录
3. 遍历/proc目录下的进程信息,如果应用程序对应的进程存在,则让认为应用程序已经在运行。然后强制关闭该应用程序,用新的命令行参数重新运行它。这样做的优点是实现简单,到达了我们预期的目标。缺点是强制kill第一个运行实例太野蛮,可能会造成数据丢失,另外创建新进程的开销会让用户感觉反应迟钝。
4. 通过窗口管理器实现,根据应用程序的窗口判断应用程序是否在运行。如果发现对应的应用程序已经在运行,把对应的窗口提到前面来。这要修改应用程序才行,只有应用程序自己才知道其拥有的窗口的关系,若不加考虑把应用程序的主窗口提到前面来,这也并不见得合适。这种方法只能解决前两个小问题,命令行参数还是无法传递给第一个运行实例。
5. 应用程序提供一个DBUS服务对象,第一个运行实例作为服务器运行,第二个运行实例作为客户端运行,第二个运行实例把命令行参数传递给第一个运行实例,然后就退出。第一个运行实例接受到新的命令行参数,作相应的处理,比如,把相应的窗口提到前面来,根据命令行参数进行处理。这是第二种方法的改进,可以实现全部的功能,缺点是要修改应用程序,不过DBUS服务对象可以通过一个公共库来实现,应用程序的改动并不大。
6. 使用信号量
信号量知识:
信号量实例:
7. 绑定某一个socket端口, 下次运行就无法再次绑定而退出.
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
立即数的产生,其寻址方式是这样的:
+----------+-------------------------------+
+----------+-------------------------------+[7:0] Unsigned 8 bit immediate
value[11:8] Shift applied to Imm
The immediate operand rotate field is a 4 bit unsigned integer which specifies a shift operation on the 8 bit immediate value. This value
is zero extended to 32 bits, andthen subject to a rotate right by twice the value in the
rotate field. This enables many common constants to be generated, for example
all powers of 2
1. 取低8位,先用0扩展为32位数
2. 将所得32位数循环右移 2*Rotate位,Rotate为[11:8]
来分析一句:mov r2, #300。反汇编如下:
8004: e3a02f4b mov r2, #300 ; 0x12c
立即数是直接放在指令内部的。
1. 取其低8位:0x4b
2. 扩展为32位:0x0000
2*Rotate = 2*15 = 30
循环右移30位(相当于左移2位)。即0100
1011 左移2位,得到0001
,即0x12c,十进制等于300
合法立即数的概念:
在教材里是这样定义的,合法立即数是将一个8位立即数循环右移偶数次后得到的数(当然在移位的时候按32位处理,即8位立即数其他24位我认为全部为0)。
概念很简单,不过我们在指令当中使用立即数的时候,往往不知道是不是合法立即数。我们通常很难看出这个数是由那个8位立即数循环右移多少次得到的。解决的办法有两个:
一、使用LDR伪指令将立即数先装入寄存器,然后使用ARM指令对保存这个立即数的寄存器进行处理。
比如,ADD R1,R1,#0x123456 这条加法指令让R1寄存器中的数据和0x123456相加,和存到R1当中,但是立即数0x123456不是合法立即数,因此这条指令无法编译通过。把程序按以下方法处理,可正常编译成功:
LDR R0,=0x123456
ADD R1, R1,R0
实现同样的功能。
二、第一种方法效率高,绕开了立即数是否合法的问题,我们经常采用这种办法。不过这不是我要今天重点说明的问题,我要说明的是如何判断一个立即数是否合法,需要二步:
1、判断立即数的1的个数是否小于等于8,并且这些1是否分布在连续的8个比特位上(可以按循环移位的方法来,即从第0位到第31位我们认为是连续的,例0x,0001---0001这32位,有2个1,这两个1的间距可认为是3个比特位。
2、如果第一步的条件满足,将这包含1的连续位取出来构造成8位立即数,如上例,这8位立即数可能是(0x88),也可能是(0x11),两种可能,很容易看出0x11循环右移4位得到0x,因此0x是合法立即数。
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
首先在RES目录下建一个文件,命名 windows.manifest 后缀为:.manifest
然后再用记事本打开放入如下代码:
&?xml version="1.0" encoding="UTF-8" standalone="yes"?&
&assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"&
&assemblyIdentity
name="Microsoft.Windows.XXXX"
processorArchitecture="x86"
version="5.1.0.0"
type="win32"/&
&description&Windows Shell&/description&
&dependency&
&dependentAssembly&
&assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="x86"
publicKeyToken="ccf1df"
language="*"
&/dependentAssembly&
&/dependency&
&/assembly&
接着保存..
然后导入资源,把文件windows.manifest添加到工程的资源中:
插入-&资源-&导入-&文件类型改为“所有文件"-&找到windows.manifest-&弹出对话框
资源类型 填"24"-&确定后。再把资源的ID改为"IDR_MANIFEST"
然后在String Table中添加IDR_MANIFEST,值为1
重新生成编译运行你的程序就有了XP/Win7的风格
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
1、基本几何变换及变换矩阵
基本几何变换都是相对于坐标原点和坐标轴进行的几何变换,有平移、比例、旋转、反射和错切等。
1.1 平移变换
是指将p点沿直线路径从一个坐标位置移到另一个坐标位置的重定位过程。他是一种不产生变形而移动物体的刚体变换(rigid-body transformation),如下图所示。
图1-1 平移变换
求得平移变换矩阵如下:
其中Tx,Ty称为平移矢量。
1.2 缩放变换
缩放变换是指对p点相对于坐标原点沿x方向放缩Sx倍,沿y方向放缩Sy倍。其中Sx和Sy称为缩放系数。
图1-2缩放变换(Sx=2,Sy=3)
缩放变换可改变物体的大小,如下图所示。当Sx=Sy &1时,图形沿两个坐标轴方向等比例放大;当Sx=Sy&1,图形沿两个坐标轴方向等比例缩小;当Sx≠Sy,图形沿两个坐标轴方向作非均匀的比例变换。
图1-3比例变换
(a)Sx与Sy相等
(b)Sx与Sy不相等
1.3 旋转变换
二维旋转是指将p点绕坐标原点转动某个角度(逆时针为正,顺时针为负)得到新的点p’的重定位过程。
图1-4旋转变换
推导:利用极坐标方程
逆时针旋转θ角的矩阵如下:
1.4 对称变换
对称变换后的图形是原图形关于某一轴线或原点的镜像。
图1-5对称变换
(1)关于x轴对称
图1-6关于x轴对称
(2)关于y轴对称
图1-7关于y轴对称
(3)关于原点对称
图1-8关于原点对称
(4)关于y=x轴对称
图1-9关于y=x轴对称
(5)关于y=-x轴对称
图1-10关于y=-x轴对称
1.5 错切变换
错切变换也称为剪切、错位变换,用于产生弹性物体的变形处理。
图1-11错切变换
错切变换的变换矩阵为:
(1)沿x方向错切:b=0
(2)沿y方向错切:c=0
(3)两个方向错切:b和c都不等于0。
2、 复合变换
如果图形要做一次以上的几何变换,那么可以将各个变换矩阵综合起来进行一步到位的变换。复合变换有如下的性质:
1)复合平移
对同一图形做两次平移相当于将两次的平移两加起来:
2)复合缩放
两次连续的缩放相当于将缩放操作相乘:
3)复合旋转
两次连续的旋转相当于将两次的旋转角度相加:
缩放、旋转变换都与参考点有关,上面进行的各种变换都是以原点为参考点的。如果相对某个一般的参考点(xf,yf)作缩放、旋转变换,相当于将该点移到坐标原点处,然后进行缩放、旋转变换,最后将(xf,yf)点移回原来的位置。
4)关于(xf,yf)点的缩放变换
5)绕(xf,yf)点的旋转变换
3、二维图形几何变换的计算
几何变换均可表示成P’=P*T的形式
(1)点的变换:先将点表示为规范化齐次坐标形式,再乘以变换矩阵。
(2)直线的变换:将直线的两个端点表示为规范化齐次坐标形式,再乘以变换矩阵。
(3)多边形的变换:将多边形的顶点表示为规范化齐次坐标形式,再乘以变换矩阵。
(4)曲线的变换:将曲线的每个点表示为规范化齐次坐标形式,再乘以变换矩阵。
4、复合变换的矩阵点乘的先后问题
1)如果采用以下方式计算几何变换的变换矩阵:
如上范例所示,其先执行变换的矩阵放在前面,后执行变换的矩阵放在后面。
2)如果采用以下方式计算几何变换的变换矩阵:
如上范例所示,其先执行变换的矩阵放在后面,后执行变换的矩阵放在前面。
这是因为矩阵的特性:
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
阅读:1398
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
* && Haru Free PDF Library 2.0.0 && -- text_demo.c
* Copyright (c)
Takeshi Kanno &takeshi_kanno@est.hi-ho.ne.jp&
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
* It is provided "as is" without express or implied warranty.
#include &stdlib.h&
#include &stdio.h&
#include &string.h&
#include &math.h&
#include &setjmp.h&
#include "hpdf.h"
#include "grid_sheet.h"
#ifdef HPDF_DLL
error_handler (HPDF_STATUS
HPDF_STATUS
detail_no,
*user_data)
printf ("ERROR: error_no=%04X, detail_no=%u\n", (HPDF_UINT)error_no,
(HPDF_UINT)detail_no);
longjmp(env, 1);
show_stripe_pattern
(HPDF_Page
HPDF_UINT iy = 0;
while (iy & 50) {
HPDF_Page_SetRGBStroke (page, 0.0, 0.0, 0.5);
HPDF_Page_SetLineWidth (page, 1);
HPDF_Page_MoveTo (page, x, y + iy);
HPDF_Page_LineTo (page, x + HPDF_Page_TextWidth (page, "ABCabc123"),
HPDF_Page_Stroke (page);
HPDF_Page_SetLineWidth (page, 2.5);
show_description
(HPDF_Page
const char
float fsize = HPDF_Page_GetCurrentFontSize (page);
HPDF_Font font = HPDF_Page_GetCurrentFont (page);
HPDF_RGBColor c = HPDF_Page_GetRGBFill (page);
HPDF_Page_BeginText (page);
HPDF_Page_SetRGBFill (page, 0, 0, 0);
HPDF_Page_SetTextRenderingMode (page, HPDF_FILL);
HPDF_Page_SetFontAndSize (page, font, 10);
HPDF_Page_TextOut (page, x, y - 12, text);
HPDF_Page_EndText (page);
HPDF_Page_SetFontAndSize (page, font, fsize);
HPDF_Page_SetRGBFill (page, c.r, c.g, c.b);
int main (int argc, char **argv)
const char *page_title = "Text Demo";
char fname[256];
const char* samp_text = "abcdefgABCDEFG123!#$%&+-@?";
const char* samp_text2 = "The quick brown fox jumps over the lazy dog.";
float angle1;
float angle2;
float rad1;
float rad2;
strcpy (fname, argv[0]);
strcat (fname, ".pdf");
pdf = HPDF_New (error_handler, NULL);
if (!pdf) {
printf ("error: cannot create PdfDoc object\n");
if (setjmp(env)) {
HPDF_Free (pdf);
/* set compression mode */
HPDF_SetCompressionMode (pdf, HPDF_COMP_ALL);
/* create default-font */
font = HPDF_GetFont (pdf, "Helvetica", NULL);
/* add a new page object. */
page = HPDF_AddPage (pdf);
/* draw grid to the page */
print_grid
(pdf, page);
/* print the lines of the page.
HPDF_Page_SetLineWidth (page, 1);
HPDF_Page_Rectangle (page, 50, 50, HPDF_Page_GetWidth(page) - 100,
HPDF_Page_GetHeight (page) - 110);
HPDF_Page_Stroke (page);
/* print the title of the page (with positioning center). */
HPDF_Page_SetFontAndSize (page, font, 24);
tw = HPDF_Page_TextWidth (page, page_title);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, (HPDF_Page_GetWidth(page) - tw) / 2,
HPDF_Page_GetHeight (page) - 50, page_title);
HPDF_Page_EndText (page);
HPDF_Page_BeginText (page);
HPDF_Page_MoveTextPos (page, 60, HPDF_Page_GetHeight(page) - 60);
* font size
fsize = 8;
while (fsize & 60) {
char buf[50];
/* set style and size of font. */
HPDF_Page_SetFontAndSize(page, font, fsize);
/* set the position of the text. */
HPDF_Page_MoveTextPos (page, 0, -5 - fsize);
/* measure the number of characters which included in the page. */
strcpy(buf, samp_text);
len = HPDF_Page_MeasureText (page, samp_text,
HPDF_Page_GetWidth(page) - 120, HPDF_FALSE, NULL);
/* truncate the text. */
buf[len] = 0x00;
HPDF_Page_ShowText (page, buf);
/* print the description. */
HPDF_Page_MoveTextPos (page, 0, -10);
HPDF_Page_SetFontAndSize(page, font, 8);
#ifdef __WIN32__
_snprintf(buf, 50, "Fontsize=%.0f", fsize);
snprintf(buf, 50, "Fontsize=%.0f", fsize);
HPDF_Page_ShowText (page, buf);
fsize *= 1.5;
* font color
HPDF_Page_SetFontAndSize(page, font, 8);
HPDF_Page_MoveTextPos (page, 0, -30);
HPDF_Page_ShowText (page, "Font color");
HPDF_Page_SetFontAndSize (page, font, 18);
HPDF_Page_MoveTextPos (page, 0, -20);
len = strlen (samp_text);
for (i = 0; i & i++) {
char buf[2];
float r = (float)i / (float)
float g = 1 - ((float)i / (float)len);
buf[0] = samp_text[i];
buf[1] = 0x00;
HPDF_Page_SetRGBFill (page, r, g, 0.0);
HPDF_Page_ShowText (page, buf);
HPDF_Page_MoveTextPos (page, 0, -25);
for (i = 0; i & i++) {
char buf[2];
float r = (float)i / (float)
float b = 1 - ((float)i / (float)len);
buf[0] = samp_text[i];
buf[1] = 0x00;
HPDF_Page_SetRGBFill (page, r, 0.0, b);
HPDF_Page_ShowText (page, buf);
HPDF_Page_MoveTextPos (page, 0, -25);
for (i = 0; i & i++) {
char buf[2];
float b = (float)i / (float)
float g = 1 - ((float)i / (float)len);
buf[0] = samp_text[i];
buf[1] = 0x00;
HPDF_Page_SetRGBFill (page, 0.0, g, b);
HPDF_Page_ShowText (page, buf);
HPDF_Page_EndText (page);
ypos = 450;
* Font rendering mode
HPDF_Page_SetFontAndSize(page, font, 32);
HPDF_Page_SetRGBFill (page, 0.5, 0.5, 0.0);
HPDF_Page_SetLineWidth (page, 1.5);
/* PDF_FILL */
show_description (page,
"RenderingMode=PDF_FILL");
HPDF_Page_SetTextRenderingMode (page, HPDF_FILL);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 60, ypos, "ABCabc123");
HPDF_Page_EndText (page);
/* PDF_STROKE */
show_description (page, 60, ypos - 50,
"RenderingMode=PDF_STROKE");
HPDF_Page_SetTextRenderingMode (page, HPDF_STROKE);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 60, ypos - 50, "ABCabc123");
HPDF_Page_EndText (page);
/* PDF_FILL_THEN_STROKE */
show_description (page, 60, ypos - 100,
"RenderingMode=PDF_FILL_THEN_STROKE");
HPDF_Page_SetTextRenderingMode (page, HPDF_FILL_THEN_STROKE);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 60, ypos - 100, "ABCabc123");
HPDF_Page_EndText (page);
/* PDF_FILL_CLIPPING */
show_description (page, 60, ypos - 150,
"RenderingMode=PDF_FILL_CLIPPING");
HPDF_Page_GSave (page);
HPDF_Page_SetTextRenderingMode (page, HPDF_FILL_CLIPPING);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 60, ypos - 150, "ABCabc123");
HPDF_Page_EndText (page);
show_stripe_pattern (page, 60, ypos - 150);
HPDF_Page_GRestore (page);
/* PDF_STROKE_CLIPPING */
show_description (page, 60, ypos - 200,
"RenderingMode=PDF_STROKE_CLIPPING");
HPDF_Page_GSave (page);
HPDF_Page_SetTextRenderingMode (page, HPDF_STROKE_CLIPPING);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 60, ypos - 200, "ABCabc123");
HPDF_Page_EndText (page);
show_stripe_pattern (page, 60, ypos - 200);
HPDF_Page_GRestore (page);
/* PDF_FILL_STROKE_CLIPPING */
show_description (page, 60, ypos - 250,
"RenderingMode=PDF_FILL_STROKE_CLIPPING");
HPDF_Page_GSave (page);
HPDF_Page_SetTextRenderingMode (page, HPDF_FILL_STROKE_CLIPPING);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 60, ypos - 250, "ABCabc123");
HPDF_Page_EndText (page);
show_stripe_pattern (page, 60, ypos - 250);
HPDF_Page_GRestore (page);
/* Reset text attributes */
HPDF_Page_SetTextRenderingMode (page, HPDF_FILL);
HPDF_Page_SetRGBFill (page, 0, 0, 0);
HPDF_Page_SetFontAndSize(page, font, 30);
* Rotating text
angle1 = 30;
/* A rotation of 30 degrees. */
rad1 = angle1 / 180 * 3.141592; /* Calcurate the radian value. */
show_description (page, 320, ypos - 60, "Rotating text");
HPDF_Page_BeginText (page);
HPDF_Page_SetTextMatrix (page, cos(rad1), sin(rad1), -sin(rad1), cos(rad1),
330, ypos - 60);
HPDF_Page_ShowText (page, "ABCabc123");
HPDF_Page_EndText (page);
* Skewing text.
show_description (page, 320, ypos - 120, "Skewing text");
HPDF_Page_BeginText (page);
angle1 = 10;
angle2 = 20;
rad1 = angle1 / 180 * 3.141592;
rad2 = angle2 / 180 * 3.141592;
HPDF_Page_SetTextMatrix (page, 1, tan(rad1), tan(rad2), 1, 320, ypos - 120);
HPDF_Page_ShowText (page, "ABCabc123");
HPDF_Page_EndText (page);
* scaling text (X direction)
show_description (page, 320, ypos - 175, "Scaling text (X direction)");
HPDF_Page_BeginText (page);
HPDF_Page_SetTextMatrix (page, 1.5, 0, 0, 1, 320, ypos - 175);
HPDF_Page_ShowText (page, "ABCabc12");
HPDF_Page_EndText (page);
* scaling text (Y direction)
show_description (page, 320, ypos - 250, "Scaling text (Y direction)");
HPDF_Page_BeginText (page);
HPDF_Page_SetTextMatrix (page, 1, 0, 0, 2, 320, ypos - 250);
HPDF_Page_ShowText (page, "ABCabc123");
HPDF_Page_EndText (page);
* char spacing, word spacing
show_description (page, 60, 140, "char-spacing 0");
show_description (page, 60, 100, "char-spacing 1.5");
show_description (page, 60, 60, "char-spacing 1.5, word-spacing 2.5");
HPDF_Page_SetFontAndSize (page, font, 20);
HPDF_Page_SetRGBFill (page, 0.1, 0.3, 0.1);
/* char-spacing 0 */
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 60, 140, samp_text2);
HPDF_Page_EndText (page);
/* char-spacing 1.5 */
HPDF_Page_SetCharSpace (page, 1.5);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 60, 100, samp_text2);
HPDF_Page_EndText (page);
/* char-spacing 1.5, word-spacing 3.5 */
HPDF_Page_SetWordSpace (page, 2.5);
HPDF_Page_BeginText (page);
HPDF_Page_TextOut (page, 60, 60, samp_text2);
HPDF_Page_EndText (page);
/* save the document to a file */
HPDF_SaveToFile (pdf, fname);
/* clean up */
HPDF_Free (pdf);
return 0;}
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
阅读:1750
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
由于libharu依赖与zlib和libpng。
1.编译zlib
1.1 下载zlib
下载最新版 ,我下载的是1.2.8。放到g:/pdf目录,解压到zlib目录下。
打开vs2008,打开 “工具-&Visual Studio 2008 Command Prompt”(其实就是cmd窗口,区别就是在启动cmd窗口之前,执行了Microsoft
Visual Studio 9.0\VC\bin\vcvar32.bat 设置了一些环境变量,供cl.exe使用,感兴趣可以去查看一下这个文件)。
命令行进入masmx86目录,执行bld_ml32.bat。来编译出match686.obj和inffas32.obj。(如果是64位的需要进入g:/pdf\zlib\contrib\masmx64目录,执行相应编译,可以汇报ml64,不存在,那是因为你的vs2008,没有安装相应64为的编译工具,可以运行安装程序,添加一下。具体过程不在本文介绍范围之内)。
然后进入目录g:/pdf\zlib\contrib\vstudio\vc9(因为我的vs版本是2008(vc9)),然后打开zlibvc.sln文件,如图
因为我只需要zlib动态库,我只变异zlibvc工程。
不过在编译之前,我们要修改 预处理宏ZLIB_WINAPI修改为ZLIB_DLL。用来编译动态库。
然后编译生成,在目录zlib\contrib\vstudio\vc9\x86\ZlibDllDebug,目录下生成zlibwapi.dll和zlibwapi.dll。留着备用。
2.编译libpng。
2.1 下载解压libpng
下载。解压到G:\pdf\libpng目录里面。
可以进入G:\pdf\libpng\projects\visualc71目录下,打开libpng.sln,可以看到,
Libpng项目依赖于zlib项目,而Zlib项目目录..\..\..\zlib。其实正好是我们前面建立zlib目录。(如果不想这么搞,可以线编译出zlib的静态库,然后添加到libpng链接依赖中也可以)
然后生成 libpng,在G:\pdf\libpng\projects\visualc71\Win32_DLL_Debug中有libpng16d.lib和libpng16d.dll文件。留着备用
3.编译libharu
3.1 下载libharu
下载libharu,解压到G:\pdf\libharu目录中。
进入G:\pdf\libharu\script,文本编辑器打开Makefile.msvc_dll文件。修改环圈的部分,主要目的是让它找到头文件和动态库文件。
把之前编译的zlibwapi.dll和zlibwapi.dll拷贝到$(zlib_prefix)\lib目录下,并修改为zlib.dll和zlib.lib
同样把之前编译的libpng16d.lib和libpng16d.dll拷贝到$(png_prefix)\lib目录下,并修改为libpng.lib和libpng.dll
打开vs2008,打开 “工具-&Visual Studio 2008 Command Prompt”。在cmd窗口进入。执行nmake
-f script/Makefile.msvc_dll。
在目录G:\pdf\libharu。编译出来libhpdf.lib和libhpdf.dll文件。
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
阅读:1033
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
1.&PDF概要
1.1.&图像模型
PDF能以平台无关、高效率的方式描叙复杂的文字、图形、排版。
PDF 用图像模型来实现设备无关。图像模型允许应用程序以抽象对象描叙文字、图像、图标,而不是通过具体的像素点。把描述抽象对象的语言称作“页描述语言”。文档中存储都是以“页描述语言”表示的各种抽象对象。
要把文档输出到具体设备上,产生具体像素点,需要有个翻译软件,把抽象对象渲染到具体输出设备上,称这个“翻译软件”为“规则扫描”软件。
PDF 具有设备无关、可压缩、安全、增量修改、可扩展等特性。
2.1.&字符集
PDF是大小写敏感的语言的,及和是不一样的。
PDF字符集分文三种:
1).空白字符
&&空白字符包括、、、、、。除了在、、中,所有的空白符都是一样的。把多个连续的空白符看作一个。
2).分割字符
分隔字符包括。分割字符是用来分开需实体对象的,包括、、、。
3).常规字符
除了上面的两种字符之外的字符都称作常规字符。
2.2.&注释(comment)
注释没有语义,只是注释说明作用。注释以开头,到本行结尾。例如
abc% comment {/%) blah blah blah
&“”为注释。
3.3.1 Boolean 对象
Boolean 对象只有和两种值,可以用在和中。和是关键字。
3.3.2 Numeric 对象
Numeric对象是数组对象,它的取值范围和具体的机器有关,具体范围可以参考“《》”。
Numeric 对象分为和对象。对象就是证书对象,可以在数字前面加的符号,标识正负。例如。
123 43445 +17
Real对象是实数对象。需要注意的是的对象是定点小数,而不是浮点小数,不支持像“”这样的标识。正确标识例如:
如果对象超出的标识范围,会自动转化为对象。但是如果对象超出标识范围,会报错。
所有可以用对象的地方都可以用对象,对象会自动转换为对象。所以对于需要对象的地方,直接写就可以,不用写成。
3.3.3 String 对象
String对象是一个字节数列的集合,字节的取值范围为。字符串的长度范围跟具体平台有关,具体参考“《》”。
String对象分为和。
Literal string对象是是用()括起来的一些字符,除了不对称的括号(如“(”或者“)”)或者反斜杠(“/”)外的字符,都可以出现在中。例如:
(This is a string)
(Strings may contain newlines
and such.)
(Strings may contain balanced parentheses ( ) and
special characters (*!&}^% and so on).)
(The following is an empty string.)
(It has zero (0) length.)
在可以使用转意字符,如表
TABLE 3.2 Escape sequences in literal strings
Line feed (LF)
Carriage return (CR)
Horizontal tab (HT)
Backspace (BS)
Form feed (FF)
Left parenthesis
Right parenthesis
Character code ddd (octal)
所以不在表中的转义字符会被忽略。
如果一个字符串太长,放在一行不在方便,可以分开写在多行,然后用反斜杠连接起来,如下。
two strings \
are the same.)
(These two strings are the same.)
如果不加反斜杠,就会相当在末尾加了一个。如下
two strings
are the same.)
two strings \n
are the same.)
\ddd 标识是一个八进制数,提供一种标识不可显示的的方式。如
(This string contains \245two octal characters\307.)
\ddd 只需“” 后后面三位数,包括,例如
\0053是表示和。而不是或者。
Hexadecimal string 是用尖括号括起来的和()的字符,如
&4E6FF7A206BE&
每一对表示一个字节。如果字符是奇数,在字符最后字符补零,组成一对。例如:
&901FA3& 标识的、、。如果是会是、、。
3.3.4 Name objects
Name对象一串原子、唯一的字符,用来标识一个对象。原子性是说对象没有内部结构了。唯一性是说如果两个是一样的,说明它们标识的师动一个对象。
Name对象以“”开头,后面紧跟对象名,“”和第一个字符之间不能有空格。“”并不是对象的一部分,只是用来说明“”后面的字符是对象。例如:
/ASomewhatLongerName
/A;Name_With-
Name对象一般是由“常规字符”组成,不能是“空白字符”和“分割字符”。
但是在中,可以包括“空白字符”和“分隔字符”,但是必须以“”开头,紧跟相应字符的两位十六进制编码。例如表。代表的一个字符,而不是三个字符。例如是四个字符,而不是六个。
Literal Name
/Adobe#20Green
Adobe Green
/PANTONE#CV
PANTONE 5757 CV
/paired#28#29parentheses
paired()parentheses
/The_Key_of_F#23_Minor
The_Key_of_F#_Minor
3.3.5 Array 对象
Array对象是一个一维对象集合,集合可以包括对象、对象等任何其他对象。如果要组成多维数组,可通过对象中包含对象的方式。
Array对象的标识方式:
[549 3.14 false (Ralph) /SomeName]
3.3.6 Dictionary 对象
Dictionary对象是键值对的集合,用来描述复杂对象。键必须是对象,值可以是任何对象,包括对象。
Dictionary对象是用“”括起来的表示,例如:
&& /Type /Example
/Subtype /DictionaryExample
/Version 0.01
/IntegerItem 12
/StringItem (a string)
/Subdictionary && /Item1 0.4
/Item2 true
/LastItem (not!)
/VeryLastItem (OK)
每个对象代表一个复杂对象,每个键值对表示对象的一个属性。
按照惯例,每个都会有一个键值对,用来标识这个描述的对象的类别。一般还会有个键值对,用来标识标识对象子类别。例如一个字体的的键的值是,键的值是,或者别的字形名称。
3.3.7 Stream 对象
Stream对象和对象一样也是一个字节序列,但是不一样的地方,对象可以被应用程序递增的读取,而不是像对象要整个读入内存。对象可以不限长度的,而对象是长度后受平台最大字符长度的限制。
Stream对象包括一个对象和
tream和关键字,以及和中见包含的一行或者多行字节。格式如下:
dictionary
Stream对象必须包含在对象中,并且对象不是对象。
关键字必须以“”或者“”结尾,不能以“”结尾。组成对象的字节位于关键字及中间。对象一个属相用来说明字节的长度。在中,组成对象的字节也可以来自文件,在对象的对象中指定文件的路径。在这种情况下,关键字和中间的字节是被忽略的。
在表中列出了,对象中的对象常有一些属性。
(Required) The number of bytes from the beginning of the line following
the keyword stream to the last byte just before the keyword
endstream. (There may be an additional EOL marker, preceding
endstream, that is not included in the count and is not logically part
of the stream data.) See “”
name or array
(Optional) The name of a filter to be applied in processing the stream
data found between the keywords stream and endstream, or an array
of such names. Multiple filters should be specified in the order in
which they are to be applied.
DecodeParms
dictionary or array
(Optional) A parameter dictionary, or an array of such dictionaries,
used by the filters specified by Filter. If there is only one filter and that
filter has parameters, DecodeParms must be set to the filter’
dictionary unless all the filter’
values, in which case the DecodeParms entry may be omitted. If there
are multiple filters and any of the filters has parameters set to nondefault
values, DecodeParms must be an array with one entry for
each filter: either the parameter dictionary for that filter, or the null
object if that filter has no parameters (or if all of its parameters have
their default values). If none of the filters have parameters, or if all
their parameters have default values, the DecodeParms entry may be
omitted. (See implementation note 7 in Appendix H.)
file specification
(O PDF 1.2) The file containing the stream data. If this entry
is present, the bytes between stream and endstream are ignored, the
filters are specified by FFilter rather than Filter, and the filter parameters
are specified by FDecodeParms rather than DecodeParms. However,
the Length entry should still specify the number of those bytes.
(Usually there are no bytes and Length is 0.)
name or array
(O PDF 1.2) The name of a filter to be applied in processing
the data found in the stream’
The same rules apply as for Filter.
FDecodeParms
dictionary or array
(O PDF 1.2) A parameter dictionary, or an array of such dictionaries,
used by the filters specified by FFilter. The same rules apply
as for DecodeParms.
3.3.8 Null 对象
Null对象不等于任何对象,用关键字代表。对象引用不存在对象等价与引用空对象。
3.3.9 Indirect 对象
任何的对象都可以声明为对象,对象用一个标识这个对象,以便其他对象可以通过引用它。
Object Indirect有两部分组成:
1).Object Number 由一个正数表示,一般中的是连续的,但不是必须的,他可以是任意顺序。
2).Generation Number由一个非负数标识。在一个新建立的文档中,是。当文档被更新或者修改以后,会被修改为非零值。
对象还包括关键字和以及他们中间包含的对象。例如:
12 为,为,对象值为。
这个对象可以被引用通过和关键字。例如:
如果引用一个没有定义的对象,并不报错,而是等价于引用了一个对象(值为)。
例子定义了一个对象,它的是,
它长度有引用了一个为的对象。
Example 3.1
&& /Length 8 0 R && % An indirect reference to object 8
(A stream with an indirect length) Tj
2.4.&过滤器(Filter)
Filter 是对象中引入的,可以通过对象中的对象的
Filter键表示(如果字节通过文件引入,是键),有一写需要一些参数可以通过(如果字节通过文件引入,是)
/Filter [/ASCII85Decode /LZWDecode]
在创建过程中,应用程序用对中的数据做了压缩或或者转码,等到有应用程序读取的时候,在用对应的对数据进行解码,然后输出到显示设备,进行显示。
如果存在多个,这些会组成一个管道,即第一个输出,会作为第二个的输入,第二个的输出回作为第三个的输入,一次类推。
Filter的种类大概分为两类:
ASCII Filter用来解码恢复已经倍编码为文本的数据。
Decompression filters 用来解压那些被压缩的数据。
关于具体的的种类和解码方式等细节参考《》节中介绍。
2.5.&文档结构
档结构如图:
Header只有一行,用来表示文件遵循的协议版本号。
Body 中存放的是组成文件的所有的。
Cross-reference table 中存放的是关于对象的信息。
Trailer 中指明了的位置和在中特别指定的对象的位置。
Incremental Updates 是在后面添加的对象。如果一个文件被修改了,在文件的末尾还会包含增加的对象。
文件中一行的结尾符可以是‘’、‘’、‘’。除了在对象中的字节,一般一行不超过个字节。
3.5.1 Header
在文档开头会包含此文件所遵循的协议版本,格式如下:
查看文档的软件,如、等等,都能向后兼容。
比如软件是按版本实现,对于遵循版本之前的版本,比如、,都可以查看。
对于文档遵循版本比软件遵循版本高的情况,软件会忽略那些它不认识的新特性。
3.5.2 Body
PDF文档的是有好多代表文档内容的对象组成。这些对象代表文字、图像、表格等组成文档的。
3.5.3 Cross-reference table
一个可以包含一个或者多个,一般文档创建的时候,就由一个组成。如果是(线性用于网络浏览格式,具体可以参见《》)会有两个。如果此添加新的对象,就会添加新的。
每个,以关键字独占一行开头。后边跟着一个或者多个。
第一行是两个以空格分割的数字开头,第一个数字代表此包含的起始的;第二个数字代表这个包含的的个数。所以这个特性决定,每个中的编号都是连续的。比如,第一行是
包含从到的个。
在第一行之后包含一个或者多个(条目),每个独占一行,一共占个字节,有两种格式,一种是代表正在使用称作,第三个字段使用关键词表示,另一种代表不在使用,代表,第三个字段用表示。的格式为:
nnnnnnnnnn ggggg n eol
nnnnnnnnnn 10个字节代表对象在文档中的偏移量()。如果偏移量不够前面补零。
ggggg 5个字节代表对象,作用后边做进一步解释。如果数字不够五位,也是前面补零凑齐。
n 一个字节代表这个对象还是使用。
eol 两个字节标识行结束()。可以是‘’、‘’、‘’如果是‘’、‘’在前面不一个空格组成两个字节。
&每个字段用一个空格分割。总共加一起是个字符。
Free Entry的格式为:
nnnnnnnnnn ggggg f eol
nnnnnnnnnn 是一个字节的数字,标识的是下一个的。这样所有 可以组成一个链表。
ggggg 是一个字节的数字,标识。作用后面解释。
f 是一个字节,代表这是一个。
eol 是两个字节行结束符。
Free Entry的第一个字段表示下一个的,这样所有的都可以组成一个链表结构。如果是链表就需要有个链表头,所以规定第一个是,它的第一个字段是,第二个字段是,作为链表头。链表最后一个的第一个字段设置为,指向第一个。
除了第一个,文档中所有的初始值都是。如果被删除了,相应的修改为,这个的被加一。所以当一个被重新使用,这个都会有一个新的。
Generation的最大值为,当达到最大值以后,这个就不能在重新使用了。
Example 3.5
Example 3.5 显示了一个,这个由一个组成。有六个组成。其中有四个,分别是,,,。还有两个,分别是,。为的对象已经被删除了,所以的的第一个字段是。而为的的第一个字段为,指向第一个。这样就是连起来了。
Example 3.6
Example 3.5 显示了一个,这个由个组成。
3.5.4 File Trailer
一个允许应用程序快速的查找和一些特定的。的格式是:
&& key1 value1
key2 value2
keyn valuen
Byte_offset_of_last_cross-reference_section
一个关键字后面跟着一个对象,然后跟着关键字占一行,然后跟着一个(指的从文件开头到最后一个的偏移量),最后跟着的一行结束标志。
表显示中的对象的成员。
(Required) The total number of entries in the file’
by the combination of the original section and all update sections. Equivalently, this
value is 1 greater than the highest object number used in the file.
(Present only if the file has more than one cross-reference section) The byte offset from
the beginning of the file to the beginning of the previous cross-reference section.
Dictionary
(R must be an indirect reference) The catalog dictionary for the PDF document
contained in the file (see Section 3.6.1, “”
Dictionary
(Required if d PDF 1.1) The document’
(see Section 3.5, “”
Dictionary
(O must be an indirect reference) The document’
(see Section 9.2.1, “”
(O PDF 1.1) An array of two strings constituting a file identifier (see Section
Example 3.7
&& /Size 22
/Root 2 0 R
/Info 1 0 R
/ID [ &81b14aafa313db63dbd6f981e49f94f4&
&81b14aafa313db63dbd6f981e49f94f4&]
3.5.5 增量更新()
增量更新允许文件的修改可以不用修改整个文件,只是把改变、增加的对象添加到文件末尾。优点如下:
1).提高对大文件的小的修改的速度。
2).减少数据丢失的风险。
3).提高修改文件的效率。
4).对于一些已经签名()文件,是不可能修改原来的数据,因为只要修改原来的数据,之前的签名就无效了。
增量更新一个文件的时候,增加、修改的对象会被添加到文件末尾,形成一个,然后包含增加、修改和删除队形的会被添加到的后面。最后会包含的一个新的,它的会指导新添加的,他的对象中的属性值之处之前的位置。这样就和之前文档结构关联起来了。
经过多次增量更新之后,一个文件格式就可能如图。
2.6.&加密(encryption)
PDF可以通过加密保护文档内容,阻止未授权的访问。至加密对象和对象,不会加密对象和对象等标识文档结构,而不是文档内容的对象。
PDF的机密信息,用中的对象中的Encrypt属性标识,属性也是个对象,称这个为。下表显示的属性。
(Required) The name of the security handl see below. Default value:
, for the built-in security handler. (Names for other security handlers can be
registered using the procedure described in Appendix E.)
(Optional but strongly recommended) A code specifying the algorithm to be used in encrypting
and decrypting the document:
0 An algorithm that is undocumented and no longer supported, and whose use is
strongly discouraged.
1 Algorithm 3.1 on page 73, with an encryption key length of 40 see below.
2 (PDF 1.4) Algorithm 3.1 on page 73, but allowing encryption key lengths greater
than 40 bits.
3 (PDF 1.4) An unpublished algorithm allowing encryption key lengths ranging
from 40 to 128 bits. (This algorithm is unpublished as an export requirement of
the U.S. Department of Commerce.)
The default value if this entry is omitted is 0, but a value of 1 or greater is strongly recommended.
(See implementation note 15 in Appendix H.)
(O PDF 1.4; only if V is 2 or 3) The length of the encryption key, in bits. The value
must be a multiple of 8, in the range 40 to 128. Default value: 40.
(Required) A number specifying which revision of the standard security handler should
be used to interpret this dictionary. The revision number should be 2 if the document is
encrypted with a V value less than 2 (see Table 3.13) and does not have any of the access
permissions set (via the P entry, below) that are designated
otherwise (that is, if the document is encrypted with a V value greater than 2 or has any
(Required) A 32-byte string, based on both the owner and user passwords, that is used in
computing the encryption key and in determining whether a valid owner password was
entered. For more information, see “”“
Algorithms”
(Required) A 32-byte string, based on the user password, that is used in determining
whether to prompt the user for a password and, if so, whether a valid user or owner password
was entered. For more information, see “”
(Required) A set of flags specifying which operations are permitted when the document is
opened with user access (see Table 3.15).
不像其他对象中的对象,中的对象不能用常规的加密方法,进行加密。中的属性指定负责对其加密。默认的情况的值为Standard。
3.6.1 标准加密算法()
PDF通用加密使用作为函数,选用作为加密算法。是对称加密算法,他的密钥可以通过各种方式计算出来,下节讨论生成密钥的方面。先看一下加密的过程。
1).取得要加密对象的(包括和组成)。对于不是对象,取包涵它的对象的。
2).用字节的,加上由的后三位加上后两位组成的位,组成个字节。然后用这()个字节作为函数的输入参数。
3).使用输出结果的()个字节,最多不超过个字节,作为,调用,对要加密数据进行加密。
构建文档时候,对于对象是先加密,然后在用编码进行编码。查看文档时候,是用进行解码,然后在解密。
对于对象先进行
,然后在进行解密。
3.6.2 密钥的生成
PDF的加解密过程是通过两个密码进行的:和。
PDF 生成是的时候是更具是否用户提供密码和一些权限限制,如果是就是对文档进行加密。
PDF读取软件,读取的时候,如果是加密文档,会要求用户输入两个密码中的任意一个。如果输入的是,那么用户就有文档权限,除了修改文档和密码的权限。
权限通过中的属性值进行指定,值是一个为的对象,其中代表不同的权限。在不同的版本()中,每个代表的权限值,是不一样。具体值可以参考《》中第页。
版本是通过中的属性值指定,可以是或者。
Encryption Dictionary中的属性值是通过一定加密过程生成值,而属性是通过一定加密过程生成的。对于和的情况,属性值和属性值的生成过程是不一样。具体可以参考《》页。
上文提到的加密之后用到的密钥,也是通过和按照一定方法生成的具体过程可以参考《》页。
2.7.&文档结构
PDF文档可以被看成一个有部分的对象组成的一个。的根就是(目录结构),而结构中有包含很多属性。比如包含了所有组成文档的对象。
下图可以标识文档的层级结构。
3.7.1目录结构()
(Required) The type of PDF object that this
be Catalog for the catalog dictionary.
(O PDF 1.4) The version of the PDF specification to which the
document conforms (for example, 1.4), if later than the version specified
in the file’“”
a later version, or if this entry is absent, the document conforms to
the version specified in the header. This entry enables a PDF producer
application to update the version using a see Section
3.4.5, “”
Note: The value of this entry is a name object, not a number, and so must
be preceded by a slash character (/) when written in the PDF file (for example,
Dictionary
(R must be an indirect reference) The page tree node that is the
root of the document’“”
Pagelabels
NumberTree
(O PDF 1.3) A number tree (see Section 3.8.5,
defining the page labeling for the document. The keys in this tree are
the corresponding values are page label dictionaries (see
Section 8.3.1, “”
labeling range to which the specified page label dictionary applies. The
tree must include a value for page index 0.
Dictionary
(O PDF 1.2) The document’
Dictionary
(O PDF 1.1; must be an indirect reference) A dictionary of names
and corresponding destinations (see “”
ViewerPreferences
Dictionary
(O PDF 1.2) A viewer preferences dictionary (see Section 8.1,
on the screen. If this entry is absent, viewer applications should
use their own current user preference settings.
PageLayout
(Optional) A name object specifying the page layout to be used when the
document is opened:
SinglePage Display one page at a time.
OneColumn Display the pages in one column.
TwoColumnLeft Display the pages in two columns, with oddnumbered
pages on the left.
TwoColumnRight Display the pages in two columns, with oddnumbered
pages on the right.
(See implementation note 19 in Appendix H.) Default value: SinglePage.
(Optional) A name object specifying how the document should be displayed
when opened:
UseNone Neither document outline nor thumbnail images
UseOutlines Document outline visible
UseThumbs Thumbnail images visible
FullScreen Full-screen mode, with no menu bar, window
controls, or any other window visible
Default value: UseNone.
Dictionary
(Optional) A name object specifying how the document should be displayed
when opened:
UseNone Neither document outline nor thumbnail images
UseOutlines Document outline visible
UseThumbs Thumbnail images visible
FullScreen Full-screen mode, with no menu bar, window
controls, or any other window visible
Default value: UseNone.
(O must be an indirect reference) The outline dictionary that is the
root of the document’“
OpenAction
Array or dictionary
(O PDF 1.1) A value specifying a destination to be displayed or
&an action to be performed when the document is opened. The value is
either an array defining a destination (see Section 8.2.1,
or an action dictionary representing an action (Section 8.5,
this entry is absent, the document should be opened to the top of the
first page at the default magnification factor.
Dictionary
(O PDF 1.4) An additional-actions dictionary defining the actions
to be taken in response to various trigger events affecting the document
as a whole (see “”
note 20 in Appendix H.)
Dictionary
(Optional) A URI dictionary containing document-level information for
URI (uniform resource identifier) actions (see “”
Dictionary
(O PDF 1.2) The document’
(see Section 8.6.1, “”
(O PDF 1.4; must be an indirect reference) A metadata stream
containing metadata for the document (see Section 9.2.2,
StructTreeBoot
Dictionary
(O PDF 1.3) The document’
Section 9.6.1, “”
Dictionary
(O PDF 1.4) A mark information dictionary containing information
about the document’
9.7.1, “”
Text String
(O PDF 1.4) A language identifier specifying the natural language
for all text in the document except where overridden by language specifications
for structure elements or marked content (see Section 9.8.1,
considered unknown.
SpiderInfo
Dictionary
(O PDF 1.3) A Web Capture information dictionary containing
state information used by the Acrobat Web Capture (AcroSpider) plugin
extension (see Section 9.9.1, “”
OutputIntents
(O PDF 1.4) An array of output intent dictionaries describing the
color characteristics of output devices on which the document might be
rendered (see “”
3.7.2 页面树()
组成文档的所有页都通过结构进行组织,称作,结构可以允许读取内容的应用程序,在有限的内存上,读取很大文档。
组成有两种类型的节点:一种是节点他自己也是一个,称作。另一种节点叶子节点,称作。
为了进一步优化性能,好多创建文件的软件,把组成一个平衡数()。
3.7.2.1 page tree nodes
(Required) The type of PDF object that this
must be Pages for
a page tree node.
Dictionary
(Required must be an indirect reference) The page tree node that
is the immediate parent of this one.
(Required) An array of indirect references to the immediate children of this node.
The children may be page objects or other page tree nodes.
(Required) The number of leaf nodes (page objects) that are descendants of this
node within the page tree.
Example 3.9
&& /Type /Pages
/Kids [ 4 0 R
&& /Type /Page
&& /Type /Page
&& /Type /Page
Example 3.9 展示了一个文档有三个页,对于每个页的内容,具体查看下一节的介绍。
3.7.2.2 Page Objects
Page Objects 是的叶子节点,包含了文档中一个页的所有属性。下标列出的所有属性,在表中属性,标有()的条目,是说明其值可以从他的父对象中继承(具体可以参考下一节)。关于表中和对象小节进行介绍。
(Required) The type of PDF object that this
Page for a page object.
Dictionary
(R must be an indirect reference) The page tree node that is the immediate
parent of this page object.
LastModified
(Required if PieceI PDF 1.3) The date and
time (see Section 3.8.2, “”’
modified. If a page-piece dictionary (PieceInfo) is present, the
modification date is used to ascertain which of the application data dictionaries
that it contains correspond to the current content of the page
(see Section 9.4, “”
Dictionary
(R inheritable) A dictionary containing any resources required by
the page (see Section 3.7.2, “”
no resources, the value of this entry should be omitting
the entry entirely indicates that the resources are to be inherited from
an ancestor node in the page tree.
(R inheritable) A rectangle (see Section 3.8.3,
in default user space units, defining the boundaries of the physical
medium on which the page is intended to be displayed or printed (see
Section 9.10.1, “”
(O inheritable) A rectangle, expressed in default user space units,
defining the visible region of default user space. When the page is displayed
or printed, its contents are to be clipped (cropped) to this rectangle
and then imposed on the output medium in some implementationdefined
manner (see Section 9.10.1, “”
the value of MediaBox.
(O PDF 1.3) A rectangle, expressed in default user space units, defining
the region to which the contents of the page should be clipped
when output in a production environment (see Section 9.10.1,
Boundaries”
(O PDF 1.3) A rectangle, expressed in default user space units, defining
the intended dimensions of the finished page after trimming (see
Section 9.10.1, “”
(O PDF 1.3) A rectangle, expressed in default user space units, defining
the extent of the page’
white space) as intended by the page’“
Boundaries”
BoxColorInfo
Dictionary
(Optional) A box color information dictionary specifying the colors and
other visual characteristics to be used in displaying guidelines on the
screen for the various page boundaries (see “”
on page 679). If this entry is absent, the viewer application should use its
own current default settings.
Stream or array
(Optional) A content stream (see Section 3.7.1, “”
the contents of this page. If this entry is absent, the page is empty.
The value may be either a single stream or an array of streams. If it is an
array, the effect is as if all of the streams in the array were concatenated, in
order, to form a single stream. This allows a program generating a PDF
file to create image objects and other resources as they occur, even though
they interrupt the content stream. The division between streams may
occur only at the boundaries between lexical tokens (see Section 3.1,
Conventions”’
Applications that consume or produce PDF files are not required
to preserve the existing structure of the Contents array. (See implementation
note 22 in Appendix H.)
(O inheritable) The number of degrees by which the page should
be rotated clockwise when displayed or printed. The value must be a multiple
of 90. Default value: 0.
dictionary
(O PDF 1.4) A group attributes dictionary specifying the attributes
of the page’
Sections 7.3.6, “”“”
(Optional) A stream object defining the page’
8.2.3, “”
(O PDF 1.1; recommended if the page contains article beads) An array
of indirect references to article beads appearing on the page (see Section
8.3.2, “”
The beads are listed in the array in natural reading order.
(O PDF 1.1) The page’
timing): the maximum length of time, in seconds, that the page will be
displayed during presentations before the viewer application automatically
advances to the next page (see Section 8.3.3, “”
default, the viewer does not advance automatically.
Dictionary
(O PDF 1.1) A transition dictionary describing the transition effect
to be used when displaying the page during presentations (see Section
8.3.3, “”
(Optional) An array of annotation dictionaries representing annotations
associated with the page (see Section 8.4, “”
Dictionary
(O PDF 1.2) An additional-actions dictionary defining actions to
be performed when the page is opened or closed (see Section 8.5.2,
(O PDF 1.4) A metadata stream containing metadata for the page
(see Section 9.2.2, “”
Dictionary
(O PDF 1.3) A page-piece dictionary associated with the page (see
Section 9.4, “”
StructParents
(Required if the page contains stru PDF 1.3) The integer
key of the page’“
Elements from Content Items”
(O PDF 1.3; indirect reference preferred) The digital identifier of the
Related to Web Capture”
(O PDF 1.3) The page’
factor by which it should be scaled to achieve the
(see Section 9.9.5, “”
SeperationInfo
Dictionary
(O PDF 1.3) A separation dictionary containing information needed
to generate color separations for the page (see Section 9.10.3,
Dictionaries”
Example 3.10 显示文档中一个,这个由一个,两个。
MediaBox指定这个将要一个信纸大小的纸上。指定这个使用了三种字体,分别是是、、
Example 3.10
&& /Type /Page
/Parent 4 0 R
/MediaBox [0 0 612 792]
/Resources && /Font && /F3 7 0 R
/F7 11 0 R
/ProcSet [/PDF]
/Contents 12 0 R
/Thumb 14 0 R
/Annots [ 23 0 R
3.7.2.3 页属性的继承()
上表可以看到有些页的属性值被指定为,说明的属性值如果被省略了,它的值可以从他的父对象中继承。如果这个属性在中是,那么父对象中,一定要提供这个值。如果这个属性是的,那么使用父对象的中的属性值或者取默认值。
3.7.3.4 名字对照表()
在文档,有些对象是通过直接引用的,而不是通过。和对应的对象之间的关系是通过表建立,可以通过中文件目录中的属性值找到。
3.8 Content Streams and Resources
3.8.1 Content Stream
Content Stream 是一个对象,其数据部分是一个指令()队列,用来描述一个页是怎么被显示的。每一个页可能由多个组成,这种情况所有的组成一个指令队列,相当于一个大的。
Content Stream 中的之类,在被解释执行之前,先要用指定的对的内容进行解码。
每一个指令由(操作数)和(操作码)组成。位于前面
Operands可以由任意的基本对象组成,除了对象。有一些特殊的需要作为他的。对象不允许做。
Operators 是文档中的关键字,它和对象的区别是,不以‘’开头。
4、、、章进步说明支持的。
通常情况下,如果一个读取软件的时候遇到不认识的,会报错。如果不想让其报错,可以用和关键字包含那些指令。这样读取软件会忽略不认识的。
3.8.2 Resources Dictionary
有的时候,需要引用自身之外的对象,例如字体、一个包含图片的对象。这种情况就需要需要把引用到的对象声明为。中定义各种。
Resource Dictionary 通过三种方式和关联在一起:
1).Content Stream 是页内容的属性的值,这种情况,对应的是页内容的的属性的值。
2).对于除了页内容外的其他,对应的是通过中的对象的属性的值指定的。
3).对于和会忽略中的属性,这种情况,是使用包含或的页的的值。
每一个中值是资源类型的名字,对应也是一个对象,我们称作。对象的值指定类型的一个资源名称,对象值是引用的资源对象。
下表列出了所有的资源类型名称。
Dictionary
(Optional) A dictionary mapping resource names to graphics state parameter
dictionaries (see Section 4.3.4,
ColorSpace
Dictionary
(Optional) A dictionary mapping each resource name to either the name of a
device-dependent color space or an array describing a color space (see Section
Dictionary
(Optional) A dictionary mapping resource names to pattern objects (see Section
Dictionary
(O PDF 1.3) A dictionary mapping resource names to shading dictionaries
(Optional) A dictionary mapping resource names to external objects (see Section
Dictionary
(Optional) A dictionary mapping resource names to font dictionaries (see
Chapter 5).
(Optional) An array of predefined procedure set names (see Section 9.1,
Properties
Dictionary
(O PDF 1.2) A dictionary mapping resource names to property list
dictionaries for marked content (see Section 9.5.1,
Example 3.11
&& /ProcSet [/PDF /ImageB]
/Font && /F5 6 0 R
/F7 10 0 R
/F8 12 0 R
/XObject && /Im1 13 0 R
/Im2 15 0 R
Example 定一个包含 、、类型资源的。资源包含四个对象分别是、、、。
3.9 Common Data Structures
这节介绍四种数据对象、、、、。这五种数据类型,不能用在对象中。
3.9.1 Text Strings
Text Strings 对象是或者编码。是编码的一个超集。
如果用编码,前两个字节必须是和,代表是编码。
任何使用编码的地方,都会有一个转义字符串来表名字符串使用哪国语言写的。转移字符串有下列部分顺序组成。
1. The Unicode value U+001B (that is, the byte sequence 0 followed by 27)
2. A 2-character ISO 639 language code—
3. (Optional) A 2-character ISO 3166 country code—
United States or JP for Japan
4.&The Unicode value U+001B
3.9.2 Dates
PDF文档的日期格式是:
(D:YYYYMMDDHHmmSSOHH'mm')
l&YYYY代表年
l&MM代表月
l&DD代表月
l&HH代表小时
l&mm代表分
l&SS代表秒
l&O表示是本地时间和标准国际标准时间()的关系,如果是‘’标识本地时间比国际标准时间慢,如果是‘’标识本地时间比国际标准时间快,具体的差值由后面的和标识。
l&mm’&表示本地时间和国际标准时间查多少个分钟。后面的单引号是语法的一部分,不能省略。
YYYY后面所有的项都是可以省略的,和的默认值是,其他项的默认值是。
For example, December 23, 1998, at 7:52 PM, U.S. Pacific Standard Time, is represented
by the string
3.9.3 Rectangles
Rectangles 是一个对象,通过两个对角坐标来描述矩形位置,通常格式是:
[llx lly urx ury]
llx lly 表示左下角()的坐标,。
urx ury 标识右上角()的坐标,。
也可以通过左上交和右下角坐标确定一个矩形。
3.9.4 Name Trees
Name Trees 由几种节点组成,每个节点都是一个对象。有三种类型的节点,节点、节点、节点(相当于叶子节点)。
Root节点中包含对节点或者节点的引用,但是不能同时两种都存在。
Kids节点中包含对节点应用。
这样由这三种节点就可以组成一颗逻辑上的数。
Name Trees 各种节点中有三种属性。
(Root and int required i present in the root node
if and only if Names is not present) An array of indirect references to the immediate children
of this node. The children may be intermediate or leaf nodes.
(Root re present in the root node if and only if Kids
is not present) An array of the form
[key1 value1 key2 value2 …
where each keyi is a string and the corresponding valuei is an indirect reference to the
object associated with that key. The keys are sorted in lexical order, as described below.
(Intermediate required) An array of two strings, specifying the (lexically)
least and greatest keys included in the Names array of a leaf node or in the Names
arrays of any leaf nodes that are descendants of an intermediate node.
Name属性的的是对象,而且是按字母顺序排序的。
Limit对象是一个由两个对象组成,标识属性所在节点(包括它的子节点)中,最小和最大的属性的值。
Example 3.24用结构描述如下图分类的元素周期表。
/Kids [ 2 0 R % Root node
&& /Limits [(Actinium) (Gold)] % Intermediate node
/Kids [ 5 0 R
&& /Limits [(Hafnium) (Protactinium)] % Intermediate node
/Kids [ 12 0 R
&& /Limits [(Radium) (Zirconium)] % Intermediate node
/Kids [ 20 0 R
&& /Limits [(Actinium) (Astatine)] % Leaf node
/Names [ (Actinium) 25 0 R
(Aluminum) 26 0 R
(Americium) 27 0 R
(Antimony) 28 0 R
(Argon) 29 0 R
(Arsenic) 30 0 R
(Astatine) 31 0 R
&& /Limits [(Xenon) (Zirconium)] % Leaf node
/Names [ (Xenon) 129 0 R
(Ytterbium) 130 0 R
(Yttrium) 131 0 R
(Zinc) 132 0 R
(Zirconium) 133 0 R
89 % Atomic number (Actinium)
40 % Atomic number (Zirconium)
3.9.5 Number Trees
Number Trees 和结构相似,区别在于节点属性中的值是对象,而不是对象。
3.9 Functions(函数)对象
虽然不是一个编程语言,但是提供了一些函数对象,用于数学、采样还原等等计算。所有的函数对象都会有一些通用的属性如下表:
FunctionType
(Required) The function type:
0 Sampled function
2 Exponential interpolation function
3 Stitching function
4 PostScript calculator function
(Required) An array of 2 ×
values. For each i from 0 to m -
Domain2i+1, and the ith input value, xi , must lie in the interval
Domain2i ≤ ≤
clipped to the nearest boundary value.
(Required for type 0 and type 4 functions, see below) An
array of 2 ×
from 0 to n -
output value, yj , must lie in the interval Range2j
values outside the declared range are clipped to the nearest boundary value.
If this entry is absent, no clipping is done.
每种类型的函数,还会有特定的函数属性和计算过程,具体可以参考《》到节的介绍。
3.10 文件引用()
我们可以通过文件引用(),在文档中已用别的文件中的内容。文件引用分文简单文件引用()和全文件引用。简单文件引用可以是对象也可以是对象。全文件引用只能是对象。
文件引用是平台无关的,当在具体平台上读取文档的时候,会转换为平台相关的文件引用。
3.10.1 文件引用字符串()
文件引用字符串通过多个子字符串组成,每个部分用‘’进行分割。如果‘’是子字符串的一部分,就需要转义,在前面加两个反斜杠“”。
(in\\/out) 代表的是()
文件引用还可以分文相对文件引用和绝对文件引用,其含义和相对路劲和绝对路径差不多。以‘’开头的是绝对文件引用,否则为相对文件引用。
在以后的协议中,允许组成文件引用的子字符串可以是多字节字符,比如中文。这种必须要有对象的十六进制的表示方法。由于‘’码为和‘’(码为),但多自己字符中包含和的时候,要在前面添加一个,比如有个两个字节的编码为要写成。
3.10.2 文件引用字典()
文件引用字典是个对象。它允许多个文件对应多个不同的文件系统。
下边是对象包含的属性:
()值为指明这是个文件引用对象。
()文件系统的文成,只有一个标准文件系统。
(,,)文件描述字符串。当,,属性都没有的时候使用。
()指定系统中使用的文件引用。
()指定系统中使用的文件引用。
()文件标识(具体作用参考《》节)。
()指定引用文件是是否是易变()。如果是,读取软件不要缓冲引用文件的内容。
Dictionary
嵌入()引用文件对象。
Dictionary
引用文件对象。
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
阅读:6638 评论:1
https://blog.csdn.net/jinshixie/article/details/
https://blog.csdn.net/jinshixie/article/details/
最好的解决办法:查下“生成”-& “配置管理器”-& “活动解决方案平台”是否选择的“win32”?
1. 安装64位编译环境
最近准备编译64位版本的程序。因为之前已经安装了VS 2008,开始以为只是使用VS 2008的安装文件添加功能即可,后来发现没这么简单。
直接双击VS 2008的安装文件来安装会出现下面的错误提示:
查了一下网上的资料,网上的说法是这是由于安装了VS 2008 sp1造成的,要解决这个问题,必须先把sp1给卸载了。但是我查了下
控制面板中的“添加或删除程序”,发现并没有单独的VS 2008 sp1的选项,如下图:
因此要解决这个问题只得另辟蹊径了,到网上查了下,终于找到有效的解决办法了:
1. 在控制面板中的“添加或删除程序”——选择Microsoft Visual Studio Team System 2008 Team Suite - 简单中文,然后单击“更新/删除”按钮,如下图:
2. 单击“添加/删除功能”,如下图:
3.在语言工具——Visual C++中将X64编译器和工具打上勾,如下图:
4. 开始安装,如下图:
5. 安装完成后在开始菜单中的会出现“Visual Studio 2008 x64 兼容工具命令提示”,如下图:
2. 配置64位编译器
首先,打开一个解决方案,单击“配置管理器”,如下图:
接着,新建“活动解决方案平台”,如下图:
然后,选择新的平台x64,如下图:
最后,配置完成,如下图:
最后,关闭然后编译工程即可。
如果使用makefile编译,则要使用Visual Studio 2008 x64 兼容工具命令提示来进行编译。
作者:jinshixie 发表于
https://blog.csdn.net/jinshixie/article/details/
阅读:1509}

我要回帖

更多关于 最好的摩托车发动机 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信