Skip to content

Pressure Sensitive Ink

Pressure-sensitive inkjet (PSI) is a technology that obtains varying electrical output in response to varying pressures or forces acting on elements of a pressure-sensitive device. In PDFs, PSI is often used for handwritten signatures, where PSI data is collected by capturing changes in finger or stylus pressure. The PSI data contains the coordinates and canvas of the operating area and is used to draw the appearance of the PSI. Foxit PDF SDK allows applications to create PSI, access its properties, manipulate ink and canvas, and release PSI.

c++
#include "include/common/fs_common.h"
#include "include/pdf/fs_pdfdoc.h"
#include "include/pdf/fs_pdfpage.h"
#include "include/pdf/fs_psi.h"

using namespace foxit;
using namespace foxit::common;
using foxit::common::Library;
using namespace pdf;
using namespace annots;

PSI psi(480, 180, true);

// Set ink diameter.
psi.SetDiameter(9);

// Set ink color.
psi.SetColor(0x434236);

// Set ink opacity.
psi.SetOpacity(0.8f);

// Add points to pressure sensitive ink.
float x = 121.3043f;
float y = 326.6846f;
float pressure = 0.0966f;
Path::PointType type = Path::e_TypeMoveTo;
psi.AddPoint(PointF(x, y), type, pressure); 
...
C
#include "include/fs_basictypes_c.h"
#include "include/fs_common_c.h"
#include "include/fs_pdfdoc_c.h"
#include "include/fs_pdfpage_c.h"
#include "include/fs_psi_c.h"

FS_PSI_HANDLE psi;
FSDK_PSI_Create0(480, 180, true, &psi);

// Set ink diameter.
FSDK_PSI_SetDiameter(psi, 9);

// Set ink color.
FSDK_PSI_SetColor(psi, 0x434236);

// Set ink opacity.
FSDK_PSI_SetOpacity(psi, 0.8f);

// Add points to pressure sensitive ink.
float x = 121.3043f;
float y = 326.6846f;
float pressure = 0.0966f;
FSPointType type = e_FSTypeMoveTo;
FSPointF point;
point.x = x;
point.y = y;
FSDK_PSI_AddPoint(psi, point, type, pressure);
...
java
import com.foxit.sdk.pdf.PSI;
import com.foxit.sdk.common.fxcrt.PointF;
...

PSI psi = new PSI(480, 180, true);

// Set ink diameter.
psi.setDiameter(9);

// Set ink color.
psi.setColor(0x434236);

// Set ink opacity.
psi.setOpacity(0.8f);

// Add points to pressure sensitive ink.
float x = 121.3043f;
float y = 326.6846f;
float pressure = 0.0966f;
int type = 1;
PointF point = new PointF(x, y);
psi.addPoint(point, type, pressure); 
...
py
import sys
import site

if sys.version_info.major == 2:
    _PYTHON2_ = True
else:
    _PYTHON2_ = False

if _PYTHON2_:
    #replace with the python2 lib path
    site.addsitedir('../../../')
    from FoxitPDFSDKPython2 import *
else:
from FoxitPDFSDKPython3 import *

psi = PSI(480, 180, True)

# Set ink diameter.
psi.SetDiameter(9)

# Set ink color.
psi.SetColor(0x434236)

# Set ink opacity.
psi.SetOpacity(0.8)

# Add points to pressure sensitive ink.
x = 121.3043
y = 326.6846
pressure = 0.0966
type = Path.e_TypeMoveTo
psi.AddPoint(PointF(x, y), type, pressure)
objc
#include "FSPDFObjC.h"
...

FSPSI *psi = [[FSPSI alloc] initWithWidth:480 height:180 simulate:YES];

// Set ink diameter.
[psi setDiameter:9];

// Set ink color.
[psi setColor:0x434236];

// Set ink opacity.
[psi setOpacity:0.8f];

// Add points to pressure sensitive ink.
float x = 121.3043f;
float y = 326.6846f;
float pressure = 0.0966f;
FSPathPointType type = FSPathTypeMoveTo;

FSPointF *pt = [[FSPointF alloc] init];
pt.x = 121.3043f;
pt.y = 326.6846f;
[psi addPoint:pt type:type pressure:pressure]; 
...
js
const FSDK = require("@fuxinsoft/foxit-pdf-sdk-node");

let psi = new FSDK.PSI(480, 180, true);

// Set ink diameter.
psi.SetDiameter(9);

// Set ink color.
psi.SetColor(0x434236);

// Set ink opacity.
psi.SetOpacity(0.8);

// Add points to pressure sensitive ink.
let x = 121.3043
let y = 326.6846
let pressure = 0.0966
let type = FSDK.Path.e_TypeMoveTo
psi.AddPoint(new FSDK.PointF(x, y), type, pressure)
csharp
using foxit;
using foxit.common;
using foxit.common.fxcrt;
using foxit.pdf;
using foxit.pdf.annots;
...

PSI psi = new PSI(480, 180, true);

// Set ink diameter.
psi.SetDiameter(9);

// Set ink color.
psi.SetColor(0x434236);

// Set ink opacity.
psi.SetOpacity(0.8f);

// Add points to pressure sensitive ink.
float x = 121.3043f;
float y = 326.6846f;
float pressure = 0.0966f;
Path.PointType type = Path.PointType.e_TypeMoveTo;
foxit.common.fxcrt.PointF pt = new foxit.common.fxcrt.PointF(x, y);
psi.AddPoint(pt, type, pressure);
...
go
import (
. "foxit.com/fsdk"
)

psi := NewPSI(480, 180, True)

# Set ink diameter.
psi.SetDiameter(9)

# Set ink color.
psi.SetColor(0x434236)

# Set ink opacity.
psi.SetOpacity(0.8)

# Add points to pressure sensitive ink.
x := 121.3043
y := 326.6846
pressure := 0.0966
type := PathE_TypeMoveTo
psi.AddPoint(NewPointF(x, y), type, pressure)