@mescius/dspdfviewer
Version:
Document Solutions PDF Viewer
892 lines (845 loc) • 155 kB
Markdown
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [8.0.6] - 2-Apr-2025
### Added
- Option to send PDFs containing pages with different orientations to the browser print preview as a single job. (DOC-6854)
```javascript
// Enable single print job mode to force all pages to be printed together:
var viewer = new DsPdfViewer("#root", {
printSingleJobMode: true
});
```
### Fixed
- [Wasm] Position of annotations changes when saving the document using Wasm support API. (DOC-6848)
## [8.0.5] - 20-Mar-2025
### Added
- Added support for cancelling the onBeforeOpen event. (DOC-6755)
### Fixed
- [Regression since v8.0.4] Loading PDFs is very slow in FireFox browser. (DOC-6814)
- Typings of modules i18next and moment are missing in DsPdfViewer installation. (DOC-6778)
- The viewer zoom factor changes when the layout mode is changed. (DOC-6554)
- 'TypeError: Cannot read properties of null' can occur in specific scenarios. (DOC-6846)
## [8.0.4] - 27-Feb-2025
### Changed
- [Reply Tool] Enabled adding replies and statuses to locked annotations. (DOC-6773)
### Fixed
- [Reply Tool] Fixed a permission check issue when deleting a reply using the Delete key. (DOC-6773)
- TypeError when clicking on the page with ReplyTool enabled. (DOC-6753)
- DsPdfViewer container element does not scroll if there is no PDF in the viewer. (DOC-6766)
- [API Docs] Some code examples formatting is incorrect. (DOC-6768, DOC-6769, DOC-6772)
- [iOS 17] Specific PDF fails to load on iOS 17.5 (loads fine on iOS 18.0 and above). (DOC-6724)
## [8.0.3] - 09-Feb-2025
### Added
- [Reply Tool] Automatic focusing on the clicked annotation in the replies list. Now, when you click on an annotation, the corresponding entry in the replies list will be focused and brought into view.
- [Reply Tool] Added new Reply Tool event bus events. (DOC-6732)
- replytool-before-delete: triggered before an annotation is deleted using the Reply Tool. This event is cancelable, allowing prevention of deletion.
- replytool-before-scrollintoview: triggered before the Reply Tool scrolls to a reply item’s HTML element. This event is cancelable, enabling control over the scrolling behavior.
- replytool-text-label-click: triggered when the user clicks a text label, before executing the associated Reply Tool actions (e.g., displaying the inline text editor for editable annotations). This event is cancelable, allowing customization or prevention of the default behavior.
- replytool-item-click: triggered when the user clicks a list item in the Reply Tool, either a parent note item or a reply item. The event can be canceled by setting the cancel property of the event arguments object to true.
- replytool-item-keydown: triggered when the user presses a key while a list item in the Reply Tool is focused (either a parent note item or a reply item). The event can be canceled by setting the cancel property of the event arguments object to true, preventing the default Reply Tool behavior.
- replytool-placeholder-activate: triggered when the user activates the reply placeholder by clicking on it or pressing any key while it is focused. The event can be canceled by setting the cancel property of the event arguments object to true, preventing the default Reply Tool behavior (e.g., opening the reply editor).
- replytool-author-label-click: triggered when the user clicks the author label, before executing the associated Reply Tool actions (e.g., opening the inline text editor for editable annotations). The event can be canceled to prevent the default behavior.
- replytool-item-status-change: triggered when the user changes the status of a reply annotation. It can be canceled by setting args.cancel to true. The event also allows overriding the target annotation using args.annotation or modifying the status via args.status. Possible statuses: 'None', 'Accepted', 'Cancelled', 'Completed', 'Rejected'.
- replytool-post-reply: triggered when the user adds a reply annotation via the "Post Reply" button or by pressing Ctrl+Enter after editing the reply text. The event can be canceled by setting args.cancel to true and allows modifying the reply annotation using args.annotation.
```javascript
// Example:
viewer.eventBus.on("replytool-before-delete", function(args) {
// Check if the entire annotation is being deleted (not just a comment)
if (!args.removeCommentOnly) {
// Confirm deletion with the user
if (!confirm("Are you sure you want to delete the annotation with ID " + args.annotation.id + "?")) {
// Cancel the deletion if the user declines
args.cancel = true;
}
}
});
```
- Added annotationFilter option for Reply Tool.
Allows customizing which annotations are displayed in the Reply Tool by providing a filter function.
```javascript
// Example: show only text annotations in the Reply Tool
var viewer = new DsPdfViewer("#root", {
replyTool: {
annotationFilter: (annotation) => annotation.annotationType === 1 // AnnotationType.TEXT
}
});
```
### Changed
- JPN localization updated. (DOC-6727)
- [Reply Tool] Improved behavior for annotations without comments. (DOC-6718)
- The "Add a comment..." placeholder is now hidden unless the annotation is selected or focused.
### Fixed
- Incorrect document display at high zoom values. (DOC-6728)
- [Reply Tool] Incorrect position of timestamp for the reply in the Reply Tool panel. (DOC-6716)
- [Reply Tool] The comment popup behaves incorrectly if the Reply Tool and other toolbars are used together. (DOC-6729)
- [Reply Tool] Issues with styling in Dark and Dark-Yellow Themes. (DOC-6737)
- [Reply Tool] Inconsistent behavior when deleting comments for annotations other than sticky notes. (DOC-6735)
- [Layers] Incorrect display of PDF layers in some cases. (DOC-6733)
## [8.0.1] - 25-Dec-2024
### Added
- Added text selection capability to FreeText annotations. (DOC-6659)
### Fixed
- Proximity search like [“My favorite” ONear(1) "is" ONear(5)"."] does not work as expected. (DOC-6579)
- Open search panel stops working when another document is picked from the document list. (DOC-6666)
- The same text can be replaced several times. (DOC-6674)
## [8.0.0] - 03-Dec-2024
### Added
- Added text replace feature: use Ctrl+H to open the search bar in replace mode, or click the expand button in the search bar to toggle between search and replace modes. (DOC-5200)
- Added display of timestamps in user comments. (DOC-6233)
- [Reply Tool] Added useRelativeDates and dateFormat options. (DOC-6586)
```javascript
// Example 1: Disable relative dates and use absolute dates instead.
var viewer = new DsPdfViewer("#root", { replyTool: { useRelativeDates: false } });
// Example 2: Use a custom format for absolute dates.
var viewer = new DsPdfViewer("#root", { replyTool: { useRelativeDates: false, dateFormat: "yyyy.mm.dd HH:MM" } });
```
- Added hidePopupTimestamp option. (DOC-6587)
### Changed
- Enhanced proximity search with support for NEAR and ONEAR operators, added the ability to quote phrases for "full phrase" proximity search. (DOC-6390)
### Fixed
- [CommentTimeStamp] Incorrect handling of future dates in relative date formatting. (DOC-6588)
## [7.2.4] - 23-Oct-2024
### Added
- Enabled two-finger scrolling while drawing ink annotations. (DOC-6537)
### Fixed
- Save as SVG dialog message is not JPN localized. (DOC-6557)
- Using Ctrl+R to refresh the page is always handled by DsPdfViewer. (DOC-6548)
## [7.2.3] - 02-Oct-2024
### Changed
- JPN localization updated. (DOC-6514)
## [7.2.2] - 19-Sep-2024
### Changed
- The updateAnnotation and addAnnotation methods will now throw an error if the provided annotation object is improperly formed and cannot be used. (DOC-6506)
- [Documentation] The gcProps property has been moved from the base AnnotationBase class to the more specific WidgetAnnotation class. (DOC-6506)
### Fixed
- The behavior is inconsistent when double-clicking a redact annotation. (DOC-6503)
- [iOS] Cannot scroll by swiping while entering ink annotations. (DOC-6501)
## [7.2.1] - 28-Aug-2024
### Added
- Added the ability to create field widgets with the same name, enabling such widgets to update their values simultaneously. (DOC-6461)
- Added new API method repaintTextLayer for efficiently repainting text selection and highlighting elements on visible pages.
- Added highlightTextSegment method to enable highlighting specific text segments on a page with customizable options for color and style.
- Added clearHighlightedSegments method to remove all custom text highlights from a specified page.
- Added `newDocumentFileName` option to specify the default file name when creating new documents in the viewer. This is distinct from `friendlyFileName`, which names existing documents.
### Fixed
- [Wasm] Save API method did not recognize spaces as separators (commas worked fine). (DOC-6425)
- Unexpected content appears in a form field. (DOC-6420)
- Input widgets associated with the same field behave incorrectly. (DOC-6412, DOC-6415)
- Part of a combo text box's content is lost. (DOC-6356)
- [Form Editor] Cannot create multiple input fields with same name. (DOC-6416)
- In two pages side by side view, PageWidth zoom mode scales to single page width. (DOC-6476)
- Data using time format is not rendered correctly. (DOC-6482)
- Markup shows at incorrect locations in some browsers. (DOC-6474)
## [7.2.0] - 07-Aug-2024
### Added
- Added Wasm SupportApi option, it enables PDF editing features on the client without connecting to SupportApi/DsPdf on a server.
```javascript
// Example: use client-side Wasm SupportApi:
function loadPdfViewer(selector) {
var viewer = new DsPdfViewer(selector, {
supportApi: {
implementation: new WasmSupportApi()
}
});
viewer.addDefaultPanels();
viewer.addAnnotationEditorPanel();
viewer.addFormEditorPanel();
}
```
- Added registerFont method: registers a new @font-face style with the given font name and URL.
Supported font formats include "ttf", "otf", "woff" and "woff2" ("woff2" is not supported by the Wasm SupportApi).
```javascript
// Example 1: Registering a font with name and URL
viewer.registerFont('CustomFont', 'https://example.com/fonts/customfont.woff');
// Example 2: Registering a font with name, URL, and format
viewer.registerFont('AnotherFont', 'https://example.com/fonts/anotherfont.ttf', 'ttf');
```
- Added registerFallbackFont method: registers a fallback font that SupportApi will use when searching for fallback fonts.
Supported font formats include "ttf", "otf", "woff", and "ttc". Font collections in "ttc" format are also supported.
```javascript
// Example 1: Registering a fallback font with URL:
viewer.registerFallbackFont('https://example.com/fonts/fallbackfont.ttf');
// Example 2: Registering a fallback font with name and URL:
viewer.registerFallbackFont('SampleFont', 'https://example.com/fonts/SampleFont.woff');
```
- Added support for the standard "Zapf Dingbats" font, which can now be selected for text fields and free text annotations.
- Added a "Save As" button with the toolbar button key "save-as".
Use the "Save As" button to export the PDF document to various formats (PDF, PNG, SVG).
The old "Save" and "Save as images" buttons have been removed from the default toolbar layout.
- Added the ability to export a PDF document to SVG images.
- Added extended support for pageLayout mode based on initial viewer preferences specified in a PDF document.
The following pageLayout values specified in the PDF correspond to pageDisplay values in the viewer:
* TwoColumnLeft: sets pageDisplay to TwoPageScrolling.
* TwoColumnRight: sets pageDisplay to TwoPageScrolling.
* TwoPageLeft: sets pageDisplay to TwoPage.
* TwoPageRight: sets pageDisplay to TwoPage.
* OneColumn: sets pageDisplay to SinglePageScrolling.
* SinglePage: sets pageDisplay to SinglePage.
- Added support for an ECMAScript action that can be performed before the field is formatted to display its value. (DOC-5643)
- Added support for two pages side by side view. (DOC-6063)
### Changed
- The standard "Symbol" font now saves correctly and displays properly in most PDF viewers.
- [Toolbar] The "View Mode" button has been replaced with the "Page Display" dropdown menu. (DOC-6063)
- [Text Tools] Added the ability to create text markup annotations directly from selected text when text is selected.
### Fixed
- [PDF Organizer] Page ranges were not created in some scenarios. (DOC-6345)
## [7.1.4] - 23-Jul-2024
### Added
- Added progress bar for long-running "Save as Images" operations, with the ability to cancel the current operations. (DOC-6301)
- JPN localization. (DOC-6297)
### Fixed
- [Regression since v7.1.3] Saved PDF file name is different from the argument passed to the viewer.save() API. (DOC-6374)
- [macOS] Comment cannot be deleted with Delete key on macOS. (DOC-6152)
- Incorrect content of PDF while previewing on Ionic Modal. (DOC-6209)
## [7.1.3] - 25-Jun-2024
### Fixed
- Thumbnails are not shown when exiting full screen mode with 'NonFullScreenPageMode' set to 'UseThumbs'. (DOC-6293)
- [PDF.js vulnerability] Malicious JavaScript can run in PDF viewer's WebWorker via crafted PDF file. (DOC-6248)
### Changed
- The required version of SupportApi has been changed to v7.1.3.
## [7.1.2] - 27-May-2024
### Fixed
- Cannot save a PDF if its name contains certain non-Latin characters. (DOC-6222)
- Localization doesn't work when the specified language is not all in lowercase. (DOC-6230)
- Full-screen mode incorrectly enabled for some PDFs without full-screen mode preference. (DOC-6243)
## [7.1.1] - 23-Apr-2024
### Fixed
- Cannot edit password-protected PDF when copying content is disabled. (DOC-6116)
- Comment added in the comment panel is not wrapped. (DOC-6134)
- Incorrect resize bar position. (DOC-6188)
- Auto-sized font appears larger than the required font size in some PDFs (additional fixes). (DOC-6029)
- [Collaboration] Only one page of a newly created PDF is shared. (DOC-4143)
## [7.1.0] - 04-Apr-2024
### Fixed
- Cannot submit comment by pressing the Enter kay on the 'Done' button. (DOC-6109)
- Issues with loading large files. (DOC-6080, DOC-6082)
- Edit mode is not deactivated when switching the viewer layout from annotation editor while the second toolbar is open. (DOC-6074)
- Searching for a text also highlights the space before the found text. (DOC-6142)
### Changed
- Enhanced the behavior and appearance of the context menu, added the ability to add a note to selected text. (DOC-6100)
- Removed text markup menu that automatically popped up on text selection. The main context menu includes that menu as a submenu.
- Added the `showContextMenuOnSelection` option controlling the context menu behavior when text is selected.\
The option has the following values:
* "Auto": Automatically determines whether to show the context menu based on the device type.
* "On": Always shows the context menu when text is selected.
* "Off": Never shows the context menu when text is selected.\
The default value is "Auto". On systems with mice, "Auto" behaves like "Off".
On small devices (phones, tablets) without mice, "Auto" behaves like "On".
- [Reply Tool] Updated context menu texts. (DOC-6014)
### Added
- Added support for rich media annotations (play embedded audio/video, modify rich media annotations). (DOC-5979)
- Reply Tool Improvements:
* Added the ability to delete a comment item using the Delete key. Enabled navigation through comment items using the TAB and Arrow keys.
* Added the ability to resize the right sidebar element.
* The Reply Tool now activates automatically when a markup annotation or text comment is added via the context menu, focusing on the new comment in the list.
```javascript
// Use autoExpandOnCommentAdd option to revert to previous behavior:
var viewer = new DsPdfViewer("#root", { replyTool: { autoExpandOnCommentAdd: false } });
```
* The color for ReplyTool icons has been removed.
```javascript
// Use useColoredIcons option to revert to previous behavior:
var viewer = new DsPdfViewer("#root", { replyTool: { useColoredIcons: true } });
```
- Split ISupportApi into base and multi-user parts, added the ability to specify a custom implementation for SupportApi that conforms to the ISupportApiBase interface. (DOC-5440)
```javascript
// Example
var viewer = new DsPdfViewer("#root", {
supportApi: {
implementation: new CustomSupportApi()
}
});
```
## [7.0.4] - 20-Mar-2024
### Fixed
- Incorrect appearance of a rotated stamp annotation. (DOC-6059)
- After calling dispose() method, viewer reserved keys still do not work correctly. (DOC-6060)
- Ellipsis is displayed in the floating search bar's settings when the system language is not English and the language option is not specified. (DOC-6067)
## [7.0.3] - 19-Feb-2024
### Added
- Added new option 'printResolution' (DOC-5995).\
The 'printResolution' option allows you to specify the resolution (in dots per inch - DPI) for printing purposes.
When rendering and preparing a PDF documents for printing, this option determines the quality and detail of the
generated images used in the printing process. A higher DPI value generally results in crisper and more detailed
printed output but may also lead to larger memory usage and slower preview performance. The default value is 150 DPI.
```javascript
// Example: set the print resolution to 300 DPI:
var viewer = new DsPdfViewer("#root", {
printResolution: 300
});
```
### Fixed
- In single page view mode, ItemArea for search results is NaN on Page 2. (DOC-6017)
- The search settings dialog is not closed after closing the floating search bar. (DOC-6021)
- Auto-sized font appears larger than the required font size in some PDFs. (DOC-6029)
- Unable to input "c" and "x" characters in CombTextField. (DOC-6035)
## [7.0.2] - 25-Jan-2024
### Fixed
- Floating text search window display issues in some locales. (DOC-5996)
- Incorrect display of some fonts. (DOC-5983)
- Searched text is not visible in the viewport. (DOC-5965)
- [SupportApi] Resources are not released when the viewer is disposed. (DOC-5733)
- Concurrency issue in the addAnnotation() method. (DOC-6010)
- [Search API] SearchResult.ItemArea is empty. (DOC-6000)
## [7.0.1] - 04-Jan-2024
### Added
- Added standardFontDataUrl option: the URL where the standard font files are located. Include the trailing slash. (DOC-5959)
```javascript
// Example with relative URL:
var viewer = new DsPdfViewer("#root", { standardFontDataUrl: "resources/standard_fonts/" });
// Example with absolute URL:
var viewer = new DsPdfViewer("#root", { standardFontDataUrl: "http://localhost:8080/resources/standard_fonts/" });
```
- Added Chinese localization. (DOC-5856)
```javascript
// Example:
var viewer = new DsPdfViewer("#root", { language: "cn" });
```
### Changed
- JPN localization updated. (DOC-5948)
- License messages updated. (DOC-5951, DOC-5953)
### Fixed
- ComboBox: the first available option value displayed when field is empty. (DOC-5954)
- Console warnings about missing standard font files. (DOC-5969)
- Extra pages are added to the PDF in print preview when the HTML page contains elements with static positioning. (DOC-5895)
- Some incorrectly formed annotations are not shown. (DOC-5986)
## [7.0.0] - 07-Dec-2023
### Added
- Added DsPdfViewer class and "@mescius/dspdfviewer" package. Functionally DsPdfViewer is identical to GcPdfViewer. (DOC-5735)
- Added floating text search bar. (DOC-5406)
- Added localization resources and a localization example to the pdf viewer build.
- Added new option useFloatingSearchBar - enable a floating search bar instead of the sidebar search panel. Default value is true.
```javascript
// To revert to using sidebar search panel instead of the floating search bar:
var viewer = new DsPdfViewer("#root", { useFloatingSearchBar: false });
```
### Changed
- Some tooltips updated.
## [4.2.5] - 22-Nov-2023
### Fixed
- Cannot resize annotations and form fields in some PDFs. (DOC-5396)
- [Ionic Framework] Error "PDF Viewer Factory is not ready." occurs for Ionic Modal. (DOC-5826)
- [Search Panel] Text highlighting disappears when clicking on a document. (DOC-5838)
- [Editor] Problem when moving a stamp annotation to another page using the context menu. (DOC-5844)
### Changed
- [Editor] Improved the floating bar containing the caret/hand options (added close button, reduced size).
- Enhanced the default HTML template index.html (added a description for SupportApi settings).
### Added
- Localizable string resources and example for localization are now included in the package.
## [4.2.4] - 27-Oct-2023
### Fixed
- When a stamp annotation is moved to another page, the resulting position is incorrect. (DOC-5728)
- The annotation position is changed on saving changes after locking the annotations. (DOC-5732)
- [demos] Viewer API is not visible correctly with Window Dark Mode. (DOC-5721)
## [4.2.3] - 28-Sep-2023
### Fixed
- Clicking on a link in a PDF opens a blank page. (DOC-5709)
- [Windows Touch] Zooming by hand does not work. (DOC-5633)
## [4.2.2] - 13-Sep-2023
### Changed
- Localization resources updated. (DOC-5651)
### Fixed
- [Regression] "Cannot find type definition" error when compiling a typescript enabled app. (DOC-5688)
- [Regression] Issues with displaying info messages from the viewer. (DOC-5690)
- Comments added by Adobe Acrobat Reader are not shown correctly when the renderInteractiveForms option is false. (DOC-5693)
- Annotations with AnnotationFlags.NoView are displayed. (DOC-5697)
## [4.2.1] - 17-Aug-2023
### Fixed
- [Editor] After saving a free text annotation with a custom font, the font in the saved PDF is incorrect. (DOC-5642)
### Changed
- Localization resources updated. (DOC-5651)
### Added
- [Editor] Ability to use custom fonts in saved PDFs, see CHANGELOG.​md shipped with GrapeCity.Documents.Pdf.ViewerSupportApi for details. (DOC-5652)
- [Editor] Auto-adjusting font size of text boxes: if the font size is zero, it will be automatically adjusted to fit the content of the text box. (DOC-5558)
## [4.2.0] - 01-Aug-2023
### Fixed
- Content of some password-protected PDF documents is not displayed. (DOC-5623)
- The name of a document list item changed from lower to upper case. (DOC-5602)
- [iOS Desktop] PDF text cannot be selected on zooming the document. (DOC-5432)
- Miscellaneous UI improvements. (ARF-4244, DOC-5608, DOC-5638)
### Added
- Added the ability to use an async function as a "beforeFormSubmit" handler. (DOC-5589)
```javascript
// Example:
viewer.options.handlers = {
beforeFormSubmit: async function(args) {
// Wait 5 seconds before submit:
await new Promise(resolve => setTimeout(resolve, 5000));
args.cancel = true;
alert("5 seconds passed. Submit canceled.");
}
};
```
- [Document List Panel] Added the ability to specify html content for document list items. (DOC-5367)
- [Collaboration] Added new methods: getSharedDocuments, openSharedDocumentByName, openSharedDocumentByIndex. (DOC-5457)
```javascript
// Example 1: get the list of shared documents available to the current user:
var sharedDocuments = await viewer.getSharedDocuments();
// Example 2: open the first available shared document named "example.pdf":
viewer.openSharedDocumentByName("example.pdf");
// Example 3: open the second shared document in the list:
viewer.openSharedDocumentByIndex(1);
```
## [4.1.5] - 14-Jul-2023
### Fixed
- Image cache not functioning correctly when navigating from the first page. (DOC-5564)
- A signature with an appearance stream is not visible. (DOC-5547, DOC-5578)
- [iOS] [iOS Desktop mode] [Android] Pinch zoom in on a link redirects the page. (DOC-5560)
- [Editor] Free text annotation's text changes after repaint. (DOC-5573)
- Multiline text cannot be entered in free text & sticky note annotations. (DOC-5468)\
(Note that note that Adobe Acrobat does not support line breaks for plain text in text annotations.
If line breaks are detected during editing, we automatically set the rich text flag for the text annotation.)
- When several lines of text are selected to create a markup annotation, a separate annotation is created for each line. (DOC-5503)
- Incorrect display on the second page when viewing a specific PDF. (DOC-5496)
- Incorrect handling of rich text when text markup is entered in a text annotation. (DOC-5551)
- Incorrect field names on calling the viewer.submitForm() method. (DOC-5553)
- [Editor] Content missing when opening a PDF on an IOS devices. (DOC-5407)
- [iOS] Incorrect context menu position when context menu is triggered by keyboard. (DOC-5555)
- [iOS] [Android] Pinch zoom in on a link is redirecting the page. (DOC-5560)
### Changed
- Improved the behavior of free text annotations. (DOC-5368)
## [4.1.4] - 20-Jun-2023
### Fixed
- Improved handling of JavaScript code associated with widget events. (DOC-5475)
- [Windows Touchpad] In PDF Organizer, cannot dragged pages using the touchpad. (DOC-5465)
## [4.1.3] - 31-May-2023
### Fixed
- A typing error is thrown when adding stamps in code in an Angular app. (DOC-5433)
## [4.1.2] - 08-May-2023
### Added
- [Form editor] Added tooltip support for all fields, added "Field tooltip" property editor. (DOC-5384)
- Added addStamp method. (DOC-5376)
```javascript
// Example: add graphical signature to the PDF using external image:
function addStampFromUrl(imageUrl, viewer) {
fetch(imageUrl)
.then(response => response.blob())
.then(blob => blob.arrayBuffer())
.then(arrayBuffer => {
const fileId = new Date().getTime() + ".png";
const fileName = fileId;
const pageIndex = 0;
const imageData = new Uint8Array(arrayBuffer);
const rect = [0, 0, 200, 200];
viewer.storage.setItem(fileId, imageData);
viewer.addStamp(
imageData,
{
fileId,
fileName,
pageIndex,
rect,
select: false,
subject: "",
rotate: 0,
convertToContent: false
});
});
}
addStampFromUrl("http://example.com/image.png", viewer);
```
- Added jsExecutionConfig option: optional execution configuration for JavaScript actions.
```javascript
// Example 1: adjust jsCode before execution:
viewer.options.jsExecutionConfig = {
before: function(args) {
args.jsCode = args.jsCode.replace("app.alert", "app.showMessage");
}
}
// Example 2: cancel JS execution:
viewer.options.jsExecutionConfig = {
before: function(args) {
args.cancel = true;
}
}
// Example 3: execute long operation before JS execution and repaint visible pages after JS execution:
viewer.options.jsExecutionConfig = {
before: function() {
// Returned promise will be awaited before further JS execution.
return new Promise(function(resolve) {
setTimeout(resolve, 1000);
});
},
after: function() {
viewer.repaint();
}
}
```
### Changed
- [Editor] Updated property labels for field widgets: property "Name" renamed to "Field name", property "Value" renamed to "Field value", property "Export Value" renamed to "Choice value".
### Fixed
- The second toolbar position is not updated in some cases. (DOC-5377)
- [iOS] When a signature is drawn by Apple Pencil, a lens is sometimes displayed. (DOC-5370)
- [iOS] Locking all fields does not lock some properties. (DOC-5299)
- [iOS] Several issues when using the PDF Organizer. (DOC-5344, DOC-5345)
- Stamp annotations in some PDFs incorrectly appear rotated. (DOC-5383)
- Cannot copy a layer name from the Layers panel. (DOC-5385)
- Cannot load a stamp generated from an image. (DOC-5379)
- JavaScript actions' sequence is incorrect for focus/blur events. (DOC-5389)
- Localization issues. (DOC-5359)
- [Editor] Incorrect popup annotation orientation is some cases. (DOC-5386)
## [4.1.1] - 17-Apr-2023
### Fixed
- [Regression] [Editor] 'Support API server version 6.1.0 is out of date' warning incorrectly shows when the viewer is connected to SupportApi v6.1.0. (DOC-5374)
## [4.1.0] - 03-Apr-2023
### Added
- PDF Organizer: new feature that allows users to rearrange, duplicate or remove pages of a PDF, or merge PDFs. (DOC-3914, DOC-3915, DOC-3916)\
To open the PDF Organizer dialog, in the top toolbar click 'Page Tools', and in the secondary toolbar click 'PDF Organizer'.
- Respect PDF's initial view settings (hide toolbars or menus, open with specific page layout, etc). (DOC-4667)
- Added ignoreInitialView option: set this option to true to ignore initial view settings specified in PDFs.
```javascript
// Example:
viewer.options.ignoreInitialView = true;
```
- Added support for zoom-dependent optional content (layers). (DOC-3970, DOC-4108)
- Added the ability to specify a custom progress message during save action.
```javascript
// Example: use your own progress title and message:
viewer.save("sample.pdf", { pages: "[angle:90]0,1-5", progressTitle: "Rotating", progressMessage: "Rotating first page..." }, reload: true);
```
- Added new method resolvePageIndex(): resolves the page index using PDF page reference. (DOC-5214)
```javascript
// Example:
const openAction = (await viewer.viewerPreferences).openAction;
if(openAction && openAction.dest) {
const pageRef = openAction.dest[0];
const targetPageIndex = await viewer.resolvePageIndex(pageRef);
}
```
- Added holdToPan action: press and hold the spacebar to temporarily enable the pan tool.
```javascript
// Example 1: disable holdToPan when space is pressed:
viewer.options.shortcuts["32"] = () => {};
// Example 2: bind P to holdToPan action, keep Ctrl+P bound to print action:
viewer.options.shortcuts["P"] = [{ ctrl: true, tool: "print" }, { tool: "holdToPan" }];
```
### Changed
- 'Layers' and 'StructureTree' panels added to the default sidebar layout, 'Articles' panel removed.
The default set of sidebar panels is now as follows: 'Thumbnails', 'Search', 'Outline', 'Layers', 'StructureTree', 'Attachments'.
```javascript
// Example: restore the old default layout:
var viewer = new GcPdfViewer("#root");
viewer.addArticlesPanel();
viewer.addThumbnailsPanel();
viewer.addSearchPanel();
viewer.addOutlinePanel();
viewer.addAttachmentsPanel();
```
- [Editor] The printable flag is now set to true for all new annotations.
- Returning model type for the viewer.viewerPreferences property changed: all property names are now camelCased, new properties added: openAction, pageMode, pageLayout.
- Reduced the heights of dialogs' title bars. (DOC-5313)
- [Editor] Text annotation (sticky note) properties display improved. (DOC-3241)
## [4.0.7] - 07-Apr-2023
### Changed
- hideAnnotationPopups option improved: the option now allows specifying annotation types that won't show popups. (DOC-5283)\
Possible values are:
['Text', 'Link', 'Line', 'Square', 'Circle', 'Polygon', 'PolyLine', 'Ink', 'Popup', 'FileAttachment', 'Sound', 'Redact', 'Stamp'] or true or 'All' (true and 'All' have the same behavior).
```javascript
// Example 1: hide popups for all annotations:
var viewer = new GcPdfViewer("#root", { hideAnnotationPopups: true });
// Example 2: hide popups for Redact, Circle and Square annotations:
var viewer = new GcPdfViewer("#root", { hideAnnotationPopups: ["Redact", "Circle", "Square"] });
```
- The save() method now allows specifying a range(s) of pages to save, changing page order or duplicating pages. (DOC-3916)
```javascript
// Example 1: save specified pages only:
await viewer.save("test.pdf", { pages: "0, 3, 5-7" });
// Example 2: duplicate and save the first page:
await viewer.save("test.pdf", { pages: "0, 0" });
// Example 3: split PDF into two documents:
await viewer.save("test_part1.pdf", { pages: "0-3" });
await viewer.save("test_part2.pdf", { pages: "4-8" });
// Example 4: change page order:
await viewer.save("test_changed_order.pdf", { pages: "3, 2, 1, 0" });
```
- The saveAsImages() method now allows specifying the zoom factor.
```javascript
// Example:
viewer.saveAsImages("sample.pdf", { zoomFactor: 1.5 });
```
### Fixed
- [Editor] In a PDF with different page sizes the 'move to next page' option may not work correctly. (DOC-5217)
- [Editor] A locked stamp annotation can still be edited in GcPdfViewer. (DOC-5216)
- [Editor] Cannot undo changes if the editor layout is not activated. (DOC-5315)
- [Editor] A popup annotation may move unexpectedly. (DOC-5318)
- Cannot navigate between pages using PageUp/PageDown keys in single page view. (DOC-5335)
- The list of layers is not shown correctly in some cases. (DOC-5338)
## [4.0.6] - 23-Mar-2023
### Fixed
- [Editor] Move to next page does not work correctly with different page sizes. (DOC-5217)
- [Editor] The zoom value changes after finishing a drawing with the OK button. (DOC-5184)
- [Regression] Form fields that should be hidden by a checkbox are still visible after unchecking the checkbox. (DOC-5242)
## [4.0.5] - 27-Feb-2023
### Fixed
- In some cases the signer's name is not shown correctly in the viewer. (DOC-5145)
- signatureValue returns incorrect JP text for certain PDFs. (DOC-5136)
- [Demos] Downloaded sample cannot be run correctly. (DOC-5149)
- [Editor] Annotations cannot be placed correctly in specific PDFs. (DOC-5125)
- [Editor] Ink annotations' position are incorrect when zooming in/out. (DOC-5139)
- [Editor] A checkbox is not checked when setting its fieldValue same as the export value. (DOC-5151)
- [Editor] Line coordinates are incorrect when adding a line annotation in a specific PDF. (DOC-5144)
- [Editor] A 'Drag and drop error' message shows when trying to input a property value in some cases. (DOC-5169)
- [Editor] In some scenarios, a checkbox that is checked by code does not show as checked. (DOC-5152)
- [Editor] A checkbox's shown value is not synchronized with its state. (DOC-5113)
- [Editor] For checkboxes with the same name, the checked state shows incorrectly by Acrobat in some cases. (DOC-5155)
## [4.0.4] - 06-Feb-2023
### Added
- [Demos] Added new sample "Prevent editing a signed PDF".
### Fixed
- Filling and saving a signed form invalidates the signature. (DOC-5090)
- Localization of digital signature verification. (DOC-5075)
## [4.0.3] - 20-Jan-2023
### Added
- [Editor] Added property editors for line annotation coordinates.
### Fixed
- [Editor] Modifying 'End Y‘ of a line coordinates causes the 'Start Y' to change. (DOC-5040)
- [Editor] In some cases the size of a checkbox becomes incorrect. (DOC-5042)
- Checkbox widgets with the same name did not work correctly. (DOC-4874)
- Ink highlight is not visible in the viewer. (DOC-5048)
- Cannot redefine Ctrl+P keyboard shortcut. (DOC-5021)
- UpdateAnnotation event is not triggered on switching radio buttons. (DOC-5020)
- When a Japanese text is assigned to a ButtonAppearance.Caption, the text is garbled in the generated PDF. (DOC-5028)
- Japanese texts are garbled in the article panel. (DOC-5038)
- PDF content can be printed using native browser menu even when Print is disabled by the disableFeatures option. (DOC-5035)
- disableFeatures.Print does not hide the Print context menu item. (DOC-5029)
- [Editor] Several issues with Ink, Polyline and Polygon annotations and callout lines. (DOC-5014)
- [Editor] Line annotation in the saved PDF is not shown in Acrobat. (DOC-5014)
- [iOS] Unable to toggle checkbox state on touch devices. (DOC-5010)
## [4.0.1] - 27-Dec-2022
### Added
- Added the ability to override addAnnotation/updateAnnotation method parameters:
```javascript
// Example:
const pageIndex = 0;
// Using overridden methods without pageIndex parameter:
annotation.pageIndex = pageIndex;
await viewer.addAnnotation(annotation);
await viewer.updateAnnotation(annotation);
// Using methods with pageIndex parameter:
await viewer.addAnnotation(pageIndex, annotation);
await viewer.updateAnnotation(pageIndex, annotation);
```
- Added the ability to save PDFs using incremental update or linearized mode. (DOC-4913)
```javascript
// Example: save document using IncrementalUpdate mode.
viewer.save("test.pdf", { saveMode: "IncrementalUpdate" });
```
```javascript
// Example: save document using Linearized mode.
viewer.save("test.pdf", {saveMode: "Linearized"});
```
- Added the ability to load an updated PDF document into the viewer without downloading it to the local system.
```javascript
// Example: Save document and load the saved document into the viewer:
await viewer.save("test.pdf", { reload: true });
```
- Added electronic signature API. (DOC-4951)
```javascript
// Example: Save document with signature:
viewer.save("test.pdf", { sign: { signatureField: "field1", signerName: "John Doe" } } );
```
Example of server side signing:
```csharp
// Example: electronically sign PDFs with a .PFX certificate:
public void Configuration(IAppBuilder app) {
GcPdfViewerController.Settings.Sign += _OnSign;
// ...
}
private void _OnSign(object sender, SignEventArgs e)
{
var signatureProperties = e.SignatureProperties;
X509Certificate2 certificate = new X509Certificate2(System.IO.File.ReadAllBytes("certificate.pfx"), "password",
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
signatureProperties.SignatureBuilder = new Pkcs7SignatureBuilder()
{
CertificateChain = new X509Certificate2[] { certificate },
HashAlgorithm = Security.OID.HashAlgorithms.SHA512,
Format = Pkcs7SignatureBuilder.SignatureFormat.adbe_pkcs7_detached
};
}
```
- Added signature checking API. (DOC-4962)
```javascript
// Example: check whether the current document is signed and show information about the signature:
var viewer = GcPdfViewer.findControl("#root");
const signatureInfo = await viewer.getSignatureInfo();
if(signatureInfo.signed) {
const signatureValue = signatureInfo.signedByFields[0].signatureValue;
const signerName = signatureValue.name;
const location = signatureValue.location;
const signDate = viewer.pdfStringToDate(signatureValue.modificationDate);
alert("The document was signed using digital signature. Signed by: " + signerName + ", location: " + location + ", sign date: " + signDate.toString());
} else {
alert("The document is not signed.");
}
```
- [demos] Added new sample "Sign document using digital signature".
### Changed
- Default page view margins changed (added left/right margins).
- Japanese localization resources updated.
- Removed border highlight for article thread beads.\
```javascript
// The following code can be used to revert to the previous article thread beads style:
GcPdfViewer.findControl("#root").addViewAreaStyle(".gc-thread-bead { box-shadow: rgba(255, 232, 0, 0.27) 1px 1px 1px 1px;}");
```
### Fixed
- Support multiple quadrilateral regions for text markup annotations. (DOC-5008)
- Incorrect position when a stamp is pasted with zoom different from 100%. (DOC-5006)
- Incorrect highlight when document contains highlight annotations with multiple areas. (DOC-5003)
- Setting to disable the undo/redo operation using keyboard Ctrl+z/y. (DOC-4932 / DOC-4901)
- Polyline changed after saving current document. (DOC-4942)
- Ink annotation's position changed after save then load if the border width was set. (DOC-4941)
- The size of resizing rectangle around sound annotation changed after invoke setAnnotationBounds(). (DOC-4937)
- Cannot invoke signature tool "afterAdd" event if the tool's location was not set to "BottomRight". (DOC-4948)
- Checkboxes with the same name are checked together. (DOC-4874)
- AutoScroll in Single Page View. (DOC-4959)
- Some annotations are not added correctly. (DOC-4943)
- On performing the Undo operation, only the image gets deleted from the stamp Annotation. (DOC-4686)
- Cannot add annotation to the second page of a specific file. (DOC-4935)
- Incorrect selection rectangle position when the page is zoomed to a specific value. (DOC-5001)
- The toolbar button overlaps zoom input. (DOC-5002)
## [4.0.0] - 06-Dec-2022
### Added
- [Editor] Added support (toolbar items and context menu) for text markup annotations (highlight, underline, strikeout and squiggly). (DOC-4471)
```javascript
// To disable showing text markup context menu:
var viewer = new GcPdfViewer(selector, {
textMarkupContextMenu: false
});
// To disable showing the markup color selector:
var viewer = new GcPdfViewer(selector, {
textMarkupContextMenu: { colors: [] }
});
// To change text markup context menu colors to "Red" and "Black":
var viewer = new GcPdfViewer(selector, {
textMarkupContextMenu: { colors: [{value: "#ff0000", displayName: "Red"}, {value: "#000000", displayName: "Black"}] }
});
```
- [Editor] Added the ability to resize line annotations. (DOC-4705)
- [Editor] [Graphical Signature] Added the ability to position a signature and drag it between pages using the mouse. (DOC-4732, DOC-4740)\
If the signTool.location option is not specified, the signature tool will now allow the user to drag the signature to the desired location, possibly on a different page.
- Added API documentation for the disableFeatures option. (DOC-3298, DOC-4747)
- Added "Ear" icon for sound annotations.
- Added a "Save current document as images" button to the toolbar. (DOC-4774)
### Changed
- Text, sound and file attachment icons updated to look like Acrobat Reader icons.
- The file and sound annotations are no longer resizable. The resulting annotation size now depends on the selected icon type. (DOC-2373)
- The layout of the "Text" quick editing tools has been updated to include buttons for the new text markup annotations.
### Fixed
- Annotation borders appear different in GcPdfViewer and Acrobat. (DOC-4804)
- Line annotation is not visible in some cases. (DOC-4769)
- [Editor] Incorrect icon is shown when adding several text annotations. (DOC-4856)
- [Editor] When converting annotations to content, some annotation icons are incorrect. (DOC-2373)
- [Editor] Once a stamp annotation is rotated, the image cannot be resized. (DOC-4671)
- [Editor] Can not add a stamp annotation to a rotated document. (DOC-4776)
- [Editor] After rotating an annotation it cannot be resized. (DOC-4664)
- [Editor] Error "operation is not valid due to the current state of the object" occurs when attaching a stamp to a PDF. (DOC-4860)
## [3.2.5] - 08-Dec-2022
### Fixed
- Cannot override the default undo key Ctrl Z. (DOC-4901, DOC-4932)
- Exception is thrown when deleting a page in the form Editor. (DOC-4930)
- The open file dialog is not shown when adding sound or file attachment annotation. (DOC-4925)
- Annotations' properties change after saving the document. (DOC-4924, DOC-4942, DOC-4941)
## [3.2.4] - 04-Nov-2022
### Added
- [Editor] [Graphical Signature] Added the ability to position a signature and drag it between pages using the mouse. (DOC-4732, DOC-4740)
If the signTool.location option is not specified, the signature tool will now allow the user to drag the signature to the desired location, possibly on a different page. (DOC-4732, DOC-4740)
```javascript
// To keep the old behavior:
// Variant 1:
var viewer = new GcPdfViewer("#root", {
signTool: {
location: "BottomRight"
}
});
// Variant 2:
viewer.options.signTool = { location: "BottomRight" };
```
- [Editor] Added the ability to drag stamps between pages. (DOC-4724, DOC-4733)
- [API request] Added undoState property: contains the current state of the undo store. (DOC-4687)\
Note that this property is read-only, do not programmatically change the elements of the collection.
Use the Undo API to modify the undoState.\
Available Undo API properties: hasUndoChanges, hasRedoChanges, undoIndex, undoCount\
Available Undo API methods: undoChanges(), redoChanges()
```javascript
// Example:
viewer.eventBus.on("undostorechanged", function() {
console.log("Undo State changed", viewer.undoState);
});
// Or:
viewer.eventBus.on("documentchanged", function() {
console.log("Document changed", viewer.undoState);
});
```
### Changed:
- [Graphical Signature] The default Graphical Signature tool behavior has changed. (DOC-4732)\
When the signTool.location option is not specified, the Graphical Signature will allow the user to move it to the desired location with the mouse.
### Fixed
- [Forms] Cannot reset all fields' values using a push button. (DOC-4685)
- [Editor] PDF is saved incorrectly if it contains intersecting annotations and redacts
(this fix also requires GrapeCity.Documents.Pdf.ViewerSupportApi v5.2.0.804 or later). (DOC-4722, DOC-4720)
- [Editor] Cannot cancel adding a stamp annotation using the ESC key. (DOC-4731)
## [4.0.0-alpha1] - 21-Oct-2022
### Added
- Added support for new annotations: Highlight, Underline, Squiggly, StrikeOut.
- Added the ability to save the PDF's pages as images. (DOC-4577)
Added the saveAsImages method - saves the pages of the current PDF document as PNG images,
zips the result images, and downloads the result zip archive.
```javascript
// Example:
viewer.saveAsImages('test.zip');
```
- Added new "Save as images" toolbar button, the button key is "save-images". (DOC-4577)
The new button is available on "annotation editor" and "form editor" toolbar.
- Added undoState property, contains current state of the undo store. (DOC-4687)
## [3.2.3] - 11-Oct-2022
### Fixed
- [SupportApi for WebForms] An error occurs when trying to share a document using the WebForms version
of the SupportApi service. (DOC-4668)
- [Windows Touch] The pan tool does not work correctly. (DOC-4644)
- [Editor] The stamp annotation gets added as attachment when the attachment is added to the PDF. (DOC-4649)
- [Editor] The sign annotation gets rotated for rotated page. (DOC-4663)
- [Editor] The line annotation is not visible when the line is drawn at 0 or 90 degree. (DOC-4659)
- [Editor] [Regression] "Add Signature" dialog layout is incorrect when dialogLocation is set to "Right". (DOC-4513)
- [Editor] All properties of the annotation should be reset if the cancel flag is set to true in the onBeforeUpdateAnnotation event. (DOC-4139)
- [Editor] The cursor does not change to "cross-hair" style when activating the editor tool from the toolbar for the first time. (DOC-2977)
- The alignment property does not work with fields in JS actions. (DOC-4636)
- [iOS] It is hard to select native checkbox on iOS. (DOC-4517)
### Added
- Added the ability to change SVG icons used by the viewer using the customIcons option.
```javascript
// Example:
var viewer = new GcPdfViewer("#root", {
customIcons: {
'open': '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M9.516 14.016q1.875 0 3.188-1.313t1.313-3.188-1.313-3.188-3.188-1.313-3.188 1.313-1.313 3.188 1.313 3.188 3.188 1.313zM15.516 14.016l4.969 4.969-1.5 1.5-4.969-4.969v-0.797l-0.281-0.281q-1.781 1.547-4.219 1.547-2.719 0-4.617-1.875t-1.898-4.594 1.898-4.617 4.617-1.898 4.594 1.898 1.875 4.617q0 0.984-0.469 2.227t-1.078 1.992l0.281 0.281h0.797z"></path></svg>',
'search': '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M9.516 14.016q1.875 0 3.188-1.313t1.313-3.188-1.313-3.188-3.188-1.313-3.188 1.313-1.313 3.188 1.313 3.188 3.188 1.313zM15.516 14.016l4.969 4.969-1.5 1.5-4.969-4.969v-0.797l-0.281-0.281q-1.781 1.547-4.219 1.547-2.719 0-4.617-1.875t-1.898-4.594 1.898-4.617 4.617-1.898 4.594 1.898 1.875 4.617q0 0.984-0.469 2.227t-1.078 1.992l0.281 0.281h0.797z"></path></svg>'
}
});
```
## [3.2.2] - 16-Sep-2022
### Fixed
- [Editor] The default dash style is not used when editing an annotation with a dashed border. (DOC-4630)
- Text in a certain PDF is not rendered correctly. (DOC-4614, DOC-4616, DOC-4609)
- Text in some PDF documents cannot be selected. (DOC-4615)
- Text becomes invisible when a PDF document contains invalid path operators. (DOC-4617)
- [Android] [iOS] Zooming using fingers gesture is not smooth. (DOC-4550)
### Added
- Method getPageLocation: returns the position of the page view relative to the browser window. (DOC-4602)
- Added the ability to set the selected image for the Stamp button. (DOC-4601)
```javascript
// Example:
var viewer = new GcPdfViewer("#root", {
stamp: {
stampCategories: false,
selectedImageUrl: "https://example.com/download?file=images/image.jpg"
}
});
```
## [3.2.1] - 22-Aug-2022
### Fixed
- [Editor] toolbarLayout.stickyBehavior interferes with adding stamp annotations. (DOC-4549)
- [Editor] Incorrect stamp annotations behavior when the Hide Annotations/Form fields option is enabled. (DOC-4532)
- Thumbnail navigation issue when two or more mice are connected to the system. (DOC-4553)
- [Regression] Stam