2 ' << Haru Free PDF Library >> -- hpdfvb.vb
4 ' VB.Net wrapper for libhpdf.dll
6 ' Copyright (c) 2008 Matthew Underwood <matt@bargolf.net>
8 ' Permission to use, copy, modify, distribute and sell this software
9 ' and its documentation for any purpose is hereby granted without fee,
10 ' provided that the above copyright notice appear in all copies and
11 ' that both that copyright notice and this permission notice appear
12 ' in supporting documentation.
13 ' It is provided "as is" without express or implied warranty.
18 Imports System.Runtime.InteropServices
22 Public Enum HPdfPageLayout As Integer
23 HPDF_PAGE_LAYOUT_SINGLE = 0
24 HPDF_PAGE_LAYOUT_ONE_COLUMN
25 HPDF_PAGE_LAYOUT_TWO_CLUMN_LEFT
26 HPDF_PAGE_LAYOUT_TWO_CLUMN_RIGHT
29 Public Enum HPdfPageMode As Integer
30 HPDF_PAGE_MODE_USE_NONE = 0
31 HPDF_PAGE_MODE_USE_OUTLINE
32 HPDF_PAGE_MODE_USE_THUMBS
33 HPDF_PAGE_MODE_FULL_SCREEN
36 Public Enum HPdfPageSizes As Integer
37 HPDF_PAGE_SIZE_LETTER = 0
44 HPDF_PAGE_SIZE_EXECUTIVE
51 Public Enum HPdfPageDirection As Integer
52 HPDF_PAGE_PORTRAIT = 0
55 Public Enum HPdfPageNumStyle As UInt32
56 HPDF_PAGE_NUM_STYLE_DECIMAL = 0
57 HPDF_PAGE_NUM_STYLE_UPPER_ROMAN
58 HPDF_PAGE_NUM_STYLE_LOWER_ROMAN
59 HPDF_PAGE_NUM_STYLE_UPPER_LETTERS
60 HPDF_PAGE_NUM_STYLE_LOWER_LETTERS
61 HPDF_PAGE_NUM_STYLE_EOF
63 Public Enum HPdfWritingMode As UInt32
64 HPDF_WMODE_HORIZONTAL = 0
68 Public Enum HPdfEncoderType As UInt32
69 HPDF_ENCODER_TYPE_SINGLE_BYTE = 0
70 HPDF_ENCODER_TYPE_DOUBLE_BYTE
71 HPDF_ENCODER_TYPE_UNINITIALIZED
74 Public Enum HPdfByteType As UInt32
75 HPDF_BYTE_TYPE_SINGLE = 0
78 HPDF_BYTE_TYPE_UNKNOWN
80 Public Enum HPdfAnnotHighlightMode As UInt32
81 HPDF_ANNOT_NO_HIGHTLIGHT = 0
83 HPDF_ANNOT_INVERT_BORDER
84 HPDF_ANNOT_DOWN_APPEARANCE
85 HPDF_ANNOT_HIGHTLIGHT_MODE_EOF
87 Public Enum HPdfAnnotIcon As UInt32
88 HPDF_ANNOT_ICON_COMMENT = 0
92 HPDF_ANNOT_ICON_NEW_PARAGRAPH
93 HPDF_ANNOT_ICON_PARAGRAPH
94 HPDF_ANNOT_ICON_INSERT
97 Public Enum HPdfColorSpace As UInt32
98 HPDF_CS_DEVICE_GRAY = 0
111 Public Enum HPdfInfoType As UInt32
112 ' date-time type parameters
113 HPDF_INFO_CREATION_DATE = 0
114 HPDF_INFO_MOD_DATE = 1
116 ' string type parameters
118 HPDF_INFO_CREATOR = 3
119 HPDF_INFO_PRODUCER = 4
121 HPDF_INFO_SUBJECT = 6
122 HPDF_INFO_KEYWORDS = 7
125 Public Enum HPdfEncryptMode As UInt32
129 Public Enum HPdfTextRenderingMode As UInt32
132 HPDF_FILL_THEN_STROKE = 2
134 HPDF_FILL_CLIPPING = 4
135 HPDF_STROKE_CLIPPING = 5
136 HPDF_FILL_STROKE_CLIPPING = 6
138 HPDF_RENDERING_MODE_EOF = 8
140 Public Enum HPdfLineCap As Integer
143 HPDF_PROJECTING_SCUARE_END = 2
146 Public Enum HPdfLineJoin As Integer
150 HPDF_LINEJOIN_EOF = 3
152 Public Enum HPdfTextAlignment As Integer
154 HPDF_TALIGN_RIGHT = 1
155 HPDF_TALIGN_CENTER = 2
156 HPDF_TALIGN_JUSTIFY = 3
158 Public Enum HPdfTransitionStyle As Integer
159 HPDF_TS_WIPE_RIGHT = 0
163 HPDF_TS_BARN_DOORS_HORIZONTAL_OUT
164 HPDF_TS_BARN_DOORS_HORIZONTAL_IN
165 HPDF_TS_BARN_DOORS_VERTICAL_OUT
166 HPDF_TS_BARN_DOORS_VERTICAL_IN
169 HPDF_TS_BLINDS_HORIZONTAL
170 HPDF_TS_BLINDS_VERTICAL
172 HPDF_TS_GLITTER_RIGHT
174 HPDF_TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT
178 Public Enum HPdfBlendMode As Integer
193 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfRect
194 Public left As Single
195 Public bottom As Single
196 Public right As Single
199 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfBox
200 Public left As Single
201 Public bottom As Single
202 Public right As Single
205 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfPoint
209 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfDate
211 Public month As Int32
214 Public minutes As Int32
215 Public seconds As Int32
217 Public off_hour As Int32
218 Public off_minutes As Int32
220 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfTextWidth
221 Public numchars As UInt32
222 ' don't use this value (it may be change in the feature). use numspace as alternated. */
223 Public numwords As UInt32
225 Public width As UInt32
226 Public numspace As UInt32
228 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfTransMatrix
236 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfDashMode_Internal
237 Public ptn0 As UInt16
238 Public ptn1 As UInt16
239 Public ptn2 As UInt16
240 Public ptn3 As UInt16
241 Public ptn4 As UInt16
242 Public ptn5 As UInt16
243 Public ptn6 As UInt16
244 Public ptn7 As UInt16
245 Public num_ptn As UInt32
246 Public phase As UInt32
248 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfDashMode
249 Public ptn As UInt16()
250 Public phase As UInt32
252 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfRGBColor
257 <StructLayout(LayoutKind.Sequential)> Public Structure HPdfCMYKColor
264 ' error handler (call back function)
265 Public Delegate Sub HPDF_ErrorHandler(ByVal error_no As uint32, ByVal detail_no As uint32, ByVal user_data As IntPtr)
268 Implements IDisposable
270 Public Const HPDF_TRUE As Integer = 1
271 Public Const HPDF_FALSE As Integer = 0
272 Public Const HPDF_COMP_NONE As UInt32 = 0
273 Public Const HPDF_COMP_TEXT As UInt32 = 1
274 Public Const HPDF_COMP_IMAGE As UInt32 = 2
275 Public Const HPDF_COMP_METADATA As UInt32 = 4
276 Public Const HPDF_COMP_ALL As UInt32 = 15
278 Public Const HPDF_HIDE_TOOLBAR As UInt32 = 1
279 Public Const HPDF_HIDE_MENUBAR As UInt32 = 2
280 Public Const HPDF_HIDE_WINDOW_UI As UInt32 = 4
281 Public Const HPDF_FIT_WINDOW As UInt32 = 8
282 Public Const HPDF_CENTER_WINDOW As UInt32 = 16
284 Public Const HPDF_ENABLE_READ As UInt32 = 0
285 Public Const HPDF_ENABLE_PRINT As UInt32 = 4
286 Public Const HPDF_ENABLE_EDIT_ALL As UInt32 = 8
287 Public Const HPDF_ENABLE_COPY As UInt32 = 16
288 Public Const HPDF_ENABLE_EDIT As UInt32 = 32
290 Private Declare Function HPDF_GetVersion Lib "libhpdf.dll" Alias "HPDF_GetVersion" () As String
291 Private Declare Function HPDF_New Lib "libhpdf.dll" Alias "HPDF_New" (ByVal user_error_fn As HPDF_ErrorHandler, ByVal user_data As IntPtr) As IntPtr
292 Private Declare Sub HPDF_Free Lib "libhpdf.dll" Alias "HPDF_Free" (ByVal pdf As IntPtr)
293 Private Declare Function HPDF_NewDoc Lib "libhpdf.dll" Alias "HPDF_NewDoc" (ByVal pdf As IntPtr) As UInt32
294 Private Declare Function HPDF_FreeDoc Lib "libhpdf.dll" Alias "HPDF_FreeDoc" (ByVal pdf As IntPtr) As UInt32
295 Private Declare Function HPDF_FreeDocAll Lib "libhpdf.dll" Alias "HPDF_FreeDocAll" (ByVal pdf As IntPtr) As UInt32
296 Private Declare Function HPDF_HasDoc Lib "libhpdf.dll" Alias "HPDF_HasDoc" (ByVal pdf As IntPtr) As UInt32
297 Private Declare Function HPDF_SaveToFile Lib "libhpdf.dll" Alias "HPDF_SaveToFile" (ByVal pdf As IntPtr, ByVal file_name As String) As UInt32
298 Private Declare Function HPDF_GetError Lib "libhpdf.dll" Alias "HPDF_GetError" (ByVal pdf As IntPtr) As UInt32
299 Private Declare Function HPDF_GetErrorDetail Lib "libhpdf.dll" Alias "HPDF_GetErrorDetail" (ByVal pdf As IntPtr) As UInt32
300 Private Declare Sub HPDF_ResetError Lib "libhpdf.dll" Alias "HPDF_ResetError" (ByVal pdf As IntPtr)
301 Private Declare Function HPDF_SetPagesConfiguration Lib "libhpdf.dll" Alias "HPDF_SetPagesConfiguration" (ByVal pdf As IntPtr, ByVal page_per_pages As UInt32) As UInt32
302 Private Declare Function HPDF_GetPageByIndex Lib "libhpdf.dll" Alias "HPDF_GetPageByIndex" (ByVal pdf As IntPtr, ByVal index As UInt32) As IntPtr
303 Private Declare Function HPDF_GetPageLayout Lib "libhpdf.dll" Alias "HPDF_GetPageLayout" (ByVal pdf As IntPtr) As HPdfPageLayout
304 Private Declare Function HPDF_SetPageLayout Lib "libhpdf.dll" Alias "HPDF_SetPageLayout" (ByVal pdf As IntPtr, ByVal layout As HPdfPageLayout) As UInt32
305 Private Declare Function HPDF_GetPageMode Lib "libhpdf.dll" Alias "HPDF_GetPageMode" (ByVal pdf As IntPtr) As HPdfPageMode
306 Private Declare Function HPDF_SetPageMode Lib "libhpdf.dll" Alias "HPDF_SetPageMode" (ByVal pdf As IntPtr, ByVal layout As HPdfPageMode) As UInt32
307 Private Declare Function HPDF_SetOpenAction Lib "libhpdf.dll" Alias "HPDF_SetOpenAction" (ByVal pdf As IntPtr, ByVal open_action As IntPtr) As UInt32
308 Private Declare Function HPDF_GetViewerPreference Lib "libhpdf.dll" Alias "HPDF_GetViewerPreference" (ByVal pdf As IntPtr) As UInt32
309 Private Declare Function HPDF_SetViewerPreference Lib "libhpdf.dll" Alias "HPDF_SetViewerPreference" (ByVal pdf As IntPtr, ByVal value As UInt32) As UInt32
310 Private Declare Function HPDF_GetCurrentPage Lib "libhpdf.dll" Alias "HPDF_GetCurrentPage" (ByVal pdf As IntPtr) As IntPtr
311 Private Declare Function HPDF_AddPage Lib "libhpdf.dll" Alias "HPDF_AddPage" (ByVal pdf As IntPtr) As IntPtr
312 Private Declare Function HPDF_InsertPage Lib "libhpdf.dll" Alias "HPDF_InsertPage" (ByVal pdf As IntPtr, ByVal page As IntPtr) As IntPtr
313 Private Declare Function HPDF_GetFont Lib "libhpdf.dll" Alias "HPDF_GetFont" (ByVal pdf As IntPtr, ByVal font_name As String, ByVal encoding_name As String) As IntPtr
314 Private Declare Function HPDF_LoadType1FontFromFile Lib "libhpdf.dll" Alias "HPDF_LoadType1FontFromFile" (ByVal pdf As IntPtr, ByVal afmfilename As String, ByVal pfmfilename As String) As String
315 Private Declare Function HPDF_LoadTTFontFromFile Lib "libhpdf.dll" Alias "HPDF_LoadTTFontFromFile" (ByVal pdf As IntPtr, ByVal file_name As String, ByVal embedding As Int32) As String
316 Private Declare Function HPDF_LoadTTFontFromFile2 Lib "libhpdf.dll" Alias "HPDF_LoadTTFontFromFile2" (ByVal pdf As IntPtr, ByVal file_name As String, ByVal index As UInt32, ByVal embedding As Int32) As String
317 Private Declare Function HPDF_AddPageLabel Lib "libhpdf.dll" Alias "HPDF_AddPageLabel" (ByVal pdf As IntPtr, ByVal page_num As UInt32, ByVal style As HPdfPageNumStyle, ByVal first_page As UInt32, ByVal prefix As UInt32) As IntPtr
318 Private Declare Function HPDF_UseJPFonts Lib "libhpdf.dll" Alias "HPDF_UseJPFonts" (ByVal pdf As IntPtr) As UInt32
319 Private Declare Function HPDF_UseKRFonts Lib "libhpdf.dll" Alias "HPDF_UseKRFonts" (ByVal pdf As IntPtr) As UInt32
320 Private Declare Function HPDF_UseCNSFonts Lib "libhpdf.dll" Alias "HPDF_UseCNSFonts" (ByVal pdf As IntPtr) As UInt32
321 Private Declare Function HPDF_UseCNTFonts Lib "libhpdf.dll" Alias "HPDF_UseCNTFonts" (ByVal pdf As IntPtr) As UInt32
322 Private Declare Function HPDF_CreateOutline Lib "libhpdf.dll" Alias "HPDF_CreateOutline" (ByVal pdf As IntPtr, ByVal parent As IntPtr, ByVal title As String, ByVal encoded As IntPtr) As UInt32
323 Private Declare Function HPDF_GetEncoder Lib "libhpdf.dll" Alias "HPDF_GetEncoder" (ByVal pdf As IntPtr, ByVal encoding_name As String) As IntPtr
324 Private Declare Function HPDF_GetCurrentEncoder Lib "libhpdf.dll" Alias "HPDF_GetCurrentEncoder" (ByVal pdf As IntPtr) As IntPtr
325 Private Declare Function HPDF_SetCurrentEncoder Lib "libhpdf.dll" Alias "HPDF_SetCurrentEncoder" (ByVal pdf As IntPtr, ByVal encoding_name As String) As UInt32
326 Private Declare Function HPDF_UseJPEncodings Lib "libhpdf.dll" Alias "HPDF_UseJPEncodings" (ByVal pdf As IntPtr) As UInt32
327 Private Declare Function HPDF_UseKREncodings Lib "libhpdf.dll" Alias "HPDF_UseKREncodings" (ByVal pdf As IntPtr) As UInt32
328 Private Declare Function HPDF_UseCNSEncodings Lib "libhpdf.dll" Alias "HPDF_UseCNSEncodings" (ByVal pdf As IntPtr) As UInt32
329 Private Declare Function HPDF_UseCNTEncodings Lib "libhpdf.dll" Alias "HPDF_UseCNTEncodings" (ByVal pdf As IntPtr) As UInt32
330 Private Declare Function HPDF_LoadPngImageFromFile Lib "libhpdf.dll" Alias "HPDF_LoadPngImageFromFile" (ByVal pdf As IntPtr, ByVal filename As String) As IntPtr
331 Private Declare Function HPDF_LoadPngImageFromFile2 Lib "libhpdf.dll" Alias "HPDF_LoadPngImageFromFile2" (ByVal pdf As IntPtr, ByVal filename As String) As IntPtr
332 Private Declare Function HPDF_LoadJpegImageFromFile Lib "libhpdf.dll" Alias "HPDF_LoadJpegImageFromFile" (ByVal pdf As IntPtr, ByVal filename As String) As IntPtr
333 Private Declare Function HPDF_LoadRawImageFromFile Lib "libhpdf.dll" Alias "HPDF_LoadRawImageFromFile" (ByVal pdf As IntPtr, ByVal filename As String, ByVal width As UInt32, ByVal height As UInt32, ByVal color_space As HPdfColorSpace) As IntPtr
334 Private Declare Function HPDF_LoadRawImageFromMem Lib "libhpdf.dll" Alias "HPDF_LoadRawImageFromMem" (ByVal pdf As IntPtr, ByVal data As Byte(), ByVal width As UInt32, ByVal height As UInt32, ByVal color_space As HPdfColorSpace, ByVal bits_per_component As UInt32) As IntPtr
335 Private Declare Function HPDF_SetInfoAttr Lib "libhpdf.dll" Alias "HPDF_SetInfoAttr" (ByVal pdf As IntPtr, ByVal type As HPdfInfoType, ByVal value As String) As UInt32
336 Private Declare Function HPDF_SetInfoDateAttr Lib "libhpdf.dll" Alias "HPDF_SetInfoDateAttr" (ByVal pdf As IntPtr, ByVal type As HPdfInfoType, ByVal value As HPdfDate) As UInt32
337 Private Declare Function HPDF_GetInfoAttr Lib "libhpdf.dll" Alias "HPDF_GetInfoAttr" (ByVal pdf As IntPtr, ByVal type As HPdfInfoType) As String
338 Private Declare Function HPDF_SetPassword Lib "libhpdf.dll" Alias "HPDF_SetPassword" (ByVal pdf As IntPtr, ByVal owner_passwd As String, ByVal user_passwd As String) As UInt32
339 Private Declare Function HPDF_SetPermission Lib "libhpdf.dll" Alias "HPDF_SetPermission" (ByVal pdf As IntPtr, ByVal permission As UInt32) As UInt32
340 Private Declare Function HPDF_SetEncryptionMode Lib "libhpdf.dll" Alias "HPDF_SetEncryptionMode" (ByVal pdf As IntPtr, ByVal mode As HPdfEncryptMode, ByVal key_len As UInt32) As UInt32
341 Private Declare Function HPDF_SetCompressionMode Lib "libhpdf.dll" Alias "HPDF_SetCompressionMode" (ByVal pdf As IntPtr, ByVal mode As UInt32) As UInt32
342 Private Declare Function HPDF_CreateExtGState Lib "libhpdf.dll" Alias "HPDF_CreateExtGState" (ByVal pdf As IntPtr) As IntPtr
344 Private hpdf As IntPtr
347 Dim error_handler As HPDF_ErrorHandler = New HPDF_ErrorHandler(AddressOf ErrorProc)
348 hpdf = HPDF_New(error_handler, IntPtr.Zero)
349 If (hpdf = IntPtr.Zero) Then
350 Throw New Exception("cannot create HPdfDoc object.")
354 Public Sub Dispose() Implements IDisposable.Dispose
355 If (hpdf <> IntPtr.Zero) Then
362 Public Shared Function HPdfGetVersion() As String
363 Return HPDF_GetVersion()
366 Public Shared Sub ErrorProc(ByVal error_no As UInt32, ByVal detail_no As UInt32, ByVal user_data As IntPtr)
367 Dim s As String = "error-code=0x" & error_no.ToString("X") & " detail-code=" & detail_no
368 Throw New Exception(s)
379 Public Sub FreeDocAll()
380 HPDF_FreeDocAll(hpdf)
383 Public Function HasDoc() As Boolean
384 Return (HPDF_HasDoc(hpdf) <> 0)
387 Public Sub SaveToFile(ByVal file_name As String)
388 HPDF_SaveToFile(hpdf, file_name)
391 Public Function GetError() As UInt32
392 Return HPDF_GetError(hpdf)
395 Public Function GetErrorDetail() As UInt32
396 Return HPDF_GetErrorDetail(hpdf)
399 Public Sub ResetError()
400 HPDF_ResetError(hpdf)
403 Public Sub SetPagesConfiguration(ByVal page_per_pages As UInt32)
404 HPDF_SetPagesConfiguration(hpdf, page_per_pages)
407 Public Function GetPageByIndex(ByVal index As UInt32) As HPdfPage
408 Dim hpage As IntPtr = HPDF_GetPageByIndex(hpdf, index)
409 Return New HPdfPage(hpage)
412 Public Function GetPageLayout() As HPdfPageLayout
413 Return HPDF_GetPageLayout(hpdf)
416 Public Sub SetPageLayout(ByRef layout As HPdfPageLayout)
417 HPDF_SetPageLayout(hpdf, layout)
420 Public Function GetPageMode() As HPdfPageMode
421 Return HPDF_GetPageMode(hpdf)
424 Public Sub SetPageMode(ByRef mode As HPdfPageMode)
425 HPDF_SetPageMode(hpdf, mode)
428 Public Sub SetOpenAction(ByRef open_action As HPdfDestination)
429 HPDF_SetOpenAction(hpdf, open_action.GetHandle())
432 Public Function GetViewerPreference() As UInt32
433 Return HPDF_GetViewerPreference(hpdf)
436 Public Sub SetViewerPreference(ByVal value As UInt32)
437 HPDF_SetViewerPreference(hpdf, value)
440 Public Function GetCurrentPage() As HPdfPage
441 Dim hpage As IntPtr = HPDF_GetCurrentPage(hpdf)
442 Return New HPdfPage(hpage)
445 Public Function AddPage() As HPdfPage
446 Dim hpage As IntPtr = HPDF_AddPage(hpdf)
447 Return New HPdfPage(hpage)
450 Public Function InsertPage(ByRef page As HPdfPage) As HPdfPage
451 Dim hpage As IntPtr = HPDF_InsertPage(hpdf, page.GetHandle())
452 Return New HPdfPage(hpage)
455 Public Function GetFont(ByVal font_name As String, ByVal encoding_name As String) As HPdfFont
456 Dim hfont As IntPtr = HPDF_GetFont(hpdf, font_name, encoding_name)
457 Return New HPdfFont(hfont)
460 Public Function LoadType1FontFromFile(ByVal afmfilename As String, ByVal pfmfilename As String) As String
461 Dim font_name As String = HPDF_LoadType1FontFromFile(hpdf, afmfilename, pfmfilename)
465 Public Function LoadTTFontFromFile(ByVal file_name As String, ByVal embedding As Boolean) As String
466 Dim font_name As String
475 font_name = HPDF_LoadTTFontFromFile(hpdf, file_name, emb)
479 Public Function LoadTTFontFromFile2(ByVal file_name As String, ByVal index As UInt32, ByVal embedding As Boolean) As String
480 Dim font_name As String
489 font_name = HPDF_LoadTTFontFromFile2(hpdf, file_name, index, emb)
493 Public Sub AddPageLabel(ByVal page_num As UInt32, ByVal style As HPdfPageNumStyle, ByVal first_page As UInt32, ByVal prefix As String)
494 HPDF_AddPageLabel(hpdf, page_num, style, first_page, prefix)
497 Public Function UseJPFonts() As UInt32
498 Return HPDF_UseJPFonts(hpdf)
501 Public Function UseKRFonts() As UInt32
502 Return HPDF_UseKRFonts(hpdf)
505 Public Function UseCNSFonts() As UInt32
506 Return HPDF_UseCNSFonts(hpdf)
509 Public Function UseCNTFonts() As UInt32
510 Return HPDF_UseCNTFonts(hpdf)
513 Public Function CreateOutline(ByRef parent As HPdfOutline, ByVal title As String, ByRef encoder As HPdfEncoder) As HPdfOutline
514 Dim hparent As IntPtr
515 Dim hencoder As IntPtr
516 Dim houtline As IntPtr
518 If (encoder Is Nothing) Then
521 hencoder = encoder.GetHandle()
524 If (parent Is Nothing) Then
527 hparent = parent.GetHandle()
530 houtline = HPDF_CreateOutline(hpdf, hparent, title, hencoder)
531 Return New HPdfOutline(houtline)
533 Public Function GetEncoder(ByVal encoding_name As String) As HPdfEncoder
534 Dim hencoder As IntPtr = HPDF_GetEncoder(hpdf, encoding_name)
536 Return New HPdfEncoder(hencoder)
539 Public Function GetCurrentEncoder() As HPdfEncoder
540 Dim hencoder As IntPtr = HPDF_GetCurrentEncoder(hpdf)
542 Return New HPdfEncoder(hencoder)
545 Public Sub SetCurrentEncoder(ByVal encoding_name As String)
546 HPDF_SetCurrentEncoder(hpdf, encoding_name)
549 Public Function UseJPEncodings() As UInt32
550 Return HPDF_UseJPEncodings(hpdf)
553 Public Function UseKREncodings() As UInt32
554 Return HPDF_UseKREncodings(hpdf)
557 Public Function UseCNSEncodings() As UInt32
558 Return HPDF_UseCNSEncodings(hpdf)
561 Public Function UseCNTEncodings() As UInt32
562 Return HPDF_UseCNTEncodings(hpdf)
565 Public Function LoadPngImageFromFile(ByVal filename As String) As HPdfImage
566 Dim hobj As IntPtr = HPDF_LoadPngImageFromFile(hpdf, filename)
568 Return New HPdfImage(hobj)
571 Public Function LoadPngImageFromFile2(ByVal filename As String) As HPdfImage
572 Dim hobj As IntPtr = HPDF_LoadPngImageFromFile2(hpdf, filename)
574 Return New HPdfImage(hobj)
577 Public Function LoadJpegImageFromFile(ByVal filename As String) As HPdfImage
578 Dim hobj As IntPtr = HPDF_LoadJpegImageFromFile(hpdf, filename)
580 Return New HPdfImage(hobj)
583 Public Function LoadRawImageFromFile(ByVal filename As String, ByVal width As UInt32, ByVal height As UInt32, ByRef color_space As HPdfColorSpace) As HPdfImage
584 Dim hobj As IntPtr = HPDF_LoadRawImageFromFile(hpdf, filename, width, height, color_space)
586 Return New HPdfImage(hobj)
589 Public Function LoadRawImageFromMem(ByVal data As Byte(), ByVal width As Int32, ByVal height As Int32, ByRef color_space As HPdfColorSpace, ByVal bits_per_component As UInt32) As HPdfImage
590 If (width * height < data.Length) Then
591 Dim s As String = "error-code=0x1030 detail-code=0"
592 Throw New Exception(s)
595 Dim hobj As IntPtr = HPDF_LoadRawImageFromMem(hpdf, data, width, height, color_space, bits_per_component)
597 Return New HPdfImage(hobj)
600 Public Sub SetInfoAttr(ByVal type As HPdfInfoType, ByVal value As String)
601 HPDF_SetInfoAttr(hpdf, type, value)
604 Public Sub SetInfoDateAttr(ByVal type As HPdfInfoType, ByRef value As HPdfDate)
605 HPDF_SetInfoDateAttr(hpdf, type, value)
608 Public Function GetInfoAttr(ByVal type As HPdfInfoType) As String
609 Return HPDF_GetInfoAttr(hpdf, type)
612 Public Sub SetPassword(ByVal owner_passwd As String, ByVal user_passwd As String)
613 HPDF_SetPassword(hpdf, owner_passwd, user_passwd)
616 Public Sub SetPermission(ByVal permission As UInt32)
617 HPDF_SetPermission(hpdf, permission)
620 Public Sub SetEncryptionMode(ByVal mode As HPdfEncryptMode, ByVal key_len As UInt32)
621 HPDF_SetEncryptionMode(hpdf, mode, key_len)
624 Public Sub SetCompressionMode(ByVal mode As UInt32)
625 HPDF_SetCompressionMode(hpdf, mode)
628 Public Function CreateExtGState() As HPdfExtGState
629 Dim hgstate As IntPtr = HPDF_CreateExtGState(hpdf)
631 Return New HPdfExtGState(hgstate)
634 Public Class HPdfPage
635 Public Const HPDF_TRUE As Integer = 1
636 Public Const HPDF_FALSE As Integer = 0
638 Private Declare Function HPDF_Page_SetWidth Lib "libhpdf.dll" Alias "HPDF_Page_SetWidth" (ByVal page As IntPtr, ByVal value As Single) As UInt32
639 Private Declare Function HPDF_Page_SetHeight Lib "libhpdf.dll" Alias "HPDF_Page_SetHeight" (ByVal page As IntPtr, ByVal value As Single) As UInt32
640 Private Declare Function HPDF_Page_SetSize Lib "libhpdf.dll" Alias "HPDF_Page_SetSize" (ByVal page As IntPtr, ByVal size As HPdfPageSizes, ByVal direction As HPdfPageDirection) As UInt32
641 Private Declare Function HPDF_Page_SetRotate Lib "libhpdf.dll" Alias "HPDF_Page_SetRotate" (ByVal page As IntPtr, ByVal angle As UInt16) As UInt16
642 Private Declare Function HPDF_Page_CreateDestination Lib "libhpdf.dll" Alias "HPDF_Page_CreateDestination" (ByVal page As IntPtr) As IntPtr
643 Private Declare Function HPDF_Page_CreateTextAnnot Lib "libhpdf.dll" Alias "HPDF_Page_CreateTextAnnot" (ByVal page As IntPtr, ByVal rect As HPdfRect, ByVal text As String, ByVal encoder As IntPtr) As IntPtr
644 Private Declare Function HPDF_Page_CreateLinkAnnot Lib "libhpdf.dll" Alias "HPDF_Page_CreateLinkAnnot" (ByVal page As IntPtr, ByVal rect As HPdfRect, ByVal dst As IntPtr) As IntPtr
645 Private Declare Function HPDF_Page_CreateURILinkAnnot Lib "libhpdf.dll" Alias "HPDF_Page_CreateURILinkAnnot" (ByVal page As IntPtr, ByVal rect As HPdfRect, ByVal url As String) As IntPtr
646 Private Declare Function HPDF_Page_TextWidth Lib "libhpdf.dll" Alias "HPDF_Page_TextWidth" (ByVal page As IntPtr, ByVal text As String) As Single
647 Private Declare Function HPDF_Page_MeasureText Lib "libhpdf.dll" Alias "HPDF_Page_MeasureText" (ByVal page As IntPtr, ByVal text As String, ByVal width As Single, ByVal wordwrap As Int32, ByRef real_width As Single) As UInt32
648 Private Declare Function HPDF_Page_GetWidth Lib "libhpdf.dll" Alias "HPDF_Page_GetWidth" (ByVal page As IntPtr) As Single
649 Private Declare Function HPDF_Page_GetHeight Lib "libhpdf.dll" Alias "HPDF_Page_GetHeight" (ByVal page As IntPtr) As Single
650 Private Declare Function HPDF_Page_GetGMode Lib "libhpdf.dll" Alias "HPDF_Page_GetGMode" (ByVal page As IntPtr) As UInt16
651 Private Declare Function HPDF_Page_GetCurrentPos Lib "libhpdf.dll" Alias "HPDF_Page_GetCurrentPos" (ByVal page As IntPtr) As HPdfPoint
652 Private Declare Function HPDF_Page_GetCurrentTextPos Lib "libhpdf.dll" Alias "HPDF_Page_GetCurrentTextPos" (ByVal page As IntPtr) As HPdfPoint
653 Private Declare Function HPDF_Page_GetCurrentFont Lib "libhpdf.dll" Alias "HPDF_Page_GetCurrentFont" (ByVal page As IntPtr) As IntPtr
654 Private Declare Function HPDF_Page_GetCurrentFontSize Lib "libhpdf.dll" Alias "HPDF_Page_GetCurrentFontSize" (ByVal page As IntPtr) As Single
655 Private Declare Function HPDF_Page_GetTransMatrix Lib "libhpdf.dll" Alias "HPDF_Page_GetTransMatrix" (ByVal page As IntPtr) As HPdfTransMatrix
656 Private Declare Function HPDF_Page_GetLineWidth Lib "libhpdf.dll" Alias "HPDF_Page_GetLineWidth" (ByVal page As IntPtr) As Single
657 Private Declare Function HPDF_Page_GetLineCap Lib "libhpdf.dll" Alias "HPDF_Page_GetLineCap" (ByVal page As IntPtr) As HPdfLineCap
658 Private Declare Function HPDF_Page_GetLineJoin Lib "libhpdf.dll" Alias "HPDF_Page_GetLineJoin" (ByVal page As IntPtr) As HPdfLineJoin
659 Private Declare Function HPDF_Page_GetMiterLimit Lib "libhpdf.dll" Alias "HPDF_Page_GetMiterLimit" (ByVal page As IntPtr) As Single
660 Private Declare Function HPDF_Page_GetDash Lib "libhpdf.dll" Alias "HPDF_Page_GetDash" (ByVal page As IntPtr) As HPdfDashMode_Internal
661 Private Declare Function HPDF_Page_GetFlat Lib "libhpdf.dll" Alias "HPDF_Page_GetFlat" (ByVal page As IntPtr) As Single
662 Private Declare Function HPDF_Page_GetCharSpace Lib "libhpdf.dll" Alias "HPDF_Page_GetCharSpace" (ByVal page As IntPtr) As Single
663 Private Declare Function HPDF_Page_GetWordSpace Lib "libhpdf.dll" Alias "HPDF_Page_GetWordSpace" (ByVal page As IntPtr) As Single
664 Private Declare Function HPDF_Page_GetHorizontalScalling Lib "libhpdf.dll" Alias "HPDF_Page_GetHorizontalScalling" (ByVal page As IntPtr) As Single
665 Private Declare Function HPDF_Page_GetTextLeading Lib "libhpdf.dll" Alias "HPDF_Page_GetTextLeading" (ByVal page As IntPtr) As Single
666 Private Declare Function HPDF_Page_GetTextRenderingMode Lib "libhpdf.dll" Alias "HPDF_Page_GetTextRenderingMode" (ByVal page As IntPtr) As HPdfTextRenderingMode
667 Private Declare Function HPDF_Page_GetTextRaise Lib "libhpdf.dll" Alias "HPDF_Page_GetTextRaise" (ByVal page As IntPtr) As Single
668 Private Declare Function HPDF_Page_GetRGBFill Lib "libhpdf.dll" Alias "HPDF_Page_GetRGBFill" (ByVal page As IntPtr) As HPdfRGBColor
669 Private Declare Function HPDF_Page_GetRGBStroke Lib "libhpdf.dll" Alias "HPDF_Page_GetRGBStroke" (ByVal page As IntPtr) As HPdfRGBColor
670 Private Declare Function HPDF_Page_GetCMYKFill Lib "libhpdf.dll" Alias "HPDF_Page_GetCMYKFill" (ByVal page As IntPtr) As HPdfCMYKColor
671 Private Declare Function HPDF_Page_GetCMYKStroke Lib "libhpdf.dll" Alias "HPDF_Page_GetCMYKStroke" (ByVal page As IntPtr) As HPdfCMYKColor
672 Private Declare Function HPDF_Page_GetGrayFill Lib "libhpdf.dll" Alias "HPDF_Page_GetGrayFill" (ByVal page As IntPtr) As Single
673 Private Declare Function HPDF_Page_GetGrayStroke Lib "libhpdf.dll" Alias "HPDF_Page_GetGrayStroke" (ByVal page As IntPtr) As Single
674 Private Declare Function HPDF_Page_GetStrokingColorSpace Lib "libhpdf.dll" Alias "HPDF_Page_GetStrokingColorSpace" (ByVal page As IntPtr) As HPdfColorSpace
675 Private Declare Function HPDF_Page_GetFillingColorSpace Lib "libhpdf.dll" Alias "HPDF_Page_GetFillingColorSpace" (ByVal page As IntPtr) As HPdfColorSpace
676 Private Declare Function HPDF_Page_GetTextMatrix Lib "libhpdf.dll" Alias "HPDF_Page_GetTextMatrix" (ByVal page As IntPtr) As HPdfTransMatrix
677 Private Declare Function HPDF_Page_GetGStateDepth Lib "libhpdf.dll" Alias "HPDF_Page_GetGStateDepth" (ByVal page As IntPtr) As UInt32
679 ' --- General graphics state -----------------------------------------------
680 Private Declare Function HPDF_Page_SetLineWidth Lib "libhpdf.dll" Alias "HPDF_Page_SetLineWidth" (ByVal page As IntPtr, ByVal line_width As Single) As UInt32
681 Private Declare Function HPDF_Page_SetLineCap Lib "libhpdf.dll" Alias "HPDF_Page_SetLineCap" (ByVal page As IntPtr, ByVal line_cap As HPdfLineCap) As UInt32
682 Private Declare Function HPDF_Page_SetLineJoin Lib "libhpdf.dll" Alias "HPDF_Page_SetLineJoin" (ByVal page As IntPtr, ByVal line_join As HPdfLineJoin) As UInt32
683 Private Declare Function HPDF_Page_SetMiterLimit Lib "libhpdf.dll" Alias "HPDF_Page_SetMiterLimit" (ByVal page As IntPtr, ByVal miter_limit As Single) As UInt32
684 Private Declare Function HPDF_Page_SetDash Lib "libhpdf.dll" Alias "HPDF_Page_SetDash" (ByVal page As IntPtr, ByVal array As UInt16(), ByVal num_param As UInt32, ByVal phase As UInt32) As UInt32
685 Private Declare Function HPDF_Page_SetFlat Lib "libhpdf.dll" Alias "HPDF_Page_SetFlat" (ByVal page As IntPtr, ByVal flatness As Single) As UInt32
686 Private Declare Function HPDF_Page_SetExtGState Lib "libhpdf.dll" Alias "HPDF_Page_SetExtGState" (ByVal page As IntPtr, ByVal ext_gstate As IntPtr) As UInt32
687 Private Declare Function HPDF_Page_GSave Lib "libhpdf.dll" Alias "HPDF_Page_GSave" (ByVal page As IntPtr) As UInt32
688 Private Declare Function HPDF_Page_GRestore Lib "libhpdf.dll" Alias "HPDF_Page_GRestore" (ByVal page As IntPtr) As UInt32
689 Private Declare Function HPDF_Page_Concat Lib "libhpdf.dll" Alias "HPDF_Page_Concat" (ByVal page As IntPtr, ByVal a As Single, ByVal b As Single, ByVal c As Single, ByVal d As Single, ByVal x As Single, ByVal y As Single) As UInt32
690 Private Declare Function HPDF_Page_MoveTo Lib "libhpdf.dll" Alias "HPDF_Page_MoveTo" (ByVal page As IntPtr, ByVal x As Single, ByVal y As Single) As UInt32
691 Private Declare Function HPDF_Page_LineTo Lib "libhpdf.dll" Alias "HPDF_Page_LineTo" (ByVal page As IntPtr, ByVal x As Single, ByVal y As Single) As UInt32
692 Private Declare Function HPDF_Page_CurveTo Lib "libhpdf.dll" Alias "HPDF_Page_CurveTo" (ByVal page As IntPtr, ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single, ByVal x3 As Single, ByVal y3 As Single) As UInt32
693 Private Declare Function HPDF_Page_CurveTo2 Lib "libhpdf.dll" Alias "HPDF_Page_CurveTo2" (ByVal page As IntPtr, ByVal x2 As Single, ByVal y2 As Single, ByVal x3 As Single, ByVal y3 As Single) As UInt32
694 Private Declare Function HPDF_Page_CurveTo3 Lib "libhpdf.dll" Alias "HPDF_Page_CurveTo3" (ByVal page As IntPtr, ByVal x1 As Single, ByVal y1 As Single, ByVal x3 As Single, ByVal y3 As Single) As UInt32
695 Private Declare Function HPDF_Page_ClosePath Lib "libhpdf.dll" Alias "HPDF_Page_ClosePath" (ByVal page As IntPtr) As UInt32
696 Private Declare Function HPDF_Page_Rectangle Lib "libhpdf.dll" Alias "HPDF_Page_Rectangle" (ByVal page As IntPtr, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single) As UInt32
697 Private Declare Function HPDF_Page_Stroke Lib "libhpdf.dll" Alias "HPDF_Page_Stroke" (ByVal page As IntPtr) As UInt32
698 Private Declare Function HPDF_Page_ClosePathStroke Lib "libhpdf.dll" Alias "HPDF_Page_ClosePathStroke" (ByVal page As IntPtr) As UInt32
699 Private Declare Function HPDF_Page_Fill Lib "libhpdf.dll" Alias "HPDF_Page_Fill" (ByVal page As IntPtr) As UInt32
700 Private Declare Function HPDF_Page_Eofill Lib "libhpdf.dll" Alias "HPDF_Page_Eofill" (ByVal page As IntPtr) As UInt32
701 Private Declare Function HPDF_Page_FillStroke Lib "libhpdf.dll" Alias "HPDF_Page_FillStroke" (ByVal page As IntPtr) As UInt32
702 Private Declare Function HPDF_Page_EofillStroke Lib "libhpdf.dll" Alias "HPDF_Page_EofillStroke" (ByVal page As IntPtr) As UInt32
703 Private Declare Function HPDF_Page_ClosePathFillStroke Lib "libhpdf.dll" Alias "HPDF_Page_ClosePathFillStroke" (ByVal page As IntPtr) As UInt32
704 Private Declare Function HPDF_Page_ClosePathEofillStroke Lib "libhpdf.dll" Alias "HPDF_Page_ClosePathEofillStroke" (ByVal page As IntPtr) As UInt32
705 Private Declare Function HPDF_Page_EndPath Lib "libhpdf.dll" Alias "HPDF_Page_EndPath" (ByVal page As IntPtr) As UInt32
707 ' --- Clipping paths operator --------------------------------------------
708 Private Declare Function HPDF_Page_Clip Lib "libhpdf.dll" Alias "HPDF_Page_Clip" (ByVal page As IntPtr) As UInt32
709 Private Declare Function HPDF_Page_Eoclip Lib "libhpdf.dll" Alias "HPDF_Page_Eoclip" (ByVal page As IntPtr) As UInt32
711 ' --- Text object operator -----------------------------------------------
712 Private Declare Function HPDF_Page_BeginText Lib "libhpdf.dll" Alias "HPDF_Page_BeginText" (ByVal page As IntPtr) As UInt32
713 Private Declare Function HPDF_Page_EndText Lib "libhpdf.dll" Alias "HPDF_Page_EndText" (ByVal page As IntPtr) As UInt32
715 ' --- Text state ---------------------------------------------------------
716 Private Declare Function HPDF_Page_SetCharSpace Lib "libhpdf.dll" Alias "HPDF_Page_SetCharSpace" (ByVal page As IntPtr, ByVal value As Single) As UInt32
717 Private Declare Function HPDF_Page_SetWordSpace Lib "libhpdf.dll" Alias "HPDF_Page_SetWordSpace" (ByVal page As IntPtr, ByVal value As Single) As UInt32
718 Private Declare Function HPDF_Page_SetHorizontalScalling Lib "libhpdf.dll" Alias "HPDF_Page_SetHorizontalScalling" (ByVal page As IntPtr, ByVal value As Single) As UInt32
719 Private Declare Function HPDF_Page_SetTextLeading Lib "libhpdf.dll" Alias "HPDF_Page_SetTextLeading" (ByVal page As IntPtr, ByVal value As Single) As UInt32
720 Private Declare Function HPDF_Page_SetFontAndSize Lib "libhpdf.dll" Alias "HPDF_Page_SetFontAndSize" (ByVal page As IntPtr, ByVal hfont As IntPtr, ByVal size As Single) As UInt32
721 Private Declare Function HPDF_Page_SetTextRenderingMode Lib "libhpdf.dll" Alias "HPDF_Page_SetTextRenderingMode" (ByVal page As IntPtr, ByVal mode As HPdfTextRenderingMode) As UInt32
722 Private Declare Function HPDF_Page_SetTextRaise Lib "libhpdf.dll" Alias "HPDF_Page_SetTextRaise" (ByVal page As IntPtr, ByVal value As Single) As UInt32
724 ' --- Text positioning ---------------------------------------------------
725 Private Declare Function HPDF_Page_MoveTextPos Lib "libhpdf.dll" Alias "HPDF_Page_MoveTextPos" (ByVal page As IntPtr, ByVal x As Single, ByVal y As Single) As UInt32
726 Private Declare Function HPDF_Page_MoveTextPos2 Lib "libhpdf.dll" Alias "HPDF_Page_MoveTextPos2" (ByVal page As IntPtr, ByVal x As Single, ByVal y As Single) As UInt32
727 Private Declare Function HPDF_Page_SetTextMatrix Lib "libhpdf.dll" Alias "HPDF_Page_SetTextMatrix" (ByVal page As IntPtr, ByVal a As Single, ByVal b As Single, ByVal c As Single, ByVal d As Single, ByVal x As Single, ByVal y As Single) As UInt32
728 Private Declare Function HPDF_Page_MoveToNextLine Lib "libhpdf.dll" Alias "HPDF_Page_MoveToNextLine" (ByVal page As IntPtr) As UInt32
730 ' --- Text showing -------------------------------------------------------
731 Private Declare Function HPDF_Page_ShowText Lib "libhpdf.dll" Alias "HPDF_Page_ShowText" (ByVal page As IntPtr, ByVal text As String) As UInt32
732 Private Declare Function HPDF_Page_ShowTextNextLine Lib "libhpdf.dll" Alias "HPDF_Page_ShowTextNextLine" (ByVal page As IntPtr, ByVal text As String) As UInt32
733 Private Declare Function HPDF_Page_ShowTextNextLineEx Lib "libhpdf.dll" Alias "HPDF_Page_ShowTextNextLineEx" (ByVal page As IntPtr, ByVal word_space As Single, ByVal char_space As Single, ByVal text As String) As UInt32
735 ' --- Color showing ------------------------------------------------------
736 Private Declare Function HPDF_Page_SetGrayFill Lib "libhpdf.dll" Alias "HPDF_Page_SetGrayFill" (ByVal page As IntPtr, ByVal gray As Single) As UInt32
737 Private Declare Function HPDF_Page_SetGrayStroke Lib "libhpdf.dll" Alias "HPDF_Page_SetGrayStroke" (ByVal page As IntPtr, ByVal gray As Single) As UInt32
738 Private Declare Function HPDF_Page_SetRGBFill Lib "libhpdf.dll" Alias "HPDF_Page_SetRGBFill" (ByVal page As IntPtr, ByVal r As Single, ByVal g As Single, ByVal b As Single) As UInt32
739 Private Declare Function HPDF_Page_SetRGBStroke Lib "libhpdf.dll" Alias "HPDF_Page_SetRGBStroke" (ByVal page As IntPtr, ByVal r As Single, ByVal g As Single, ByVal b As Single) As UInt32
740 Private Declare Function HPDF_Page_SetCMYKFill Lib "libhpdf.dll" Alias "HPDF_Page_SetCMYKFill" (ByVal page As IntPtr, ByVal c As Single, ByVal m As Single, ByVal y As Single, ByVal k As Single) As UInt32
741 Private Declare Function HPDF_Page_SetCMYKStroke Lib "libhpdf.dll" Alias "HPDF_Page_SetCMYKStroke" (ByVal page As IntPtr, ByVal c As Single, ByVal m As Single, ByVal y As Single, ByVal k As Single) As UInt32
742 Private Declare Function HPDF_Page_ExecuteXObject Lib "libhpdf.dll" Alias "HPDF_Page_ExecuteXObject" (ByVal page As IntPtr, ByVal obj As IntPtr) As UInt32
744 ' ---------------------------------------------------------------------
745 Private Declare Function HPDF_Page_DrawImage Lib "libhpdf.dll" Alias "HPDF_Page_DrawImage" (ByVal page As IntPtr, ByVal image As IntPtr, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single) As UInt32
746 Private Declare Function HPDF_Page_Circle Lib "libhpdf.dll" Alias "HPDF_Page_Circle" (ByVal page As IntPtr, ByVal x As Single, ByVal y As Single, ByVal ray As Single) As UInt32
747 Private Declare Function HPDF_Page_Arc Lib "libhpdf.dll" Alias "HPDF_Page_Arc" (ByVal page As IntPtr, ByVal x As Single, ByVal y As Single, ByVal ray As Single, ByVal ang1 As Single, ByVal ang2 As Single) As UInt32
748 Private Declare Function HPDF_Page_Ellipse Lib "libhpdf.dll" Alias "HPDF_Page_Ellipse" (ByVal page As IntPtr, ByVal x As Single, ByVal y As Single, ByVal xray As Single, ByVal yray As Single) As UInt32
749 Private Declare Function HPDF_Page_TextOut Lib "libhpdf.dll" Alias "HPDF_Page_TextOut" (ByVal page As IntPtr, ByVal xpos As Single, ByVal ypos As Single, ByVal text As String) As UInt32
750 Private Declare Function HPDF_Page_TextRect Lib "libhpdf.dll" Alias "HPDF_Page_TextRect" (ByVal page As IntPtr, ByVal left As Single, ByVal top As Single, ByVal right As Single, ByVal bottom As Single, ByVal text As String, ByVal align As HPdfTextAlignment, ByRef len As UInt32) As UInt32
751 Private Declare Function HPDF_Page_SetSlideShow Lib "libhpdf.dll" Alias "HPDF_Page_SetSlideShow" (ByVal page As IntPtr, ByVal type As HPdfTransitionStyle, ByVal disp_time As Single, ByVal trans_time As Single) As UInt32
753 ' handle to an instance of a HPDF_Doc object.
754 Private hpage As IntPtr
756 Public Sub New(ByVal hpage As IntPtr)
757 If (hpage = IntPtr.Zero) Then
758 Throw New Exception("cannot create HPdfPage object.")
764 Public Sub SetWidth(ByVal value As Single)
765 HPDF_Page_SetWidth(hpage, value)
768 Public Sub SetHeight(ByVal value As Single)
769 HPDF_Page_SetHeight(hpage, value)
772 Public Sub SetSize(ByVal size As HPdfPageSizes, ByVal direction As HPdfPageDirection)
773 HPDF_Page_SetSize(hpage, size, direction)
776 Public Sub SetRotate(ByVal angle As UInt16)
777 HPDF_Page_SetRotate(hpage, angle)
780 Public Function CreateDestination() As HPdfDestination
781 Dim hdest As IntPtr = HPDF_Page_CreateDestination(hpage)
782 Return New HPdfDestination(hdest)
785 Public Function CreateTextAnnot(ByVal rect As HPdfRect, ByVal text As String, ByRef encoder As HPdfEncoder) As HPdfAnnotation
786 Dim hannot As IntPtr = HPDF_Page_CreateTextAnnot(hpage, rect, text, encoder.GetHandle())
787 Return New HPdfAnnotation(hannot)
790 Public Function CreateLinkAnnot(ByVal rect As HPdfRect, ByRef dst As HPdfDestination) As HPdfAnnotation
791 Dim hannot As IntPtr = HPDF_Page_CreateLinkAnnot(hpage, rect, dst.GetHandle())
792 Return New HPdfAnnotation(hannot)
795 Public Function CreateURILinkAnnot(ByVal rect As HPdfRect, ByVal uri As String) As HPdfAnnotation
796 Dim hannot As IntPtr = HPDF_Page_CreateURILinkAnnot(hpage, rect, uri)
797 Return New HPdfAnnotation(hannot)
800 Public Function TextWidth(ByVal text As String) As Single
801 Return HPDF_Page_TextWidth(hpage, text)
804 Public Function MeasureText(ByVal text As String, ByVal width As Single, ByVal wordwrap As Boolean, ByRef real_width As Single) As UInt32
813 Return HPDF_Page_MeasureText(hpage, text, width, ww, real_width)
816 Public Function MeasureText(ByVal text As String, ByVal width As Single, ByVal wordwrap As Boolean) As UInt32
826 Return HPDF_Page_MeasureText(hpage, text, width, ww, dummy)
829 Public Function GetWidth() As Single
830 Return HPDF_Page_GetWidth(hpage)
833 Public Function GetHeight() As Single
834 Return HPDF_Page_GetHeight(hpage)
837 Public Function GetGMode() As UInt16
838 Return HPDF_Page_GetGMode(hpage)
841 Public Function GetCurrentPos() As HPdfPoint
842 Return HPDF_Page_GetCurrentPos(hpage)
845 Public Function GetCurrentTextPos() As HPdfPoint
846 Return HPDF_Page_GetCurrentTextPos(hpage)
849 Public Function GetCurrentFont() As HPdfFont
850 Return New HPdfFont(HPDF_Page_GetCurrentFont(hpage))
853 Public Function GetCurrentFontSize() As Single
854 Return HPDF_Page_GetCurrentFontSize(hpage)
857 Public Function GetTransMatrix() As HPdfTransMatrix
858 Return HPDF_Page_GetTransMatrix(hpage)
861 Public Function GetLineWidth() As Single
862 Return HPDF_Page_GetLineWidth(hpage)
865 Public Function GetLineCap() As HPdfLineCap
866 Return HPDF_Page_GetLineCap(hpage)
869 Public Function GetLineJoin() As HPdfLineJoin
870 Return HPDF_Page_GetLineJoin(hpage)
873 Public Function GetMiterLimit() As Single
874 Return HPDF_Page_GetMiterLimit(hpage)
877 Public Function GetDash() As HPdfDashMode
878 Dim mode1 As HPdfDashMode_Internal = HPDF_Page_GetDash(hpage)
879 Dim mode2 As HPdfDashMode
881 mode2.phase = mode1.phase
882 ReDim mode2.ptn(mode1.num_ptn)
884 If (mode1.num_ptn >= 1) Then
885 mode2.ptn(0) = mode1.ptn0
888 If (mode1.num_ptn >= 2) Then
889 mode2.ptn(1) = mode1.ptn1
892 If (mode1.num_ptn >= 3) Then
893 mode2.ptn(2) = mode1.ptn2
896 If (mode1.num_ptn >= 4) Then
897 mode2.ptn(3) = mode1.ptn3
900 If (mode1.num_ptn >= 5) Then
901 mode2.ptn(4) = mode1.ptn4
904 If (mode1.num_ptn >= 6) Then
905 mode2.ptn(5) = mode1.ptn5
908 If (mode1.num_ptn >= 7) Then
909 mode2.ptn(6) = mode1.ptn6
912 If (mode1.num_ptn >= 8) Then
913 mode2.ptn(7) = mode1.ptn7
919 Public Function GetFlat() As Single
920 Return HPDF_Page_GetFlat(hpage)
923 Public Function GetCharSpace() As Single
924 Return HPDF_Page_GetCharSpace(hpage)
927 Public Function GetWordSpace() As Single
928 Return HPDF_Page_GetWordSpace(hpage)
931 Public Function GetHorizontalScalling() As Single
932 Return HPDF_Page_GetHorizontalScalling(hpage)
935 Public Function GetTextLeading() As Single
936 Return HPDF_Page_GetTextLeading(hpage)
939 Public Function GetTextRenderingMode() As HPdfTextRenderingMode
940 Return HPDF_Page_GetTextRenderingMode(hpage)
943 Public Function GetTextRaise() As Single
944 Return HPDF_Page_GetTextRaise(hpage)
947 Public Function GetRGBFill() As HPdfRGBColor
948 Return HPDF_Page_GetRGBFill(hpage)
951 Public Function GetRGBStroke() As HPdfRGBColor
952 Return HPDF_Page_GetRGBStroke(hpage)
955 Public Function GetCMYKFill() As HPdfCMYKColor
956 Return HPDF_Page_GetCMYKFill(hpage)
959 Public Function GetCMYKStroke() As HPdfCMYKColor
960 Return HPDF_Page_GetCMYKStroke(hpage)
963 Public Function GetGrayFill() As Single
964 Return HPDF_Page_GetGrayFill(hpage)
967 Public Function GetGrayStroke() As Single
968 Return HPDF_Page_GetGrayStroke(hpage)
971 Public Function GetStrokingColorSpace() As HPdfColorSpace
972 Return HPDF_Page_GetStrokingColorSpace(hpage)
975 Public Function GetFillingColorSpace() As HPdfColorSpace
976 Return HPDF_Page_GetFillingColorSpace(hpage)
979 Public Function GetTextMatrix() As HPdfTransMatrix
980 Return HPDF_Page_GetTextMatrix(hpage)
983 Public Function GetGStateDepth() As UInt32
984 Return HPDF_Page_GetGStateDepth(hpage)
987 Public Sub SetLineWidth(ByVal line_width As Single)
988 HPDF_Page_SetLineWidth(hpage, line_width)
991 Public Sub SetLineCap(ByVal line_cap As HPdfLineCap)
992 HPDF_Page_SetLineCap(hpage, line_cap)
995 Public Sub SetLineJoin(ByVal line_join As HPdfLineJoin)
996 HPDF_Page_SetLineJoin(hpage, line_join)
999 Public Sub SetMiterLimit(ByVal miter_limit As Single)
1000 HPDF_Page_SetMiterLimit(hpage, miter_limit)
1003 Public Sub SetDash(ByRef dash_ptn As UInt16(), ByVal phase As UInt32)
1004 If (dash_ptn Is Nothing) Then
1005 HPDF_Page_SetDash(hpage, dash_ptn, 0, 0)
1009 Dim len As UInt32 = dash_ptn.Length
1011 HPDF_Page_SetDash(hpage, dash_ptn, len, phase)
1015 Public Sub SetFlat(ByVal flatness As Single)
1016 HPDF_Page_SetFlat(hpage, flatness)
1019 Public Sub SetExtGState(ByVal gstate As HPdfExtGState)
1020 HPDF_Page_SetExtGState(hpage, gstate.GetHandle())
1024 HPDF_Page_GSave(hpage)
1027 Public Sub GRestore()
1028 HPDF_Page_GRestore(hpage)
1031 Public Sub Concat(ByVal a As Single, ByVal b As Single, ByVal c As Single, ByVal d As Single, ByVal x As Single, ByVal y As Single)
1032 HPDF_Page_Concat(hpage, a, b, c, d, x, y)
1035 Public Sub MoveTo(ByVal x As Single, ByVal y As Single)
1036 HPDF_Page_MoveTo(hpage, x, y)
1039 Public Sub LineTo(ByVal x As Single, ByVal y As Single)
1040 HPDF_Page_LineTo(hpage, x, y)
1043 Public Sub CurveTo(ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single, ByVal x3 As Single, ByVal y3 As Single)
1044 HPDF_Page_CurveTo(hpage, x1, y1, x2, y2, x3, y3)
1047 Public Sub CurveTo2(ByVal x2 As Single, ByVal y2 As Single, ByVal x3 As Single, ByVal y3 As Single)
1048 HPDF_Page_CurveTo2(hpage, x2, y2, x3, y3)
1050 Public Sub CurveTo3(ByVal x1 As Single, ByVal y1 As Single, ByVal x3 As Single, ByVal y3 As Single)
1051 HPDF_Page_CurveTo2(hpage, x1, y1, x3, y3)
1054 Public Sub ClosePath()
1055 HPDF_Page_ClosePath(hpage)
1058 Public Sub Rectangle(ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single)
1059 HPDF_Page_Rectangle(hpage, x, y, width, height)
1063 HPDF_Page_Stroke(hpage)
1066 Public Sub ClosePathStroke()
1067 HPDF_Page_ClosePathStroke(hpage)
1071 HPDF_Page_Fill(hpage)
1075 HPDF_Page_Eofill(hpage)
1078 Public Sub FillStroke()
1079 HPDF_Page_FillStroke(hpage)
1082 Public Sub EofillStroke()
1083 HPDF_Page_EofillStroke(hpage)
1086 Public Sub ClosePathFillStroke()
1087 HPDF_Page_ClosePathFillStroke(hpage)
1090 Public Sub ClosePathEofillStroke()
1091 HPDF_Page_ClosePathEofillStroke(hpage)
1094 Public Sub EndPath()
1095 HPDF_Page_EndPath(hpage)
1099 HPDF_Page_Clip(hpage)
1103 HPDF_Page_Eoclip(hpage)
1106 Public Sub BeginText()
1107 HPDF_Page_BeginText(hpage)
1110 Public Sub EndText()
1111 HPDF_Page_EndText(hpage)
1114 Public Sub SetCharSpace(ByVal value As Single)
1115 HPDF_Page_SetCharSpace(hpage, value)
1118 Public Sub SetWordSpace(ByVal value As Single)
1119 HPDF_Page_SetWordSpace(hpage, value)
1122 Public Sub SetHorizontalScalling(ByVal value As Single)
1123 HPDF_Page_SetHorizontalScalling(hpage, value)
1126 Public Sub SetTextLeading(ByVal value As Single)
1127 HPDF_Page_SetTextLeading(hpage, value)
1130 Public Sub SetFontAndSize(ByRef font As HPdfFont, ByVal size As Single)
1131 HPDF_Page_SetFontAndSize(hpage, font.GetHandle(), size)
1134 Public Sub SetTextRenderingMode(ByVal mode As HPdfTextRenderingMode)
1135 HPDF_Page_SetTextRenderingMode(hpage, mode)
1138 Public Sub SetTextRaise(ByVal value As Single)
1139 HPDF_Page_SetTextRaise(hpage, value)
1142 Public Sub MoveTextPos(ByVal x As Single, ByVal y As Single)
1143 HPDF_Page_MoveTextPos(hpage, x, y)
1146 Public Sub MoveTextPos2(ByVal x As Single, ByVal y As Single)
1147 HPDF_Page_MoveTextPos2(hpage, x, y)
1150 Public Sub SetTextMatrix(ByVal a As Single, ByVal b As Single, ByVal c As Single, ByVal d As Single, ByVal x As Single, ByVal y As Single)
1151 HPDF_Page_SetTextMatrix(hpage, a, b, c, d, x, y)
1154 Public Sub MoveToNextLine()
1155 HPDF_Page_MoveToNextLine(hpage)
1158 Public Sub ShowText(ByVal text As String)
1159 HPDF_Page_ShowText(hpage, text)
1162 Public Sub ShowTextNextLine(ByVal text As String)
1163 HPDF_Page_ShowTextNextLine(hpage, text)
1166 Public Sub ShowTextNextLineEx(ByVal word_space As Single, ByVal char_space As Single, ByVal text As String)
1167 HPDF_Page_ShowTextNextLineEx(hpage, word_space, char_space, text)
1170 Public Sub SetGrayFill(ByVal gray As Single)
1171 HPDF_Page_SetGrayFill(hpage, gray)
1174 Public Sub SetGrayStroke(ByVal gray As Single)
1175 HPDF_Page_SetGrayStroke(hpage, gray)
1178 Public Sub SetRGBFill(ByVal r As Single, ByVal g As Single, ByVal b As Single)
1179 HPDF_Page_SetRGBFill(hpage, r, g, b)
1182 Public Sub SetRGBStroke(ByVal r As Single, ByVal g As Single, ByVal b As Single)
1183 HPDF_Page_SetRGBStroke(hpage, r, g, b)
1186 Public Sub SetCMYKFill(ByVal c As Single, ByVal m As Single, ByVal y As Single, ByVal k As Single)
1187 HPDF_Page_SetCMYKFill(hpage, c, m, y, k)
1190 Public Sub SetCMYKStroke(ByVal c As Single, ByVal m As Single, ByVal y As Single, ByVal k As Single)
1191 HPDF_Page_SetCMYKStroke(hpage, c, m, y, k)
1194 Public Sub ExecuteXObject(ByRef xobj As HPdfImage)
1195 HPDF_Page_ExecuteXObject(hpage, xobj.GetHandle())
1198 Public Sub DrawImage(ByRef image As HPdfImage, ByVal x As Single, ByVal y As Single, ByVal width As Single, ByVal height As Single)
1199 HPDF_Page_DrawImage(hpage, image.GetHandle(), x, y, width, height)
1202 Public Sub Circle(ByVal x As Single, ByVal y As Single, ByVal ray As Single)
1203 HPDF_Page_Circle(hpage, x, y, ray)
1206 Public Sub Arc(ByVal x As Single, ByVal y As Single, ByVal ray As Single, ByVal ang1 As Single, ByVal ang2 As Single)
1207 HPDF_Page_Arc(hpage, x, y, ray, ang1, ang2)
1210 Public Sub TextOut(ByVal xpos As Single, ByVal ypos As Single, ByVal text As String)
1211 HPDF_Page_TextOut(hpage, xpos, ypos, text)
1214 Public Sub TextRect(ByVal left As Single, ByVal top As Single, ByVal right As Single, ByVal bottom As Single, ByVal text As String, ByVal align As HPdfTextAlignment, ByRef len As UInt32)
1215 HPDF_Page_TextRect(hpage, left, top, right, bottom, text, align, len)
1218 Public Sub SetSlideShow(ByVal type As HPdfTransitionStyle, ByVal disp_time As Single, ByVal trans_time As Single)
1219 HPDF_Page_SetSlideShow(hpage, type, disp_time, trans_time)
1222 Public Function GetHandle() As IntPtr
1227 Public Class HPdfFont
1228 Private Declare Function HPDF_Outline_SetOpened Lib "libhpdf.dll" Alias "HPDF_Outline_SetOpened" (ByVal houtline As IntPtr, ByVal opened As Int32) As UInt32
1230 Private Declare Function HPDF_Font_GetFontName Lib "libhpdf.dll" Alias "HPDF_Font_GetFontName" (ByVal hfont As IntPtr) As String
1231 Private Declare Function HPDF_Font_GetEncodingName Lib "libhpdf.dll" Alias "HPDF_Font_GetEncodingName" (ByVal hfont As IntPtr) As String
1232 Private Declare Function HPDF_Font_GetUnicodeWidth Lib "libhpdf.dll" Alias "HPDF_Font_GetUnicodeWidth" (ByVal hfont As IntPtr, ByVal code As UInt16) As Int32
1233 Private Declare Function HPDF_Font_GetBBox Lib "libhpdf.dll" Alias "HPDF_Font_GetBBox" (ByVal hfont As IntPtr) As HPdfBox
1234 Private Declare Function HPDF_Font_GetAscent Lib "libhpdf.dll" Alias "HPDF_Font_GetAscent" (ByVal hfont As IntPtr) As Int32
1235 Private Declare Function HPDF_Font_GetDescent Lib "libhpdf.dll" Alias "HPDF_Font_GetDescent" (ByVal hfont As IntPtr) As Int32
1236 Private Declare Function HPDF_Font_GetXHeight Lib "libhpdf.dll" Alias "HPDF_Font_GetXHeight" (ByVal hfont As IntPtr) As UInt32
1237 Private Declare Function HPDF_Font_GetCapHeight Lib "libhpdf.dll" Alias "HPDF_Font_GetCapHeight" (ByVal hfont As IntPtr) As UInt32
1238 Private Declare Function HPDF_Font_TextWidth Lib "libhpdf.dll" Alias "HPDF_Font_TextWidth" (ByVal hfont As IntPtr, ByVal text As String, ByVal len As UInt16) As HPdfTextWidth
1239 Private Declare Function HPDF_Font_MeasureText Lib "libhpdf.dll" Alias "HPDF_Font_MeasureText" (ByVal hfont As IntPtr, ByVal text As String, ByVal len As UInt16, _
1240 ByVal width As Single, ByVal font_size As Single, ByVal char_space As Single, ByVal word_space As Single, ByVal wordwrap As Int32, ByRef real_width As Single) As UInt32
1242 Private hfont As IntPtr
1244 Public Sub New(ByVal hfont As IntPtr)
1245 If (hfont = IntPtr.Zero) Then
1246 Throw New Exception("cannot create HPdfFont object.")
1252 Public Function GetHandle() As IntPtr
1256 Public Function GetFontName() As String
1257 Return HPDF_Font_GetFontName(hfont)
1260 Public Function GetEncodingName() As String
1261 Return HPDF_Font_GetEncodingName(hfont)
1264 Public Function GetUnicodeWidth(ByVal code As UInt16) As Int32
1265 Return HPDF_Font_GetUnicodeWidth(hfont, code)
1268 Public Function GetBBox() As HPdfBox
1269 Return HPDF_Font_GetBBox(hfont)
1272 Public Function GetAscent() As Int32
1273 Return HPDF_Font_GetAscent(hfont)
1276 Public Function GetDescent() As Int32
1277 Return HPDF_Font_GetDescent(hfont)
1280 Public Function GetXHeight() As UInt32
1281 Return HPDF_Font_GetXHeight(hfont)
1284 Public Function GetCapHeight() As UInt32
1285 Return HPDF_Font_GetCapHeight(hfont)
1288 Public Function TextWidth(ByVal text As String, ByVal len As UInt32) As HPdfTextWidth
1289 Return HPDF_Font_TextWidth(hfont, text, len)
1292 Public Function MeasureText(ByVal text As String, ByVal len As UInt32, ByVal width As Single, _
1293 ByVal font_size As Single, ByVal char_space As Single, ByVal word_space As Single, _
1294 ByVal wordwrap As Int32, ByRef real_width As Single) As UInt32
1296 Return HPDF_Font_MeasureText(hfont, text, len, width, font_size, char_space, word_space, wordwrap, real_width)
1299 Public Class HPdfOutline
1301 Private Declare Function HPDF_Outline_SetOpened Lib "libhpdf.dll" Alias "HPDF_Outline_SetOpened" (ByVal houtline As IntPtr, ByVal opened As Int32) As UInt32
1302 Private Declare Function HPDF_Outline_SetDestination Lib "libhpdf.dll" Alias "HPDF_Outline_SetDestination" (ByVal houtline As IntPtr, ByVal hdest As IntPtr) As UInt32
1304 Private houtline As IntPtr
1306 Public Sub New(ByVal houtline As IntPtr)
1307 If (houtline = IntPtr.Zero) Then
1308 Throw New Exception("cannot create HPdfOutline object.")
1311 Me.houtline = houtline
1314 Public Function GetHandle() As IntPtr
1318 Public Sub SetOpened(ByVal opened As Boolean)
1319 Dim iopened As Int32
1322 iopened = HPdfDoc.HPDF_TRUE
1324 iopened = HPdfDoc.HPDF_FALSE
1327 HPDF_Outline_SetOpened(houtline, iopened)
1330 Public Sub SetDestination(ByRef dest As HPdfDestination)
1331 HPDF_Outline_SetDestination(houtline, dest.GetHandle())
1335 Public Class HPdfEncoder
1336 Private Declare Function HPDF_Encoder_GetType Lib "libhpdf.dll" Alias "HPDF_Encoder_GetType" (ByVal hencoder As IntPtr) As HPdfEncoderType
1337 Private Declare Function HPDF_Encoder_GetByteType Lib "libhpdf.dll" Alias "HPDF_Encoder_GetByteType" (ByVal hencoder As IntPtr, ByVal text As String, ByVal index As UInt32) As HPdfByteType
1338 Private Declare Function HPDF_Encoder_GetUnicode Lib "libhpdf.dll" Alias "HPDF_Encoder_GetUnicode" (ByVal hencoder As IntPtr, ByVal code As UInt16) As UInt16
1339 Private Declare Function HPDF_Encoder_GetWritingMode Lib "libhpdf.dll" Alias "HPDF_Encoder_GetWritingMode" (ByVal hencoder As IntPtr) As HPdfWritingMode
1341 Private hencoder As IntPtr
1343 Public Sub New(ByVal hencoder As IntPtr)
1344 If (hencoder = IntPtr.Zero) Then
1345 Throw New Exception("cannot create HPdfEncoder object.")
1348 Me.hencoder = hencoder
1351 Public Function GetHandle() As IntPtr
1355 Public Function GetEncoderType() As HPdfEncoderType
1356 Return HPDF_Encoder_GetType(hencoder)
1359 Public Function GetByteType(ByVal text As String, ByVal index As UInt32) As HPdfByteType
1360 Return HPDF_Encoder_GetByteType(hencoder, text, index)
1363 Public Function GetUnicode(ByVal code As UInt16) As UInt16
1364 Return HPDF_Encoder_GetUnicode(hencoder, code)
1367 Public Function GetWritingMode() As HPdfWritingMode
1368 Return HPDF_Encoder_GetWritingMode(hencoder)
1371 Public Class HPdfDestination
1372 Private Declare Function HPDF_Destination_SetXYZ Lib "libhpdf.dll" Alias "HPDF_Destination_SetXYZ" (ByVal hdest As IntPtr, ByVal left As Single, ByVal top As Single, ByVal zoom As Single) As UInt32
1373 Private Declare Function HPDF_Destination_SetFit Lib "libhpdf.dll" Alias "HPDF_Destination_SetFit" (ByVal hdest As IntPtr) As UInt32
1374 Private Declare Function HPDF_Destination_SetFitH Lib "libhpdf.dll" Alias "HPDF_Destination_SetFitH" (ByVal hdest As IntPtr, ByVal top As Single) As UInt32
1375 Private Declare Function HPDF_Destination_SetFitV Lib "libhpdf.dll" Alias "HPDF_Destination_SetFitV" (ByVal hdest As IntPtr, ByVal left As Single) As UInt32
1376 Private Declare Function HPDF_Destination_SetFitR Lib "libhpdf.dll" Alias "HPDF_Destination_SetFitR" (ByVal hdest As IntPtr, ByVal left As Single, ByVal bottom As Single, ByVal right As Single, ByVal top As Single) As UInt32
1377 Private Declare Function HPDF_Destination_SetFitB Lib "libhpdf.dll" Alias "HPDF_Destination_SetFitB" (ByVal hdest As IntPtr) As UInt32
1378 Private Declare Function HPDF_Destination_SetFitBH Lib "libhpdf.dll" Alias "HPDF_Destination_SetFitBH" (ByVal hdest As IntPtr, ByVal top As Single) As UInt32
1379 Private Declare Function HPDF_Destination_SetFitBV Lib "libhpdf.dll" Alias "HPDF_Destination_SetFitBV" (ByVal hdest As IntPtr, ByVal left As Single) As UInt32
1381 Private hdest As IntPtr
1383 Public Sub New(ByVal hdest As IntPtr)
1384 If (hdest = IntPtr.Zero) Then
1385 Throw New Exception("cannot create HPdfDestination object.")
1391 Public Sub SetXYZ(ByVal left As Single, ByVal top As Single, ByVal zoom As Single)
1392 HPDF_Destination_SetXYZ(hdest, left, top, zoom)
1396 HPDF_Destination_SetFit(hdest)
1399 Public Sub SetFitH(ByVal top As Single)
1400 HPDF_Destination_SetFitH(hdest, top)
1403 Public Sub SetFitV(ByVal left As Single)
1404 HPDF_Destination_SetFitV(hdest, left)
1407 Public Sub SetFitR(ByVal left As Single, ByVal bottom As Single, ByVal right As Single, ByVal top As Single)
1408 HPDF_Destination_SetFitR(hdest, left, bottom, right, top)
1411 Public Sub SetFitB()
1412 HPDF_Destination_SetFitB(hdest)
1415 Public Sub SetFitBH(ByVal top As Single)
1416 HPDF_Destination_SetFitBH(hdest, top)
1419 Public Sub SetFitBV(ByVal left As Single)
1420 HPDF_Destination_SetFitBV(hdest, left)
1423 Public Function GetHandle() As IntPtr
1427 Public Class HPdfAnnotation
1429 Private Declare Function HPDF_LinkAnnot_SetHighlightMode Lib "libhpdf.dll" Alias "HPDF_LinkAnnot_SetHighlightMode" (ByVal hannot As IntPtr, ByVal mode As HPdfAnnotHighlightMode) As UInt32
1430 Private Declare Function HPDF_LinkAnnot_SetBorderStyle Lib "libhpdf.dll" Alias "HPDF_LinkAnnot_SetBorderStyle" (ByVal hannot As IntPtr, ByVal width As Single, ByVal dash_on As UInt16, ByVal dash_off As UInt16) As UInt32
1431 Private Declare Function HPDF_TextAnnot_SetIcon Lib "libhpdf.dll" Alias "HPDF_TextAnnot_SetIcon" (ByVal hannot As IntPtr, ByVal icon As HPdfAnnotIcon) As UInt32
1432 Private Declare Function HPDF_TextAnnot_SetOpened Lib "libhpdf.dll" Alias "HPDF_TextAnnot_SetOpened" (ByVal hannot As IntPtr, ByVal opened As Int32) As UInt32
1434 Private hannot As IntPtr
1436 Public Sub New(ByVal hannot As IntPtr)
1437 If (hannot = IntPtr.Zero) Then
1438 Throw New Exception("cannot create HPdfAnnotation object.")
1444 Public Function GetHandle() As IntPtr
1448 Public Sub SetHighlightMode(ByVal mode As HPdfAnnotHighlightMode)
1449 HPDF_LinkAnnot_SetHighlightMode(hannot, mode)
1452 Public Sub SetBorderStyle(ByVal width As Single, ByVal dash_on As UInt16, ByVal dash_off As UInt16)
1453 HPDF_LinkAnnot_SetBorderStyle(hannot, width, dash_on, dash_off)
1456 Public Sub SetIcon(ByVal icon As HPdfAnnotIcon)
1457 HPDF_TextAnnot_SetIcon(hannot, icon)
1460 Public Sub SetOpened(ByVal opened As Boolean)
1464 flg = HPdfDoc.HPDF_TRUE
1466 flg = HPdfDoc.HPDF_FALSE
1469 HPDF_TextAnnot_SetOpened(hannot, flg)
1473 Public Class HPdfXObject
1474 Protected hobj As IntPtr
1476 Public Sub New(ByVal hobj As IntPtr)
1477 If (hobj = IntPtr.Zero) Then
1478 Throw New Exception("cannot create HPdfImage object.")
1484 Public Function GetHandle() As IntPtr
1488 Public Class HPdfImage
1489 Inherits HPdfXObject
1491 Private Declare Function HPDF_Image_GetSize Lib "libhpdf.dll" Alias "HPDF_Image_GetSize" (ByVal image As IntPtr) As HPdfPoint
1492 Private Declare Function HPDF_Image_GetWidth Lib "libhpdf.dll" Alias "HPDF_Image_GetWidth" (ByVal image As IntPtr) As UInt32
1493 Private Declare Function HPDF_Image_GetHeight Lib "libhpdf.dll" Alias "HPDF_Image_GetHeight" (ByVal image As IntPtr) As UInt32
1494 Private Declare Function HPDF_Image_GetBitsPerComponent Lib "libhpdf.dll" Alias "HPDF_Image_GetBitsPerComponent" (ByVal image As IntPtr) As UInt32
1495 Private Declare Function HPDF_Image_GetColorSpace Lib "libhpdf.dll" Alias "HPDF_Image_GetColorSpace" (ByVal image As IntPtr) As String
1496 Private Declare Function HPDF_Image_SetColorMask Lib "libhpdf.dll" Alias "HPDF_Image_SetColorMask" (ByVal image As IntPtr, ByVal rmin As UInt32, ByVal rmax As UInt32, ByVal gmin As UInt32, ByVal gmax As UInt32, ByVal bmin As UInt32, ByVal bmax As UInt32) As UInt32
1497 Private Declare Function HPDF_Image_SetMaskImage Lib "libhpdf.dll" Alias "HPDF_Image_SetMaskImage" (ByVal image As IntPtr, ByVal image_mask As IntPtr) As String
1499 Public Sub New(ByVal hobj As IntPtr)
1503 Public Function GetWidth() As UInt32
1504 Return HPDF_Image_GetWidth(hobj)
1507 Public Function GetHeight() As UInt32
1508 Return HPDF_Image_GetHeight(hobj)
1511 Public Function GetBitsPerComponent() As UInt32
1512 Return HPDF_Image_GetBitsPerComponent(hobj)
1515 Public Function GetColorSpace() As String
1516 Return HPDF_Image_GetColorSpace(hobj)
1519 Public Sub SetColorMask(ByVal rmin As UInt32, ByVal rmax As UInt32, ByVal gmin As UInt32, ByVal gmax As UInt32, ByVal bmin As UInt32, ByVal bmax As UInt32)
1520 HPDF_Image_SetColorMask(hobj, rmin, rmax, gmin, gmax, bmin, bmax)
1523 Public Sub SetMaskImage(ByRef mask_image As HPdfImage)
1524 HPDF_Image_SetMaskImage(hobj, mask_image.GetHandle())
1528 Public Class HPdfExtGState
1529 Private Declare Function HPDF_ExtGState_SetAlphaStroke Lib "libhpdf.dll" Alias "HPDF_ExtGState_SetAlphaStroke" (ByVal gstate As IntPtr, ByVal value As Single) As UInt32
1530 Private Declare Function HPDF_ExtGState_SetAlphaFill Lib "libhpdf.dll" Alias "HPDF_ExtGState_SetAlphaFill" (ByVal gstate As IntPtr, ByVal value As Single) As UInt32
1531 Private Declare Function HPDF_ExtGState_SetBlendMode Lib "libhpdf.dll" Alias "HPDF_ExtGState_SetBlendMode" (ByVal gstate As IntPtr, ByVal mode As HPdfBlendMode) As UInt32
1533 Protected hgstate As IntPtr
1535 Public Sub New(ByVal hgstate As IntPtr)
1536 If (hgstate = IntPtr.Zero) Then
1537 Throw New Exception("cannot create HPdfImage object.")
1540 Me.hgstate = hgstate
1543 Public Function GetHandle() As IntPtr
1547 Public Sub SetAlphaStroke(ByVal value As Single)
1548 HPDF_ExtGState_SetAlphaStroke(hgstate, value)
1551 Public Sub SetAlphaFill(ByVal value As Single)
1552 HPDF_ExtGState_SetAlphaFill(hgstate, value)
1555 Public Sub SetBlendMode(ByVal mode As HPdfBlendMode)
1556 HPDF_ExtGState_SetBlendMode(hgstate, mode)