Skip to content

Commit

Permalink
[pdf] Fix write change
Browse files Browse the repository at this point in the history
  • Loading branch information
KhromovNikita committed Sep 27, 2024
1 parent 9ef86c3 commit 29bfb6c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 20 deletions.
3 changes: 0 additions & 3 deletions pdf/src/forms/base/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -1959,9 +1959,6 @@
// common triggers
CBaseField.prototype.onMouseEnter = function() {
this.AddActionsToQueue(AscPDF.FORMS_TRIGGERS_TYPES.MouseEnter);

let oDoc = this.GetDocument();

};
CBaseField.prototype.onMouseExit = function() {
this.AddActionsToQueue(AscPDF.FORMS_TRIGGERS_TYPES.MouseExit);
Expand Down
52 changes: 36 additions & 16 deletions pdf/src/history/annotsChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,29 @@ CChangesAnnotArrayOfDoubleProperty.prototype.constructor = CChangesAnnotArrayOfD

CChangesAnnotArrayOfDoubleProperty.prototype.WriteToBinary = function(Writer)
{
var nNewCount = this.New.length;
Writer.WriteLong(nNewCount);
for (var nIndex = 0; nIndex < nNewCount; ++nIndex)
Writer.WriteDouble(this.New[nIndex]);
let nFlags = 0;

var nOldCount = this.Old.length;
Writer.WriteLong(nOldCount);
for (var nIndex = 0; nIndex < nOldCount; ++nIndex)
Writer.WriteDouble(this.Old[nIndex]);
if (undefined === this.New)
nFlags |= 1;

if (undefined === this.Old)
nFlags |= 2;

Writer.WriteLong(nFlags);

if (undefined !== this.New) {
var nNewCount = this.New.length;
Writer.WriteLong(nNewCount);
for (var nIndex = 0; nIndex < nNewCount; ++nIndex)
Writer.WriteDouble(this.New[nIndex]);
}

if (undefined !== this.Old) {
var nOldCount = this.Old.length;
Writer.WriteLong(nOldCount);
for (var nIndex = 0; nIndex < nOldCount; ++nIndex)
Writer.WriteDouble(this.Old[nIndex]);
}
};
CChangesAnnotArrayOfDoubleProperty.prototype.ReadFromBinary = function(Reader)
{
Expand All @@ -122,15 +136,21 @@ CChangesAnnotArrayOfDoubleProperty.prototype.ReadFromBinary = function(Reader)
// Long : Count of the columns in the old grid
// Array of double : widths of columns in the old grid

var nCount = Reader.GetLong();
this.New = [];
for (var nIndex = 0; nIndex < nCount; ++nIndex)
this.New[nIndex] = Reader.GetDouble();
let nFlags = Reader.GetLong();

if (!(nFlags & 1)) {
let nCount = Reader.GetLong();
this.New = [];
for (var nIndex = 0; nIndex < nCount; ++nIndex)
this.New[nIndex] = Reader.GetDouble();
}

nCount = Reader.GetLong();
this.Old = [];
for (var nIndex = 0; nIndex < nCount; ++nIndex)
this.Old[nIndex] = Reader.GetDouble();
if (!(nFlags & 2)) {
let nCount = Reader.GetLong();
this.Old = [];
for (var nIndex = 0; nIndex < nCount; ++nIndex)
this.Old[nIndex] = Reader.GetDouble();
}
};

CChangesAnnotArrayOfDoubleProperty.prototype.Load = function(){
Expand Down
2 changes: 1 addition & 1 deletion pdf/src/history/documentChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ CChangesPDFDocumentRotatePage.prototype.ReadFromBinary = function(Reader)
// long : Old


var nFlags = Reader.GetLong();
let nFlags = Reader.GetLong();

if (nFlags & 1)
this.Page = undefined;
Expand Down

0 comments on commit 29bfb6c

Please sign in to comment.