C
int32_t __stdcall pdfCreateViewportA(PPDF IPDF, const char* Name, double X1, double Y1, double X2, double Y2);
int32_t __stdcall pdfCreateViewportW(PPDF IPDF, const wchar_t* Name, double X1, double Y1, double X2, double Y2);
Delphi
function pdfCreateViewportA(const IPDF: PPDF; const Name: PAnsiChar; X1, Y1, X2, Y2: Double): Integer; stdcall;
function pdfCreateViewportW(const IPDF: PPDF; const Name: PWideChar; X1, Y1, X2, Y2: Double): Integer; stdcall;
Purpose. Register a new /Viewport entry (a named rectangular sub-region of the current page) — the prerequisite object that pdfCreateRectilinearMeasure/pdfCreateGeospatialMeasure attach a /Measure dictionary to.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Name | The viewport's /Name label. |
X1,Y1,X2,Y2 | The viewport's rectangle on the current page. |
Return value. The new viewport's 1-based index on the current page; 0 if there is no current page.
See also. pdfCreateRectilinearMeasure.
C# (P/Invoke)
wrappers/dotnet/LumasPdf.cs
public static extern int pdfCreateViewportA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Name, double X1, double Y1, double X2, double Y2);
public static extern int pdfCreateViewportW(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string Name, double X1, double Y1, double X2, double Y2);
Area
Core SDK
Category
Object Creation
Exported names
pdfCreateViewportA
pdfCreateViewportW
String variants
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
See working code
Worked examples — complete programs in ten languages.