PTPDFView
@interface PTPDFView : NSObject
PDFView is a utility class that can be used for interactive rendering of PDF documents.
In .NET environment PDFView is derived from System.Windows.Forms.Control and it can be used like a regular form (see PDFViewForm.cs in PDFView sample for C# for a concrete example).
PDFView implements some essential features such as double-buffering, multi-threaded rendering, scrolling, zooming, and page navigation that are essential in interactive rendering applications (e.g. in client PDF viewing and editing applications).
PDFView defines several coordinate spaces and it is important to understand their differences:
Page Space refers to the space in which a PDF page is defined. It is determined by a page itself and the origin is at the lower-left corner of the page. Note that Page Space is independent of how a page is viewed in PDFView and each page has its own Page space.
Canvas Space refers to the tightest axis-aligned bounding box of all the pages given the current page presentation mode in PDFView. For example, if the page presentation mode is e_single_continuous, all the pages are arranged vertically with one page in each row, and therefore the Canvas Space is rectangle with possibly large height value. For this reason, Canvas Space is also, like Page Space, independent of the zoom factor. Also note that since PDFView adds gaps between adjacent pages, the Canvas Space is larger than the space occupied by all the pages. The origin of the Canvas Space is located at the upper-left corner.
Screen Space (or Client Space) is the space occupied by PDFView and its origin is at the upper-left corner. Note that the virtual size of this space can extend beyond the visible region.
Scrollable Space is the virtual space within which PDFView can scroll. It is determined by the Canvas Space and the current zoom factor. Roughly speaking, the dimensions of the Scrollable Space is the dimensions of the Canvas Space timed by the zoom. Therefore, a large zoom factor will result in a larger Scrollable region given the same Canvas region. For this reason, Scrollable Space might also be referred to as Zoomed Canvas Space. Note that since PDFView adds gaps between pages in Canvas Space and these gaps are not scaled when rendered, the scrollable range is not exactly what the zoom factor times the Canvas range. For functions such as SetHScrollPos(), SetVScrollPos(), GetCanvasHeight(), and GetCanvasWidth(), it is the Scrollable Space that is involved.
Note
PDFView is available on all platforms supported by PDFNet.
-
PDFView constructor and destructor. Create PDFView without associating it to any document.
Declaration
Objective-C
- (instancetype)init;
Swift
init!()
-
Associates this PDFView with a given document conversion. The conversion will be performed page-by-page, asynchronously. The pdview object will be updated to display the conversion result
Declaration
Objective-C
- (void)OpenUniversalDoc:(PTDocumentConversion *)conversion;
Swift
func openUniversalDoc(_ conversion: PTDocumentConversion!)
Parameters
doc
- A document to be displayed in the view.
-
Close the associated PDF document.
Declaration
Objective-C
- (void)CloseDoc;
Swift
func closeDoc()
-
Acquires a write lock on the currently open document, optionally canceling all threads accessing the document.
Declaration
Objective-C
- (void)DocLock:(BOOL)cancel_threads;
Swift
func docLock(_ cancel_threads: Bool)
-
Releases the write lock from the currently open document.
Declaration
Objective-C
- (void)DocUnlock;
Swift
func docUnlock()
-
Try acquiring a write lock on the currently open document, waiting no longer than specified number of milliseconds.
Declaration
Objective-C
- (BOOL)DocTryLock:(int)milliseconds;
Swift
func docTryLock(_ milliseconds: Int32) -> Bool
Return Value
true if the document is locked for multi-threaded access, false otherwise.
-
Locks the currently open document to prevent competing write threads (using Lock()) from accessing the document at the same time. Other reader threads however, will be allowed to access the document. Threads attempting to obtain write access to the document will wait in suspended state until the thread that owns the lock calls doc.UnlockRead(). Note: To avoid deadlocks obtaining a write lock while holding a read lock is not permitted and will throw an exception. If this situation is encountered please either unlock the read lock before the write lock is obtained or acquire a write lock (rather than read lock) in the first place.
Declaration
Objective-C
- (void)DocLockRead;
Swift
func docLockRead()
-
Releases the read lock from the currently open document.
Declaration
Objective-C
- (void)DocUnlockRead;
Swift
func docUnlockRead()
-
Try acquiring a read lock on the current document, waiting no longer than specified number of milliseconds.
Declaration
Objective-C
- (BOOL)DocTryLockRead:(int)milliseconds;
Swift
func docTryLockRead(_ milliseconds: Int32) -> Bool
Return Value
true if the document is locked for multi-threaded access, false otherwise.
-
Sets the current page presentation mode.
Declaration
Objective-C
- (void)SetPagePresentationMode:(PTPagePresentationMode)mode;
Swift
func setPagePresentationMode(_ mode: PTPagePresentationMode)
Parameters
mode
- the new page presentation mode. @default The default PagePresentationMode is e_single_continuous.
-
Declaration
Objective-C
- (PTPagePresentationMode)GetPagePresentationMode;
Swift
func getPagePresentationMode() -> PTPagePresentationMode
Return Value
the current page presentation mode.
-
Set the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output.
Declaration
Objective-C
- (void)SetColorPostProcessMode:(PTColorPostProcessMode)mode;
Swift
func setColorPostProcessMode(_ mode: PTColorPostProcessMode)
Parameters
mode
is the specific transform to be applied
-
Sets the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output.
This mode will map the brightness of the original rasterized bitmap to a gradient in image_file_contents from left to right.
Declaration
Objective-C
- (void)SetColorPostProcessMapFile:(PTFilter *)image_file_contents;
Swift
func setColorPostProcessMapFile(_ image_file_contents: PTFilter!)
Parameters
image_file_contents
A filter with image file contents.
-
Converts a color based on the view’s color post processing transformation.
Declaration
Parameters
color
the color to be converted
Return Value
the post-processed color
-
Sets the color post processing transformation. This transform is applied to the rasterized bitmap as the final step in the rasterization process, and is applied directly to the resulting bitmap (disregarding any color space information). Color post processing only supported for RGBA output. This mode will map the brightness of the original rasterized bitmap to a gradient between whiteColor and blackColor
Declaration
Objective-C
- (void)SetColorPostProcessColors:(unsigned int)white_color black_color:(unsigned int)black_color;
Swift
func setColorPostProcessColors(_ white_color: UInt32, black_color: UInt32)
Parameters
white_color
The white color (ARGB) of the page.
black_color
The black color (ARGB) of the page.
-
Declaration
Objective-C
- (PTColorPostProcessMode)GetColorPostProcessMode;
Swift
func getColorPostProcessMode() -> PTColorPostProcessMode
Return Value
the current color post processing mode.
-
Declaration
Objective-C
- (int)GetCurrentPage;
Swift
func getCurrentPage() -> Int32
Return Value
the current page displayed in the view.
-
Declaration
Objective-C
- (int)GetPageCount;
Swift
func getPageCount() -> Int32
Return Value
the total number of pages in the document.
-
Sets the current page to the first page in the document.
Declaration
Objective-C
- (BOOL)GotoFirstPage;
Swift
func gotoFirstPage() -> Bool
Return Value
true if successful, false otherwise.
-
Sets the current page to the last page in the document.
Declaration
Objective-C
- (BOOL)GotoLastPage;
Swift
func gotoLastPage() -> Bool
Return Value
true if successful, false otherwise.
-
Sets the current page to the next page in the document.
Declaration
Objective-C
- (BOOL)GotoNextPage;
Swift
func gotoNextPage() -> Bool
Return Value
true if successful, false otherwise.
-
Sets the current page to the previous page in the document.
Declaration
Objective-C
- (BOOL)GotoPreviousPage;
Swift
func gotoPreviousPage() -> Bool
Return Value
true if successful, false otherwise.
-
Sets the current page to the given page.
Declaration
Objective-C
- (BOOL)SetCurrentPage:(int)page_num;
Swift
func setCurrentPage(_ page_num: Int32) -> Bool
Return Value
true if successful, false otherwise.
-
Changes the viewing area to fit a rectangle rect on page page_num. Rectangle must be specified in page coordinates. This will adjust current page and zoom appropriately.
Declaration
Objective-C
- (BOOL)ShowRect:(int)page_num rect:(PTPDFRect *)rect;
Swift
func showRect(_ page_num: Int32, rect: PTPDFRect!) -> Bool
Return Value
true if successful, false otherwise.
-
Get a vector with the pages currently visible on the screen.
Declaration
Objective-C
- (NSArray<NSNumber *> *)GetVisiblePages;
Swift
func getVisiblePages() -> [NSNumber]!
Return Value
a vector of the pages currently visible on the screen.
-
Returns the current zoom factor.
Declaration
Objective-C
- (double)GetZoom;
Swift
func getZoom() -> Double
Return Value
current zoom (or scaling) component used to display the page content.
-
Sets the zoom factor to a new value. The function zooms to a point at the center of the rendering buffer.
Declaration
Objective-C
- (BOOL)SetZoom:(double)zoom;
Swift
func setZoom(_ zoom: Double) -> Bool
Parameters
zoom
- new scaling component used to display the page content.
Return Value
true if successful, false otherwise.
-
Sets the zoom factor to a new value using the given pixel coordinate (x,y) as a zoom center, which will stay fixed on the screen.
The zoom point (x,y) is represented in the screen space, which starts in the upper-left corner of the client window.
Should you want to move (x, y) to the center of the client window, you can use the OnScroll() subsequently:
int x, y; double zoom; ... view.SetZoom(x, y, zoom); int width = view.GetBufferWidth(); int height = view.GetBufferHeight(); int dx = (int)(x - (double)width/2 + 0.5); int dy = (int)(y - (double)height/2 + 0.5); view.OnScroll(dx, dy);
Declaration
Objective-C
- (BOOL)SetZoomWithCoord:(int)x y:(int)y zoom:(double)zoom;
Swift
func setZoomWithCoord(_ x: Int32, y: Int32, zoom: Double) -> Bool
Parameters
x
- the horizontal coordinate to zoom in.
y
- the vertical coordinate to zoom in.
zoom
- new scaling component used to display the page content.
Return Value
true if successful, false otherwise.
-
Sets the zoom factor to a new value using the given pixel coordinate (x,y) to find an intersecting paragraph. The width of the paragraph helps to determine the zoom value, center of the paragraph is used as a zoom center. Paragraph has to contain more than one line and be wider than 1/5th of a page width. When called on a paragraph wider than current zoom level the new zoom level is set to fit the entire page(zoom out).
The zoom point (x,y) is represented in the screen space, which starts in the upper-left corner of the client window.
Declaration
Objective-C
- (BOOL)SmartZoom:(int)x y:(int)y;
Swift
func smartZoom(_ x: Int32, y: Int32) -> Bool
Parameters
x
- the horizontal coordinate to look for a text block.
y
- the vertical coordinate to look for a text block.
Return Value
true if successful, false if no paragraph intersects the given point.
-
Rotates all pages in the document 90 degrees clockwise.
Declaration
Objective-C
- (void)RotateClockwise;
Swift
func rotateClockwise()
-
Rotates all pages in the document 90 degrees counter-clockwise.
Declaration
Objective-C
- (void)RotateCounterClockwise;
Swift
func rotateCounterClockwise()
-
Declaration
Objective-C
- (int)GetPageNumberFromScreenPt:(double)x y:(double)y;
Swift
func getPageNumber(fromScreenPt x: Double, y: Double) -> Int32
Return Value
the number of the page located under the given screen coordinate. The positive number indicates a valid page, whereas number less than 1 means that no page was found.
-
Converts a point expressed in screen space to a point in canvas space.
Declaration
Objective-C
- (PTPDFPoint *)ConvScreenPtToCanvasPt:(PTPDFPoint *)pt;
Swift
func convScreenPt(toCanvasPt pt: PTPDFPoint!) -> PTPDFPoint!
-
Converts a point expressed in canvas space to a point in screen space.
Declaration
Objective-C
- (PTPDFPoint *)ConvCanvasPtToScreenPt:(PTPDFPoint *)pt;
Swift
func convCanvasPt(toScreenPt pt: PTPDFPoint!) -> PTPDFPoint!
-
Converts a point expressed in canvas space to a point in a page space.
Declaration
Objective-C
- (PTPDFPoint *)ConvCanvasPtToPagePt:(PTPDFPoint *)pt page_num:(int)page_num;
Swift
func convCanvasPt(toPagePt pt: PTPDFPoint!, page_num: Int32) -> PTPDFPoint!
Parameters
page_num
the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.
-
Converts a point from a page space to point in canvas space.
Declaration
Objective-C
- (PTPDFPoint *)ConvPagePtToCanvasPt:(PTPDFPoint *)pt page_num:(int)page_num;
Swift
func convPagePt(toCanvasPt pt: PTPDFPoint!, page_num: Int32) -> PTPDFPoint!
Parameters
page_num
the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.
-
Converts a point expressed in screen space to a point in a page space.
Declaration
Objective-C
- (PTPDFPoint *)ConvScreenPtToPagePt:(PTPDFPoint *)pt page_num:(int)page_num;
Swift
func convScreenPt(toPagePt pt: PTPDFPoint!, page_num: Int32) -> PTPDFPoint!
Parameters
page_num
the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.
-
Converts a point in a page space to a point in the screen space. If PDFView is in a non-continous page view mode, and the page is not visible, the result is undefined.
Declaration
Objective-C
- (PTPDFPoint *)ConvPagePtToScreenPt:(PTPDFPoint *)pt page_num:(int)page_num;
Swift
func convPagePt(toScreenPt pt: PTPDFPoint!, page_num: Int32) -> PTPDFPoint!
Parameters
page_num
the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.
-
Snaps an xy coordinate pair (in screen space) to the nearest piece of document geometry.
Declaration
Objective-C
- (PTPDFPoint *)SnapToNearestInDoc:(PTPDFPoint *)screen_pt;
Swift
func snapToNearest(inDoc screen_pt: PTPDFPoint!) -> PTPDFPoint!
-
Set the point snapping mode for the SnapToNearestInDoc method. By default SnapToNearestInDoc will snap to line endpoints, midpoints, and intersections.
Declaration
Objective-C
- (void)SetSnappingMode:(unsigned int)mode_flags;
Swift
func setSnappingMode(_ mode_flags: UInt32)
Parameters
mode_flag
a bitwise combination of the members of
GeometryCollection::SnappingMode
-
Note
to obtain a transformation matrix that maps screen coordinates to page coordinates, you can invert the device matrix. For example:
Common::Matrix2D scr2page(pdfview.GetDeviceTransform()); scr2page.Inverse();
Declaration
Objective-C
- (PTMatrix2D *)GetDeviceTransform:(int)page_num;
Swift
func getDeviceTransform(_ page_num: Int32) -> PTMatrix2D!
Parameters
page_num
same as for PDFView.Conv???() methods.
Return Value
the device transformation matrix. The device transformation matrix maps the page coordinate system to screen (or device) coordinate system.
-
Sets the error handling function to be called in case an error is encountered during page rendering.
Declaration
Objective-C
- (void)SetErrorReportProc:(PTCallback *)instance;
Swift
func setErrorReportProc(_ instance: PTCallback!)
Parameters
error_proc
Error handling callback function (or delegate in .NET)
data
Custom data to be passed as a second parameter to ‘error_proc’.
-
Sets the callback function (i.e. a delegate) that is called whenever current page number changes. This can be used to update the current page number within GUI applications etc.
Declaration
Objective-C
- (void)SetCurrentPageProc:(PTCallback *)instance;
Swift
func setCurrentPageProc(_ instance: PTCallback!)
Parameters
curr_pagenum_proc
Callback function (or a delegate in .NET).
data
Custom data to be passed as a second parameter to ‘curr_pagenum_proc’.
-
Sets the callback function (i.e. a delegate) for JavaScript action. Can be used to handle alert event which pops up a window with alert message.
Declaration
Objective-C
- (void)SetJavaScriptEventCallBack:(PTCallback *)instance;
Swift
func setJavaScriptEventCallBack(_ instance: PTCallback!)
Parameters
js_proc
Callback function (or a delegate in .NET).
data
user defined data
-
Sets the callback function (i.e. a delegate) that is called whenever current zoom (magnification) changes. This can be used to update the current zoom number within GUI applications etc.
Declaration
Objective-C
- (void)SetCurrentZoomProc:(PTCallback *)instance;
Swift
func setCurrentZoomProc(_ instance: PTCallback!)
Parameters
curr_zoom_proc
Callback function (or a delegate in .NET).
data
Custom data to be passed as a second parameter to ‘curr_zoom_proc’.
-
Undocumented
Declaration
Objective-C
- (void)ExecuteActionWithActionParameter: (PTActionParameter*)action_param;
Swift
func executeAction(with action_param: PTActionParameter!)
-
Returns the width of the scrollable space.
Declaration
Objective-C
- (double)GetCanvasWidth;
Swift
func getCanvasWidth() -> Double
-
Returns the height of the scrollable space.
Declaration
Objective-C
- (double)GetCanvasHeight;
Swift
func getCanvasHeight() -> Double
-
Declaration
Objective-C
- (double)GetHScrollPos;
Swift
func getHScrollPos() -> Double
Return Value
the current horizontal scroll position in the scrollable space.
-
Declaration
Objective-C
- (double)GetVScrollPos;
Swift
func getVScrollPos() -> Double
Return Value
the current vertical scroll position in the scrollable space.
-
Scrolls the contents of the rendering buffer ‘pix_dx’ horizontally and ‘pix_dy’ vertically.
Declaration
Objective-C
- (void)OnScroll:(int)pix_dx pix_dy:(int)pix_dy;
Swift
func onScroll(_ pix_dx: Int32, pix_dy: Int32)
Parameters
pix_dx
horizontal scroll offset, in pixels
pix_dy
vertical scroll offset, in pixels
-
Sets the horizontal scroll position in scrollable space.
Declaration
Objective-C
- (void)SetHScrollPos:(double)pos;
Swift
func setHScrollPos(_ pos: Double)
Parameters
the
new horizontal scroll position. The position should be in the range between 0 and GetCanvasWidth().
-
Sets the vertical scroll position in scrollable space.
Should you want to center to a location (px, py) expressed in a page space, you can use the following code:
//focus view.SetCurrentPage(page_num); view.ConvPagePtToScreenPt(px, py, page_num); view.SetZoom((int)px, (int)py, view.GetZoom()); //center int width = view.GetBufferWidth(); int height = view.GetBufferHeight(); int dx = (int)(px - (double)width/2 + 0.5); int dy = (int)(py - (double)height/2 + 0.5); view.OnScroll(dx, dy);
Declaration
Objective-C
- (void)SetVScrollPos:(double)pos;
Swift
func setVScrollPos(_ pos: Double)
Parameters
the
new vertical scroll position. The position should be in the range between 0 and GetCanvasheight().
-
Resize rendering buffer to new dimensions.
Note
this method is typically used only in PDFNet for C++Declaration
Objective-C
- (void)OnSize:(int)width height:(int)height;
Swift
func onSize(_ width: Int32, height: Int32)
Parameters
width
- The width of the target image in pixels.
height
- The height of the target image in pixels (the number of rows).
-
Declaration
Objective-C
- (BOOL)IsFinishedRendering:(BOOL)visible_region_only;
Swift
func isFinishedRendering(_ visible_region_only: Bool) -> Bool
Parameters
visible_region_only
- Specifies if the method refers only to currently visible content.
Return Value
true is the rendering thread finished rendering the view, false if the rendering is still in progress.
-
Cancels rendering in progress. If PDFView is not busy rendering the page, the function has no side effects.
Declaration
Objective-C
- (void)CancelRendering;
Swift
func cancelRendering()
-
Redraws the contents of the buffer.
Declaration
Objective-C
- (void)Update:(BOOL)all;
Swift
func update(_ all: Bool)
-
Updates the page layout within the view. This function must be called after document page sequence is modified (such as when a page is being added to or removed from a document) or after changes to page dimensions (e.g. after a page is rotated or resized).
Declaration
Objective-C
- (void)UpdatePageLayout;
Swift
func updatePageLayout()
-
Returns the pointer to the internal memory buffer containing the rasterized image of the given page. The buffer size is at least ‘GetBufferHeight*GetBufferStride’ bytes. The pixel data is stored in 8 bit per component, BGRA format.
Declaration
Objective-C
- (NSData *)GetBuffer;
Swift
func getBuffer() -> Data!
-
Update the internal memory buffer that can be returned by GetBuffer(). Since PDFView may not necessarily update the buffer until it finishes rendering the current viewing area, it is required to call UpdateBuffer() to force PDFView to write the current rasterized contents to the buffer. This is important for, say, calling GetBuffer() in a different thread to implement progressive rendering.
Note
UpdateBuffer() ensures thread safety internally. In addition, PDFView calls UpdateBuffer() internally before the user-defined finishing-rendering callback function (specified by SetRenderFinishProc) is called, if applicable. this method is typically used only in PDFNet for C++.Declaration
Objective-C
- (void)UpdateBuffer;
Swift
func updateBuffer()
-
Returns the width of the rendering buffer in pixels.
Note
this method is typically used only in PDFNet for C++Declaration
Objective-C
- (int)GetBufferWidth;
Swift
func getBufferWidth() -> Int32
-
Returns the width of the rendering buffer in pixels.
Note
this method is typically used only in PDFNet for C++Declaration
Objective-C
- (int)GetBufferHeight;
Swift
func getBufferHeight() -> Int32
-
Returns the stride of the rendering buffer in pixels.
Note
this method is typically used only in PDFNet for C++Declaration
Objective-C
- (int)GetBufferStride;
Swift
func getBufferStride() -> Int32
-
Disable rendering of a particular annotation. This does not change the annotation itself, just how it is displayed in this viewer instance.
Declaration
Objective-C
- (void)HideAnnotation:(PTAnnot *)annot;
Swift
func hideAnnotation(_ annot: PTAnnot!)
Parameters
annot
The annotation object to cease drawing for.
-
Enable or disable annotation and forms rendering. By default, all annotations and form fields are rendered.
Declaration
Objective-C
- (void)SetDrawAnnotations:(BOOL)render_annots;
Swift
func setDrawAnnotations(_ render_annots: Bool)
Parameters
render_annots
True to draw annotations, false otherwise.
-
Enables or disables URL extraction.
@default by default URL extraction is disabled
Note
If set to enabled when the document is already opened, it may not find links on pages that were already rendered. It is suggested to set this flag before opening the document.Declaration
Objective-C
- (void)SetUrlExtraction:(BOOL)enabled;
Swift
func setUrlExtraction(_ enabled: Bool)
Parameters
enabled
if true URL extraction is enabled, if false URL extraction is disabled.
-
Gets the link info at a given point, specified in client space.
Note
To get valid links, SetUrlExtraction(boolean) must be set to true before opening the document.
Declaration
Objective-C
- (PTLinkInfo *)GetLinkAt:(int)x y:(int)y;
Swift
func getLinkAt(_ x: Int32, y: Int32) -> PTLinkInfo!
Parameters
x
the x position in client space
y
the y position in client space
Return Value
the LinkInfo object with the link information or null if no link is found in the queried location.
-
Set the highlight color for required fields
This option only has an effect if field highlighting is turned on using
SetHighlightFields(true)
. Note that signature fields have their own highlight color, independent of this one (seesetSignatureHighlightColor
).Declaration
Objective-C
- (void)SetFieldHighlightColor:(PTColorPt *)new_field_highlight_color;
Swift
func setFieldHighlightColor(_ new_field_highlight_color: PTColorPt!)
Parameters
new_field_highlight_color
the new highlight color, in rgba form.
-
Enable or disable highlighting form fields. Default is disabled.
Declaration
Objective-C
- (void)SetHighlightFields:(BOOL)highlight_fields;
Swift
func setHighlightFields(_ highlight_fields: Bool)
Parameters
highlight_fields
true to highlight, false otherwise.
-
Set the border color for required fields
This option only has an effect if field highlighting is turned on using
SetHighlightFields(true)
.Declaration
Objective-C
- (void)SetRequiredFieldBorderColor:(PTColorPt *)new_border_color;
Swift
func setRequiredFieldBorderColor(_ new_border_color: PTColorPt!)
Parameters
new_border_color
the new border color, in rgba form.
-
Set the highlight color for signature fields
This option only has an effect if field highlighting is turned on using
SetHighlightFields(true)
. Note that non-signature fields have their own highlight color, independent of this one (seesetFieldHighlightColor
)Declaration
Objective-C
- (void)SetSignatureHighlightColor:(PTColorPt *)new_signature_pthighlight_color;
Swift
func setSignatureHighlightColor(_ new_signature_pthighlight_color: PTColorPt!)
Parameters
new_signature_highlight_color
the new signature highlight color, in rgba form.
-
Enable or disable anti-aliasing.
Anti-Aliasing is a technique used to improve the visual quality of images when displaying them on low resolution devices (for example, low DPI computer monitors).
@default Anti-aliasing is enabled by default.
Declaration
Objective-C
- (void)SetAntiAliasing:(BOOL)enable_aa;
Swift
func setAntiAliasing(_ enable_aa: Bool)
-
Enable or disable path hinting.
Declaration
Objective-C
- (void)SetPathHinting:(BOOL)enable_hinting;
Swift
func setPathHinting(_ enable_hinting: Bool)
Parameters
enable_hinting
if true path hinting is enabled. Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements. This option is turned on by default.
-
Set thin line adjustment parameters.
Declaration
Objective-C
- (void)SetThinLineAdjustment:(BOOL)pixel_grid_fit stroke_adjust:(BOOL)stroke_adjust;
Swift
func setThinLineAdjustment(_ pixel_grid_fit: Bool, stroke_adjust: Bool)
Parameters
pixel_grid_fit
if true (horizontal/vertical) thin lines will be snapped to integer pixel positions. This helps make thin lines look sharper and clearer. This option is turned off by default and it only works if path hinting is enabled.
stroke_adjust
if true auto stroke adjustment is enabled. Currently, this would make lines with sub-pixel width to be one-pixel wide. This option is turned on by default.
-
Enable or disable image smoothing.
The rasterizer allows a trade-off between rendering quality and rendering speed. This function can be used to indicate the preference between rendering speed and quality.
Note
image smoothing option has effect only if the source image has higher resolution that the output resolution of the image on the rasterized page. PDFNet automatically controls at what resolution/zoom factor, ‘image smoothing’ needs to take effect.
Declaration
Objective-C
- (void)SetImageSmoothing:(BOOL)smoothing_enabled;
Swift
func setImageSmoothing(_ smoothing_enabled: Bool)
Parameters
smoothing_enabled
True to enable image smoothing, false otherwise. @default image smoothing is enabled.
-
Enables of disables caching of images, fonts, and other resources. Disabling caching can lower memory requirements at the expense of rendering speed.
Declaration
Objective-C
- (void)SetCaching:(BOOL)enabled;
Swift
func setCaching(_ enabled: Bool)
Parameters
enabled
if true caching is enabled, if false caching is disabled. @default by default caching is enabled
-
Sets the core graphics library used for rasterization and rendering. Using this method it is possible to quickly switch between different implementations. By default, PDFNet uses a built-in, high-quality, and platform independent rasterizer.
Declaration
Objective-C
- (void)SetRasterizerType:(PTRasterizerType)type;
Swift
func setRasterizerType(_ type: PTRasterizerType)
Parameters
type
Rasterizer type.
-
Sets the gamma factor used for anti-aliased rendering.
Gamma correction can be used to improve the quality of anti-aliased image output and can (to some extent) decrease the appearance common anti-aliasing artifacts (such as pixel width lines between polygons).
Note
Gamma correction is used only in the built-in rasterizer.Declaration
Objective-C
- (void)SetGamma:(double)exp;
Swift
func setGamma(_ exp: Double)
Parameters
exp
is the exponent value of gamma function. Typical values are in the range from 0.1 to 3.
-
Enable or disable support for overprint and overprint simulation. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc).
@default By default overprint is only enabled for PDF/X files.
Declaration
Objective-C
- (void)SetOverprint:(PTOverprintPreviewMode)op;
Swift
func setOverprint(_ op: PTOverprintPreviewMode)
Parameters
op
e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only.
-
Sets the Optional Content Group (OCG) context that should be used when viewing the document. This function can be used to change the current OCG context. Optional content (such as PDF layers) will be selectively rendered based on the states of optional content groups in the given context.
Note
Unlike PDFDraw.SetOCGContext() this method copies the given context. As a result, in order to modify the state of OCG groups in the current context use GetOCGContext() to obtain the currently selected content and then modify states.
Declaration
Objective-C
- (void)SetOCGContext:(PTContext *)ctx;
Swift
func setOCGContext(_ ctx: PTContext!)
Parameters
ctx
Optional Content Group (OCG) context, or NULL if the rasterizer should render all content on the page.
-
Return Value
the Optional Content Group (OCG) context associated with this PDFView, or NULL (i.e. context.IsValid()==false) if there is no OCG context associated with the view. If an OCG context associated with the view, optional content (such as PDF layers) will be selectively rendered based on the states of optional content groups in the given context.
-
Prompts the PDFViewCtrl to update its list of optional content groups. Call this method if you modify the PDFDoc in a way that adds or removes a layer. For example, after using Stamper to create a stamp.
Declaration
Objective-C
- (void)UpdateOCGContext;
Swift
func updateOCGContext()
-
Set a callback function that can be used to notify the client that PDFView is about to start rendering and modifying the contents of the rendering buffer.
Note
this method is available only in the C++ SDK and not available in pre-packaged PDF viewing controls (.NET/Java/ActiveX).
Declaration
Objective-C
- (void)SetRenderBeginProc:(PTCallback *)instance;
Swift
func setRenderBeginProc(_ instance: PTCallback!)
Parameters
proc
A callback function that will be called just before PDFView starts rendering.
data
Custom data to be passed as a parameter to ‘proc’.
-
Set a callback function that can be used to notify the client that PDFView finished rendering and modifying the contents of the rendering buffer.
Note
this method is available only in the C++ SDK and is not available in pre-packaged PDF viewing controls (.NET/Java/ActiveX).
Declaration
Objective-C
- (void)SetRenderFinishProc:(PTCallback *)instance;
Swift
func setRenderFinishProc(_ instance: PTCallback!)
Parameters
proc
A callback function that will be called after PDFView is done with rendering.
data
Custom data to be passed as a parameter to ‘proc’.
-
Sets the selection mode used for text highlighting.
Declaration
Objective-C
- (void)SetTextSelectionMode:(PTTextSelectionMode)tm;
Swift
func setTextSelectionMode(_ tm: PTTextSelectionMode)
Parameters
tm
the text selection mode.
-
Declaration
Objective-C
- (PTTextSelectionMode)GetTextSelectionMode;
Swift
func getTextSelectionMode() -> PTTextSelectionMode
Return Value
the current selection mode used for text highlighting.
-
Undocumented
Declaration
Objective-C
- (BOOL)SelectWithTextSelect: (double)x1 y1: (double)y1 x2: (double)x2 y2: (double)y2;
Swift
func select(withTextSelect x1: Double, y1: Double, x2: Double, y2: Double) -> Bool
-
Undocumented
Declaration
Objective-C
- (BOOL)SelectWithSnapping: (double)x1 y1: (double)y1 x2: (double)x2 y2: (double)y2 snap_to_start: (BOOL)snap_to_start snap_to_end: (BOOL)snap_to_end;
Swift
func select(withSnapping x1: Double, y1: Double, x2: Double, y2: Double, snap_to_start: Bool, snap_to_end: Bool) -> Bool
-
Undocumented
Declaration
Objective-C
- (BOOL)SelectWithSmartSnapping: (double)x1 y1: (double)y1 x2: (double)x2 y2: (double)y2;
Swift
func select(withSmartSnapping x1: Double, y1: Double, x2: Double, y2: Double) -> Bool
-
Undocumented
Declaration
Objective-C
- (BOOL)SelectWithStructure: (double)x1 y1: (double)y1 page1: (int)page1 x2: (double)x2 y2: (double)y2 page2: (int)page2;
Swift
func select(withStructure x1: Double, y1: Double, page1: Int32, x2: Double, y2: Double, page2: Int32) -> Bool
-
Undocumented
Declaration
Objective-C
- (BOOL)SelectWithHighlights: (PTHighlights*)highlights;
Swift
func select(with highlights: PTHighlights!) -> Bool
-
Undocumented
Declaration
Objective-C
- (BOOL)SelectWithSelection: (PTSelection*)select;
Swift
func select(with select: PTSelection!) -> Bool
-
Undocumented
Declaration
Objective-C
- (void)CancelFindText;
Swift
func cancelFindText()
-
Undocumented
Declaration
Objective-C
- (void)SelectAll;
Swift
func selectAll()
-
Undocumented
Declaration
Objective-C
- (BOOL)HasSelection;
Swift
func hasSelection() -> Bool
-
Undocumented
Declaration
Objective-C
- (void)ClearSelection;
Swift
func clearSelection()
-
Undocumented
Declaration
Objective-C
- (PTSelection*)GetSelection: (int)pagenum;
Swift
func getSelection(_ pagenum: Int32) -> PTSelection!
-
Undocumented
Declaration
Objective-C
- (int)GetSelectionBeginPage;
Swift
func getSelectionBeginPage() -> Int32
-
Undocumented
Declaration
Objective-C
- (int)GetSelectionEndPage;
Swift
func getSelectionEndPage() -> Int32
-
Undocumented
Declaration
Objective-C
- (BOOL)HasSelectionOnPage: (int)ipage;
Swift
func hasSelection(onPage ipage: Int32) -> Bool
-
Undocumented
Declaration
Objective-C
- (void)PrepareWords: (int)page_num;
Swift
func prepareWords(_ page_num: Int32)
-
Undocumented
Declaration
Objective-C
- (BOOL)WereWordsPrepared: (int)page_num;
Swift
func wereWordsPrepared(_ page_num: Int32) -> Bool
-
Undocumented
Declaration
Objective-C
- (BOOL)IsThereTextInRect: (double)x1 y1: (double)y1 x2: (double)x2 y2: (double)y2;
Swift
func isThereText(inRect x1: Double, y1: Double, x2: Double, y2: Double) -> Bool
-
Undocumented
Declaration
Objective-C
- (void)PrepareAnnotsForMouse: (int)page_num distance_threshold: (double)distance_threshold minimum_line_weight: (double)minimum_line_weight;
Swift
func prepareAnnots(forMouse page_num: Int32, distance_threshold: Double, minimum_line_weight: Double)
-
Undocumented
Declaration
Objective-C
- (BOOL)WereAnnotsForMousePrepared: (int)page_num;
Swift
func wereAnnots(forMousePrepared page_num: Int32) -> Bool
-
Undocumented
Declaration
Objective-C
- (PTAnnotType)GetAnnotTypeUnder: (double)x y: (double)y;
Swift
func getAnnotTypeUnder(_ x: Double, y: Double) -> PTAnnotType
-
Undocumented
Declaration
Objective-C
- (void)SetPageBorderVisibility: (BOOL)border_visible;
Swift
func setPageBorderVisibility(_ border_visible: Bool)
-
Undocumented
Declaration
Objective-C
- (void)SetPageTransparencyGrid: (BOOL)trans_grid_visible;
Swift
func setPageTransparencyGrid(_ trans_grid_visible: Bool)
-
Undocumented
Declaration
Objective-C
- (void)SetDefaultPageColor: (unsigned char)r g: (unsigned char)g b: (unsigned char)b;
Swift
func setDefaultPageColor(_ r: UInt8, g: UInt8, b: UInt8)
-
Undocumented
Declaration
Objective-C
- (void)SetBackgroundColor: (unsigned char)r g: (unsigned char)g b: (unsigned char)b a: (unsigned char)a;
Swift
func setBackgroundColor(_ r: UInt8, g: UInt8, b: UInt8, a: UInt8)
-
Undocumented
Declaration
Objective-C
- (void)SetHorizontalAlign: (int)align;
Swift
func setHorizontalAlign(_ align: Int32)
-
Undocumented
Declaration
Objective-C
- (void)SetVerticalAlign: (int)align;
Swift
func setVerticalAlign(_ align: Int32)
-
Undocumented
Declaration
Objective-C
- (void)SetPageSpacing: (int)horiz_col_space vert_col_space: (int)vert_col_space horiz_pad: (int)horiz_pad vert_pad: (int)vert_pad;
Swift
func setPageSpacing(_ horiz_col_space: Int32, vert_col_space: Int32, horiz_pad: Int32, vert_pad: Int32)
-
Undocumented
Declaration
Objective-C
- (void)SetDevicePixelDensity: (double)dpi scale_factor: (double)scale_factor;
Swift
func setDevicePixelDensity(_ dpi: Double, scale_factor: Double)
-
Undocumented
Declaration
Objective-C
- (void)SetPageViewMode: (PTPageViewMode)mode;
Swift
func setPageViewMode(_ mode: PTPageViewMode)
-
Undocumented
Declaration
Objective-C
- (PTPageViewMode)GetPageViewMode;
Swift
func getPageViewMode() -> PTPageViewMode
-
Undocumented
Declaration
Objective-C
- (void)RefreshAndUpdate: (PTViewChangeCollection*)view_change;
Swift
func refreshAndUpdate(_ view_change: PTViewChangeCollection!)
-
Undocumented
Declaration
Objective-C
- (void)SetPageRefViewMode: (PTPageViewMode)mode;
Swift
func setPageRefViewMode(_ mode: PTPageViewMode)
-
Undocumented
Declaration
Objective-C
- (PTPageViewMode)GetPageRefViewMode;
Swift
func getPageRefViewMode() -> PTPageViewMode
-
-SetupThumbnails:generate_at_runtime:use_disk_cache:thumb_max_side_length:max_abs_cache_size:max_perc_cache_size:
Undocumented
Declaration
Objective-C
- (void)SetupThumbnails: (BOOL)use_embedded generate_at_runtime: (BOOL)generate_at_runtime use_disk_cache: (BOOL)use_disk_cache thumb_max_side_length: (int)thumb_max_side_length max_abs_cache_size: (unsigned long)max_abs_cache_size max_perc_cache_size: (double)max_perc_cache_size;
Swift
func setupThumbnails(_ use_embedded: Bool, generate_at_runtime: Bool, use_disk_cache: Bool, thumb_max_side_length: Int32, max_abs_cache_size: UInt, max_perc_cache_size: Double)
-
Undocumented
Declaration
Objective-C
- (void)ClearThumbCache;
Swift
func clearThumbCache()
-
Undocumented
Declaration
Objective-C
- (void)GetThumbAsync: (int)page_num instance: (PTCallback*)instance;
Swift
func getThumbAsync(_ page_num: Int32, instance: PTCallback!)
-
Undocumented
Declaration
Objective-C
- (unsigned long)GetThumbInCacheSize: (int)page_num;
Swift
func getThumbInCacheSize(_ page_num: Int32) -> UInt
-
Undocumented
Declaration
Objective-C
- (BOOL)GetThumbInCache: (int)page_num buf: (NSData*)buf out_width: (inout uint32_t *)out_width out_height: (inout uint32_t *)out_height;
Swift
func getThumbInCache(_ page_num: Int32, buf: Data!, out_width: UnsafeMutablePointer<UInt32>!, out_height: UnsafeMutablePointer<UInt32>!) -> Bool
-
Undocumented
Declaration
Objective-C
- (void)CancelAllThumbRequests;
Swift
func cancelAllThumbRequests()
-
Undocumented
Declaration
Objective-C
- (void)SetRequestRenderInWorkerThreadProc: (PTCallback*)instance;
Swift
func setRequestRender(inWorkerThreadProc instance: PTCallback!)
-
Undocumented
Declaration
Objective-C
- (void)SetFindTextHandler: (PTCallback*)instance;
Swift
func setFindTextHandler(_ instance: PTCallback!)
-
Undocumented
Declaration
Objective-C
- (void)FindTextAsync: (NSString *)search_str match_case: (BOOL)match_case match_whole_word: (BOOL)match_whole_word search_up: (BOOL)search_up reg_exp: (BOOL)reg_exp;
Swift
func findTextAsync(_ search_str: String!, match_case: Bool, match_whole_word: Bool, search_up: Bool, reg_exp: Bool)
-
Undocumented
Declaration
Objective-C
- (void)EnableUndoRedo;
Swift
func enableUndoRedo()
-
Undocumented
Declaration
Objective-C
- (NSString *)Undo;
Swift
func undo() -> String!
-
Undocumented
Declaration
Objective-C
- (NSString *)Redo;
Swift
func redo() -> String!
-
Undocumented
Declaration
Objective-C
- (void)TakeSnapshot: (NSString *)meta_info;
Swift
func takeSnapshot(_ meta_info: String!)
-
Undocumented
Declaration
Objective-C
- (NSString *)GetNextUndoInfo;
Swift
func getNextUndoInfo() -> String!
-
Undocumented
Declaration
Objective-C
- (NSString *)GetNextRedoInfo;
Swift
func getNextRedoInfo() -> String!
-
Undocumented
Declaration
Objective-C
- (BOOL)CanUndo;
Swift
func canUndo() -> Bool
-
Undocumented
Declaration
Objective-C
- (BOOL)CanRedo;
Swift
func canRedo() -> Bool
-
Undocumented
Declaration
Objective-C
- (void)RevertAllChanges;
Swift
func revertAllChanges()
-
Undocumented
Declaration
Objective-C
- (PTExternalAnnotManager*)GetExternalAnnotManager: (NSString *)author mode: (PTExternalAnnotManagerMode)mode;
Swift
func getExternalAnnotManager(_ author: String!, mode: PTExternalAnnotManagerMode) -> PTExternalAnnotManager!
-
Undocumented
Declaration
Objective-C
- (BOOL)DownloaderUpdatePage: (void *)doc page_num: (unsigned int)page_num obj_num: (unsigned int)obj_num;
Swift
func downloaderUpdatePage(_ doc: UnsafeMutableRawPointer!, page_num: UInt32, obj_num: UInt32) -> Bool
-
Undocumented
Declaration
Objective-C
- (void)DownloaderUpdateOutline: (void *)doc;
Swift
func downloaderUpdateOutline(_ doc: UnsafeMutableRawPointer!)
-
Undocumented
Declaration
Objective-C
- (void)DownloaderUpdateThumb: (void *)doc page_num: (unsigned int)page_num obj_num: (unsigned int)obj_num;
Swift
func downloaderUpdateThumb(_ doc: UnsafeMutableRawPointer!, page_num: UInt32, obj_num: UInt32)
-
Undocumented
Declaration
Objective-C
- (void)DownloaderFinishedDownload: (void *)doc;
Swift
func downloaderFinishedDownload(_ doc: UnsafeMutableRawPointer!)
-
Undocumented
Declaration
Objective-C
- (BOOL)DownloaderIsCorrectDoc: (void *)doc;
Swift
func downloaderIsCorrectDoc(_ doc: UnsafeMutableRawPointer!) -> Bool
-
Undocumented
Declaration
Objective-C
- (void)DownloaderInitialized: (void *)doc;
Swift
func downloaderInitialized(_ doc: UnsafeMutableRawPointer!)
-
Undocumented
Declaration
Objective-C
- (void)OpenURLAsync: (NSString *)url cache_file: (NSString *)cache_file password: (NSString *)password options: (PTHTTPRequestOptions*)options;
Swift
func openURLAsync(_ url: String!, cache_file: String!, password: String!, options: PTHTTPRequestOptions!)
-
Sets structural selection to work in right-to-left language mode.
Declaration
Objective-C
- (void)SetRightToLeftLanguage:(BOOL)flag;
Swift
func setRightToLeftLanguage(_ flag: Bool)
Parameters
flag
Set to true if the language is right to left.
-
Undocumented
Declaration
Objective-C
- (void)PushViewingStates;
Swift
func pushViewingStates()
-
Undocumented
Declaration
Objective-C
- (void)PopViewingStates: (BOOL)restore;
Swift
func popViewingStates(_ restore: Bool)
-
Undocumented
Declaration
Objective-C
- (void)SetFreezeTile: (BOOL)freeze;
Swift
func setFreezeTile(_ freeze: Bool)
-
Undocumented
Declaration
Objective-C
- (int)GetCurCanvasId;
Swift
func getCurCanvasId() -> Int32
-
Undocumented
Declaration
Objective-C
- (void)GetPageRectsOnCanvas: (NSMutableArray*)page_rects_info canvasNumber: (int)canvasNumber;
Swift
func getPageRects(onCanvas page_rects_info: NSMutableArray!, canvasNumber: Int32)
-
Undocumented
Declaration
Objective-C
- (double)GetRefZoomForPage: (PTPageViewMode)viewMode pageNum: (int)pageNum;
Swift
func getRefZoom(forPage viewMode: PTPageViewMode, pageNum: Int32) -> Double
-
Undocumented
Declaration
Objective-C
- (void)DoProgressiveRender;
Swift
func doProgressiveRender()
-
Undocumented
Declaration
Objective-C
- (int)GetCellSideLength;
Swift
func getCellSideLength() -> Int32
-
Undocumented
Declaration
Objective-C
- (double)GetPageVGap;
Swift
func getPageVGap() -> Double
-
Undocumented
Declaration
Objective-C
- (double)GetPageHGap;
Swift
func getPageHGap() -> Double
-
Undocumented
Declaration
Objective-C
- (void)RequestRender;
Swift
func requestRender()
-
Undocumented
Declaration
Objective-C
- (void)PurgeMemory;
Swift
func purgeMemory()
-
Undocumented
Declaration
Objective-C
- (void)SetMemInfo: (double)total_mem mem_cap: (double)mem_cap;
Swift
func setMemInfo(_ total_mem: Double, mem_cap: Double)
-
Undocumented
Declaration
Objective-C
- (void)SetWrapperAnnotBitmapProc: (PTCallback*)instance mode: (PTAnnotVectorMode)mode;
Swift
func setWrapperAnnotBitmapProc(_ instance: PTCallback!, mode: PTAnnotVectorMode)
-
Undocumented
Declaration
Objective-C
- (void)SetWrapperCreateTileProc: (PTCallback*)instance;
Swift
func setWrapperCreateTileProc(_ instance: PTCallback!)
-
Undocumented
Declaration
Objective-C
- (void)SetWrapperDeluxeCreateTileProc: (PTCallback*)instance;
Swift
func setWrapperDeluxeCreateTileProc(_ instance: PTCallback!)
-
Undocumented
Declaration
Objective-C
- (void)SetWrapperRemoveTileProc: (PTCallback*)instance;
Swift
func setWrapperRemoveTileProc(_ instance: PTCallback!)
-
Undocumented
Declaration
Objective-C
- (void)SetPartDownloadedProc: (PTCallback*)instance;
Swift
func setPartDownloadedProc(_ instance: PTCallback!)