@groupdocs/groupdocs.watermark
Version:
Create and apply watermarks on PDF, Word, Excel, PowerPoint, and image files, including JPG and PNG. Fast, powerful, and easy-to-use watermarking tool.
824 lines (809 loc) • 34.8 kB
JavaScript
const path = require('path')
const java = require('java')
const os = require('os')
if (os.platform() === 'darwin') {
java.options.push('-Djava.awt.headless=true')
}
java.asyncOptions = {
asyncSuffix: 'Async',
syncSuffix: '',
}
java.classpath.push(path.join(__dirname, '/groupdocs-watermark-nodejs-25.6.jar'))
exports = module.exports
function __typeof__(objClass) {
if (objClass !== undefined && objClass.constructor) {
const strFun = objClass.constructor.toString()
let className = strFun.substr(0, strFun.indexOf('('))
className = className.replace('function', '')
return className.replace(/(^\s*)|(\s*$)/gi, '')
}
return typeof objClass
}
/** STREAM HELPERS * */
exports.readDataFromStream = function (readStream, callback) {
const inputStreamBuffer = new exports.StreamBuffer()
readStream.on('data', chunk => {
inputStreamBuffer.write(chunk)
})
readStream.on('end', () => {
callback(inputStreamBuffer.toInputStream())
})
}
exports.readBytesFromStream = function (readStream, callback) {
const inputStreamBuffer = new exports.StreamBuffer()
readStream.on('data', chunk => {
inputStreamBuffer.write(chunk)
})
readStream.on('end', () => {
const array = Array.from(inputStreamBuffer.toByteArray())
const javaArray = java.newArray('byte', array)
callback(javaArray)
})
}
exports.Dimension = {
Height : 1,
Width : 0,
},
exports.DiagramWatermarkPlacementType = {
AllPages : 2,
BackgroundPages : 1,
Default : 0,
ForegroundPages : 0,
SeparateBackgrounds : 3,
},
exports.EmailBodyType = {
Html : 1,
PlainText : 0,
},
exports.OfficeDashStyle = {
Dash : 2,
DashDot : 3,
DashDotDot : 4,
Default : 0,
Dot : 1,
Solid : 0,
},
exports.OfficeHeaderFooterType = {
FooterEven : 4,
FooterFirst : 5,
FooterPrimary : 3,
HeaderEven : 1,
HeaderFirst : 2,
HeaderPrimary : 0,
},
exports.OfficeLineStyle = {
Default : 0,
Double : 1,
Single : 0,
ThickThin : 2,
ThinThick : 3,
Triple : 4,
},
exports.PdfArtifactSubtype = {
Background : 3,
Footer : 1,
Header : 0,
Undefined : 4,
Watermark : 2,
},
exports.PdfArtifactType = {
Background : 3,
Layout : 1,
Page : 2,
Pagination : 0,
Undefined : 4,
},
exports.PdfCryptoAlgorithm = {
AESx128 : 2,
AESx256 : 3,
RC4x128 : 1,
RC4x40 : 0,
},
exports.PdfImageConversionFormat = {
Gif : 2,
Jpeg : 0,
Png : 1,
},
exports.PdfPermissions = {
AssembleDocument : 1024,
ExtractContent : 16,
ExtractContentWithDisabilities : 512,
FillForm : 256,
ModifyContent : 8,
ModifyTextAnnotations : 32,
PrintDocument : 4,
PrintingQuality : 2048,
},
exports.PresentationHyperlinkActionType = {
MouseClick : 0,
MouseOver : 1,
},
exports.PresentationShapeType = {
AlternateProcessFlow : 159,
BackOrPreviousButton : 166,
BeginningButton : 168,
BentArrow : 63,
BentConnector2 : 97,
BentConnector3 : 98,
BentConnector4 : 99,
BentConnector5 : 100,
BentUpArrow : 50,
Bevel : 83,
BlankButton : 161,
BlockArc : 41,
BracePair : 95,
BracketPair : 94,
Callout1 : 105,
Callout1WithAccent : 108,
Callout1WithBorder : 111,
Callout1WithBorderAndAccent : 114,
Callout2 : 106,
Callout2WithAccent : 109,
Callout2WithBorder : 112,
Callout2WithBorderAndAccent : 115,
Callout3 : 107,
Callout3WithAccent : 110,
Callout3WithBorder : 113,
Callout3WithBorderAndAccent : 116,
CalloutCloud : 120,
CalloutDownArrow : 59,
CalloutLeftArrow : 56,
CalloutLeftRightArrow : 60,
CalloutQuadArrow : 62,
CalloutRightArrow : 57,
CalloutUpArrow : 58,
CalloutUpDownArrow : 61,
CalloutWedgeEllipse : 119,
CalloutWedgeRectangle : 117,
CalloutWedgeRoundRectangle : 118,
Can : 74,
ChartPlus : 187,
ChartStar : 186,
ChartX : 185,
Chevron : 38,
Chord : 88,
CircularArrow : 65,
Cloud : 121,
CollateFlow : 148,
ConnectorFlow : 143,
Corner : 86,
CornerTabs : 182,
Cube : 73,
CurvedArc : 89,
CurvedConnector2 : 101,
CurvedConnector3 : 102,
CurvedConnector4 : 103,
CurvedConnector5 : 104,
CurvedDownArrow : 71,
CurvedLeftArrow : 69,
CurvedRightArrow : 68,
CurvedUpArrow : 70,
Custom : 0,
Decagon : 14,
DecisionFlow : 133,
DelayFlow : 158,
DiagonalStripe : 87,
Diamond : 6,
DisplayFlow : 157,
DivideMath : 179,
DocumentButton : 170,
DocumentFlow : 137,
Dodecagon : 15,
Donut : 42,
DoubleWave : 130,
DownArrow : 47,
EightPointedStar : 20,
Ellipse : 35,
EllipseRibbon : 124,
EllipseRibbon2 : 125,
EndButton : 167,
EqualMath : 180,
ExtractFlow : 150,
FivePointedStar : 17,
FoldedCorner : 82,
ForwardOrNextButton : 165,
FourPointedStar : 16,
Frame : 84,
Funnel : 175,
Gear6 : 173,
Gear9 : 174,
HalfFrame : 85,
Heart : 76,
HelpButton : 163,
Heptagon : 12,
Hexagon : 11,
HomeButton : 162,
HomePlate : 37,
HorizontalScroll : 128,
InformationButton : 164,
InputOutputFlow : 134,
InternalStorageFlow : 136,
IrregularSeal1 : 80,
IrregularSeal2 : 81,
LeftArrow : 45,
LeftBrace : 92,
LeftBracket : 90,
LeftCircularArrow : 66,
LeftRightArrow : 51,
LeftRightCircularArrow : 67,
LeftRightRibbon : 126,
LeftRightUpArrow : 54,
LeftUpArrow : 53,
LightningBolt : 75,
Line : 1,
LineInverse : 2,
MagneticDiskFlow : 155,
MagneticDrumFlow : 156,
MagneticTapeFlow : 154,
ManualInputFlow : 141,
ManualOperationFlow : 142,
MergeFlow : 151,
MinusMath : 177,
Moon : 78,
MovieButton : 172,
MultiDocumentFlow : 138,
MultiplyMath : 178,
NonIsoscelesTrapezoid : 9,
NoSmoking : 43,
NotchedRightArrow : 49,
NotDefined : -1,
NotEqualMath : 181,
Octagon : 13,
OfflineStorageFlow : 152,
OffPageConnectorFlow : 160,
OneRoundCornerRectangle : 27,
OneSnipCornerRectangle : 31,
OneSnipOneRoundCornerRectangle : 30,
OnlineStorageFlow : 153,
OrFlow : 147,
Parallelogram : 7,
Pentagon : 10,
Pie : 40,
PieWedge : 39,
Plaque : 34,
PlaqueTabs : 184,
Plus : 131,
PlusMath : 176,
PredefinedProcessFlow : 135,
PreparationFlow : 140,
ProcessFlow : 132,
PunchedCardFlow : 144,
PunchedTapeFlow : 145,
QuadArrow : 55,
Rectangle : 5,
ReturnButton : 169,
Ribbon : 122,
Ribbon2 : 123,
RightArrow : 44,
RightBrace : 93,
RightBracket : 91,
RightTriangle : 4,
RoundCornerRectangle : 26,
SevenPointedStar : 19,
SixPointedStar : 18,
SixteenPointedStar : 23,
SmileyFace : 79,
SortFlow : 149,
SoundButton : 171,
SquareTabs : 183,
StraightConnector1 : 96,
StripedRightArrow : 48,
SummingJunctionFlow : 146,
Sun : 77,
SwooshArrow : 72,
Teardrop : 36,
TenPointedStar : 21,
TerminatorFlow : 139,
ThirtyTwoPointedStar : 25,
Trapezoid : 8,
Triangle : 3,
TwelvePointedStar : 22,
TwentyFourPointedStar : 24,
TwoDiagonalRoundCornerRectangle : 29,
TwoDiagonalSnipCornerRectangle : 33,
TwoSamesideRoundCornerRectangle : 28,
TwoSamesideSnipCornerRectangle : 32,
UpArrow : 46,
UpDownArrow : 52,
UTurnArrow : 64,
VerticalScroll : 127,
Wave : 129,
},
exports.SpreadsheetHeaderFooterSectionType = {
Center : 1,
Left : 0,
Right : 2,
},
exports.WordProcessingHorizontalAlignment = {
Center : 2,
Inside : 4,
Left : 1,
None : 0,
Outside : 5,
Right : 3,
},
exports.WordProcessingProtectionType = {
AllowOnlyComments : 1,
AllowOnlyFormFields : 2,
AllowOnlyRevisions : 0,
ReadOnly : 3,
},
exports.WordProcessingRelativeHorizontalPosition = {
Character : 3,
Column : 2,
InsideMargin : 6,
LeftMargin : 4,
Margin : 0,
OutsideMargin : 7,
Page : 1,
RightMargin : 5,
},
exports.WordProcessingRelativeVerticalPosition = {
BottomMargin : 5,
InsideMargin : 6,
Line : 3,
Margin : 0,
OutsideMargin : 7,
Page : 1,
Paragraph : 2,
TopMargin : 4,
},
exports.WordProcessingShapeType = {
AccentBorderCallout1 : 50,
AccentBorderCallout2 : 51,
AccentBorderCallout3 : 52,
AccentBorderCallout90 : 181,
AccentCallout1 : 44,
AccentCallout2 : 45,
AccentCallout3 : 46,
AccentCallout90 : 179,
ActionButtonBackPrevious : 194,
ActionButtonBeginning : 196,
ActionButtonBlank : 189,
ActionButtonDocument : 198,
ActionButtonEnd : 195,
ActionButtonForwardNext : 193,
ActionButtonHelp : 191,
ActionButtonHome : 190,
ActionButtonInformation : 192,
ActionButtonMovie : 200,
ActionButtonReturn : 197,
ActionButtonSound : 199,
Arc : 19,
Arrow : 13,
Balloon : 17,
BentArrow : 91,
BentConnector2 : 33,
BentConnector3 : 34,
BentConnector4 : 35,
BentConnector5 : 36,
BentUpArrow : 90,
Bevel : 84,
BlockArc : 95,
BorderCallout1 : 47,
BorderCallout2 : 48,
BorderCallout3 : 49,
BorderCallout90 : 180,
BracePair : 186,
BracketPair : 185,
Callout1 : 41,
Callout2 : 42,
Callout3 : 43,
Callout90 : 178,
Can : 22,
Chevron : 55,
CircularArrow : 99,
CloudCallout : 106,
Cube : 16,
CurvedConnector2 : 37,
CurvedConnector3 : 38,
CurvedConnector4 : 39,
CurvedConnector5 : 40,
CurvedDownArrow : 105,
CurvedLeftArrow : 103,
CurvedRightArrow : 102,
CurvedUpArrow : 104,
CustomShape : 100,
DiagonalCornersRounded : 209,
DiagonalCornersSnipped : 205,
Diamond : 4,
Donut : 23,
DoubleWave : 188,
DownArrow : 67,
DownArrowCallout : 80,
Ellipse : 3,
EllipseRibbon : 107,
EllipseRibbon2 : 108,
FlowChartAlternateProcess : 176,
FlowChartCollate : 125,
FlowChartConnector : 120,
FlowChartDecision : 110,
FlowChartDelay : 135,
FlowChartDisplay : 134,
FlowChartDocument : 114,
FlowChartExtract : 127,
FlowChartInputOutput : 111,
FlowChartInternalStorage : 113,
FlowChartMagneticDisk : 132,
FlowChartMagneticDrum : 133,
FlowChartMagneticTape : 131,
FlowChartManualInput : 118,
FlowChartManualOperation : 119,
FlowChartMerge : 128,
FlowChartMultidocument : 115,
FlowChartOfflineStorage : 129,
FlowChartOffpageConnector : 177,
FlowChartOnlineStorage : 130,
FlowChartOr : 124,
FlowChartPredefinedProcess : 112,
FlowChartPreparation : 117,
FlowChartProcess : 109,
FlowChartPunchedCard : 121,
FlowChartPunchedTape : 122,
FlowChartSort : 126,
FlowChartSummingJunction : 123,
FlowChartTerminator : 116,
FoldedCorner : 65,
Group : -1,
Heart : 74,
Hexagon : 9,
HomePlate : 15,
HorizontalScroll : 98,
Image : 75,
IrregularSeal1 : 71,
IrregularSeal2 : 72,
LeftArrow : 66,
LeftArrowCallout : 77,
LeftBrace : 87,
LeftBracket : 85,
LeftRightArrow : 69,
LeftRightArrowCallout : 81,
LeftRightUpArrow : 182,
LeftUpArrow : 89,
LightningBolt : 73,
Line : 20,
MinValue : -2,
Moon : 184,
NonPrimitive : 0,
NoSmoking : 57,
NotchedRightArrow : 94,
Octagon : 10,
OleControl : 201,
OleObject : -2,
Parallelogram : 7,
Pentagon : 56,
Plaque : 21,
Plus : 11,
QuadArrow : 76,
QuadArrowCallout : 83,
Rectangle : 1,
Ribbon : 53,
Ribbon2 : 54,
RightArrowCallout : 78,
RightBrace : 88,
RightBracket : 86,
RightTriangle : 6,
RoundRectangle : 2,
Seal : 18,
Seal16 : 59,
Seal24 : 92,
Seal32 : 60,
Seal4 : 187,
Seal8 : 58,
SingleCornerRounded : 207,
SingleCornerSnipped : 203,
SmileyFace : 96,
Star : 12,
StraightConnector1 : 32,
StripedRightArrow : 93,
Sun : 183,
TextArchDownCurve : 145,
TextArchDownPour : 149,
TextArchUpCurve : 144,
TextArchUpPour : 148,
TextBox : 202,
TextButtonCurve : 147,
TextButtonPour : 151,
TextCanDown : 175,
TextCanUp : 174,
TextCascadeDown : 155,
TextCascadeUp : 154,
TextChevron : 140,
TextChevronInverted : 141,
TextCircleCurve : 146,
TextCirclePour : 150,
TextCurve : 27,
TextCurveDown : 153,
TextCurveUp : 152,
TextDeflate : 161,
TextDeflateBottom : 163,
TextDeflateInflate : 166,
TextDeflateInflateDeflate : 167,
TextDeflateTop : 165,
TextFadeDown : 171,
TextFadeLeft : 169,
TextFadeRight : 168,
TextFadeUp : 170,
TextHexagon : 26,
TextInflate : 160,
TextInflateBottom : 162,
TextInflateTop : 164,
TextOctagon : 25,
TextOnCurve : 30,
TextOnRing : 31,
TextPlainText : 136,
TextRing : 29,
TextRingInside : 142,
TextRingOutside : 143,
TextSimple : 24,
TextSlantDown : 173,
TextSlantUp : 172,
TextStop : 137,
TextTriangle : 138,
TextTriangleInverted : 139,
TextWave : 28,
TextWave1 : 156,
TextWave2 : 157,
TextWave3 : 158,
TextWave4 : 159,
ThickArrow : 14,
TopCornersOneRoundedOneSnipped : 206,
TopCornersRounded : 208,
TopCornersSnipped : 204,
Trapezoid : 8,
Triangle : 5,
UpArrow : 68,
UpArrowCallout : 79,
UpDownArrow : 70,
UpDownArrowCallout : 82,
UturnArrow : 101,
VerticalScroll : 97,
Wave : 64,
WedgeEllipseCallout : 63,
WedgeRectCallout : 61,
WedgeRRectCallout : 62,
},
exports.WordProcessingVerticalAlignment = {
Bottom : 3,
Center : 2,
Inline : -1,
Inside : 4,
None : 0,
Outside : 5,
Top : 1,
},
exports.WordProcessingFlipOrientation = {
Both : 3,
Horizontal : 1,
None : 0,
Vertical : 2,
},
exports.WordProcessingLockType = {
AllowOnlyComments : 1,
AllowOnlyFormFields : 2,
AllowOnlyRevisions : 0,
NoLock : -1,
ReadOnly : 3,
ReadOnlyWithEditableContent : 4,
},
exports.FormattedTextFragmentCollectionType = {
NoFormattedText : 2,
SingleFragment : 1,
UnlimitedFragments : 0,
},
exports.PagesSelector = java.import("com.groupdocs.watermark.PagesSelector");
exports.PagesSetup = java.import("com.groupdocs.watermark.PagesSetup");
exports.PdfFindVectorWatermarkStategy = java.import("com.groupdocs.watermark.PdfFindVectorWatermarkStategy");
exports.PdfOperator = java.import("com.groupdocs.watermark.PdfOperator");
exports.PdfOperatorCollection = java.import("com.groupdocs.watermark.PdfOperatorCollection");
exports.PdfVectorPossibleWatermark = java.import("com.groupdocs.watermark.PdfVectorPossibleWatermark");
exports.PresentationPreviewOptions = java.import("com.groupdocs.watermark.PresentationPreviewOptions");
exports.Thickness = java.import("com.groupdocs.watermark.Thickness");
exports.VectorSearchCriteria = java.import("com.groupdocs.watermark.VectorSearchCriteria");
exports.Watermarker = java.import("com.groupdocs.watermark.Watermarker");
exports.WatermarkerSettings = java.import("com.groupdocs.watermark.WatermarkerSettings");
exports.XImageHelper = java.import("com.groupdocs.watermark.XImageHelper");
exports.PageInfo = java.import("com.groupdocs.watermark.common.PageInfo");
exports.AsposeImageContainer = java.import("com.groupdocs.watermark.contents.AsposeImageContainer");
exports.AttachmentWatermarkableImage = java.import("com.groupdocs.watermark.contents.AttachmentWatermarkableImage");
exports.ContentsProxy = java.import("com.groupdocs.watermark.contents.ContentsProxy");
exports.DiagramContent = java.import("com.groupdocs.watermark.contents.DiagramContent");
exports.DiagramWatermarkableImage = java.import("com.groupdocs.watermark.contents.DiagramWatermarkableImage");
exports.EmailContent = java.import("com.groupdocs.watermark.contents.EmailContent");
exports.GifImageContent = java.import("com.groupdocs.watermark.contents.GifImageContent");
exports.ImageContent = java.import("com.groupdocs.watermark.contents.ImageContent");
exports.ImageUtils = java.import("com.groupdocs.watermark.contents.ImageUtils");
exports.OfficeLineFormat = java.import("com.groupdocs.watermark.contents.OfficeLineFormat");
exports.PdfContent = java.import("com.groupdocs.watermark.contents.PdfContent");
exports.PdfPage = java.import("com.groupdocs.watermark.contents.PdfPage");
exports.PdfTextFormattedTextFragmentCollection = java.import("com.groupdocs.watermark.contents.PdfTextFormattedTextFragmentCollection");
exports.PdfWatermarkableImage = java.import("com.groupdocs.watermark.contents.PdfWatermarkableImage");
exports.PresentationContent = java.import("com.groupdocs.watermark.contents.PresentationContent");
exports.PresentationShapeSettings = java.import("com.groupdocs.watermark.contents.PresentationShapeSettings");
exports.PresentationWatermarkableImage = java.import("com.groupdocs.watermark.contents.PresentationWatermarkableImage");
exports.SpreadsheetCellFormattedTextFragmentCollection = java.import("com.groupdocs.watermark.contents.SpreadsheetCellFormattedTextFragmentCollection");
exports.SpreadsheetContent = java.import("com.groupdocs.watermark.contents.SpreadsheetContent");
exports.SpreadsheetHeaderFooter = java.import("com.groupdocs.watermark.contents.SpreadsheetHeaderFooter");
exports.SpreadsheetHeaderFooterCollection = java.import("com.groupdocs.watermark.contents.SpreadsheetHeaderFooterCollection");
exports.SpreadsheetHeaderFooterSectionCollection = java.import("com.groupdocs.watermark.contents.SpreadsheetHeaderFooterSectionCollection");
exports.SpreadsheetWatermarkableImage = java.import("com.groupdocs.watermark.contents.SpreadsheetWatermarkableImage");
exports.TiffImageContent = java.import("com.groupdocs.watermark.contents.TiffImageContent");
exports.WatermarkableImageCollection = java.import("com.groupdocs.watermark.contents.WatermarkableImageCollection");
exports.WordProcessingContent = java.import("com.groupdocs.watermark.contents.WordProcessingContent");
exports.WordProcessingHeaderFooter = java.import("com.groupdocs.watermark.contents.WordProcessingHeaderFooter");
exports.WordProcessingPageSplitter = java.import("com.groupdocs.watermark.contents.WordProcessingPageSplitter");
exports.WordProcessingSectionCollection = java.import("com.groupdocs.watermark.contents.WordProcessingSectionCollection");
exports.WordProcessingTextFormattedTextFragmentCollection = java.import("com.groupdocs.watermark.contents.WordProcessingTextFormattedTextFragmentCollection");
exports.WordProcessingUtils = java.import("com.groupdocs.watermark.contents.WordProcessingUtils");
exports.WordProcessingWatermarkableImage = java.import("com.groupdocs.watermark.contents.WordProcessingWatermarkableImage");
exports.DetachedImageException = java.import("com.groupdocs.watermark.exceptions.DetachedImageException");
exports.EncryptionIsNotSupportedException = java.import("com.groupdocs.watermark.exceptions.EncryptionIsNotSupportedException");
exports.FontNotFoundException = java.import("com.groupdocs.watermark.exceptions.FontNotFoundException");
exports.ImageEffectsForTextWatermarkException = java.import("com.groupdocs.watermark.exceptions.ImageEffectsForTextWatermarkException");
exports.InvalidPasswordException = java.import("com.groupdocs.watermark.exceptions.InvalidPasswordException");
exports.PreviewNotSupportedException = java.import("com.groupdocs.watermark.exceptions.PreviewNotSupportedException");
exports.TextEffectsForImageWatermarkException = java.import("com.groupdocs.watermark.exceptions.TextEffectsForImageWatermarkException");
exports.UnexpectedDocumentStructureException = java.import("com.groupdocs.watermark.exceptions.UnexpectedDocumentStructureException");
exports.UnknownLoadOptionsTypeException = java.import("com.groupdocs.watermark.exceptions.UnknownLoadOptionsTypeException");
exports.UnknownWatermarkOptionsTypeException = java.import("com.groupdocs.watermark.exceptions.UnknownWatermarkOptionsTypeException");
exports.UnsupportedFileTypeException = java.import("com.groupdocs.watermark.exceptions.UnsupportedFileTypeException");
exports.WatermarkException = java.import("com.groupdocs.watermark.exceptions.WatermarkException");
exports.License = java.import("com.groupdocs.watermark.licenses.License");
exports.Metered = java.import("com.groupdocs.watermark.licenses.Metered");
exports.WatermarkAssemblyConstants = java.import("com.groupdocs.watermark.licenses.WatermarkAssemblyConstants");
exports.DiagramLoadOptions = java.import("com.groupdocs.watermark.options.DiagramLoadOptions");
exports.DiagramPageWatermarkOptions = java.import("com.groupdocs.watermark.options.DiagramPageWatermarkOptions");
exports.DiagramPreviewOptions = java.import("com.groupdocs.watermark.options.DiagramPreviewOptions");
exports.DiagramSaveOptions = java.import("com.groupdocs.watermark.options.DiagramSaveOptions");
exports.DiagramShapeWatermarkOptions = java.import("com.groupdocs.watermark.options.DiagramShapeWatermarkOptions");
exports.EmailLoadOptions = java.import("com.groupdocs.watermark.options.EmailLoadOptions");
exports.EmailPreviewOptions = java.import("com.groupdocs.watermark.options.EmailPreviewOptions");
exports.EmailSaveOptions = java.import("com.groupdocs.watermark.options.EmailSaveOptions");
exports.GifImageLoadOptions = java.import("com.groupdocs.watermark.options.GifImageLoadOptions");
exports.GifImageSaveOptions = java.import("com.groupdocs.watermark.options.GifImageSaveOptions");
exports.GifImageWatermarkOptions = java.import("com.groupdocs.watermark.options.GifImageWatermarkOptions");
exports.ImageLoadOptions = java.import("com.groupdocs.watermark.options.ImageLoadOptions");
exports.ImageSaveOptions = java.import("com.groupdocs.watermark.options.ImageSaveOptions");
exports.LoadOptions = java.import("com.groupdocs.watermark.options.LoadOptions");
exports.MultiframeImageLoadOptions = java.import("com.groupdocs.watermark.options.MultiframeImageLoadOptions");
exports.MultiframeImageWatermarkOptions = java.import("com.groupdocs.watermark.options.MultiframeImageWatermarkOptions");
exports.OoxmlLoadOptions = java.import("com.groupdocs.watermark.options.OoxmlLoadOptions");
exports.PdfAnnotationWatermarkOptions = java.import("com.groupdocs.watermark.options.PdfAnnotationWatermarkOptions");
exports.PdfArtifactWatermarkOptions = java.import("com.groupdocs.watermark.options.PdfArtifactWatermarkOptions");
exports.PdfLoadOptions = java.import("com.groupdocs.watermark.options.PdfLoadOptions");
exports.PdfPreviewOptions = java.import("com.groupdocs.watermark.options.PdfPreviewOptions");
exports.PdfSaveOptions = java.import("com.groupdocs.watermark.options.PdfSaveOptions");
exports.PdfXObjectWatermarkOptions = java.import("com.groupdocs.watermark.options.PdfXObjectWatermarkOptions");
exports.PresentationImageEffects = java.import("com.groupdocs.watermark.options.PresentationImageEffects");
exports.PresentationLoadOptions = java.import("com.groupdocs.watermark.options.PresentationLoadOptions");
exports.PresentationSaveOptions = java.import("com.groupdocs.watermark.options.PresentationSaveOptions");
exports.PresentationTextEffects = java.import("com.groupdocs.watermark.options.PresentationTextEffects");
exports.PresentationWatermarkLayoutSlideOptions = java.import("com.groupdocs.watermark.options.PresentationWatermarkLayoutSlideOptions");
exports.PresentationWatermarkMasterHandoutSlideOptions = java.import("com.groupdocs.watermark.options.PresentationWatermarkMasterHandoutSlideOptions");
exports.PresentationWatermarkMasterNotesSlideOptions = java.import("com.groupdocs.watermark.options.PresentationWatermarkMasterNotesSlideOptions");
exports.PresentationWatermarkMasterSlideOptions = java.import("com.groupdocs.watermark.options.PresentationWatermarkMasterSlideOptions");
exports.PresentationWatermarkNoteSlideOptions = java.import("com.groupdocs.watermark.options.PresentationWatermarkNoteSlideOptions");
exports.PresentationWatermarkSlideOptions = java.import("com.groupdocs.watermark.options.PresentationWatermarkSlideOptions");
exports.PreviewOptions = java.import("com.groupdocs.watermark.options.PreviewOptions");
exports.SaveOptions = java.import("com.groupdocs.watermark.options.SaveOptions");
exports.SpreadsheetBackgroundWatermarkOptions = java.import("com.groupdocs.watermark.options.SpreadsheetBackgroundWatermarkOptions");
exports.SpreadsheetImageEffects = java.import("com.groupdocs.watermark.options.SpreadsheetImageEffects");
exports.SpreadsheetLoadOptions = java.import("com.groupdocs.watermark.options.SpreadsheetLoadOptions");
exports.SpreadsheetPreviewOptions = java.import("com.groupdocs.watermark.options.SpreadsheetPreviewOptions");
exports.SpreadsheetSaveOptions = java.import("com.groupdocs.watermark.options.SpreadsheetSaveOptions");
exports.SpreadsheetShapeSettings = java.import("com.groupdocs.watermark.options.SpreadsheetShapeSettings");
exports.SpreadsheetTextEffects = java.import("com.groupdocs.watermark.options.SpreadsheetTextEffects");
exports.SpreadsheetWatermarkHeaderFooterOptions = java.import("com.groupdocs.watermark.options.SpreadsheetWatermarkHeaderFooterOptions");
exports.SpreadsheetWatermarkModernWordArtOptions = java.import("com.groupdocs.watermark.options.SpreadsheetWatermarkModernWordArtOptions");
exports.SpreadsheetWatermarkShapeOptions = java.import("com.groupdocs.watermark.options.SpreadsheetWatermarkShapeOptions");
exports.TiffImageLoadOptions = java.import("com.groupdocs.watermark.options.TiffImageLoadOptions");
exports.TiffImageSaveOptions = java.import("com.groupdocs.watermark.options.TiffImageSaveOptions");
exports.TiffImageWatermarkOptions = java.import("com.groupdocs.watermark.options.TiffImageWatermarkOptions");
exports.WatermarkOptions = java.import("com.groupdocs.watermark.options.WatermarkOptions");
exports.WordProcessingImageEffects = java.import("com.groupdocs.watermark.options.WordProcessingImageEffects");
exports.WordProcessingLoadOptions = java.import("com.groupdocs.watermark.options.WordProcessingLoadOptions");
exports.WordProcessingPreviewOptions = java.import("com.groupdocs.watermark.options.WordProcessingPreviewOptions");
exports.WordProcessingSaveOptions = java.import("com.groupdocs.watermark.options.WordProcessingSaveOptions");
exports.WordProcessingShapeSettings = java.import("com.groupdocs.watermark.options.WordProcessingShapeSettings");
exports.WordProcessingTextEffects = java.import("com.groupdocs.watermark.options.WordProcessingTextEffects");
exports.WordProcessingWatermarkHeaderFooterOptions = java.import("com.groupdocs.watermark.options.WordProcessingWatermarkHeaderFooterOptions");
exports.WordProcessingWatermarkPagesOptions = java.import("com.groupdocs.watermark.options.WordProcessingWatermarkPagesOptions");
exports.WordProcessingWatermarkSectionOptions = java.import("com.groupdocs.watermark.options.WordProcessingWatermarkSectionOptions");
exports.ColorRange = java.import("com.groupdocs.watermark.search.ColorRange");
exports.DiagramCommentPossibleWatermark = java.import("com.groupdocs.watermark.search.DiagramCommentPossibleWatermark");
exports.DiagramHeaderFooterPossibleWatermark = java.import("com.groupdocs.watermark.search.DiagramHeaderFooterPossibleWatermark");
exports.DiagramHyperlinkPossibleWatermark = java.import("com.groupdocs.watermark.search.DiagramHyperlinkPossibleWatermark");
exports.DiagramShapePossibleWatermark = java.import("com.groupdocs.watermark.search.DiagramShapePossibleWatermark");
exports.EmailAttachedImagePossibleWatermark = java.import("com.groupdocs.watermark.search.EmailAttachedImagePossibleWatermark");
exports.EmailBodyTextPossibleWatermark = java.import("com.groupdocs.watermark.search.EmailBodyTextPossibleWatermark");
exports.EmailEmbeddedImagePossibleWatermark = java.import("com.groupdocs.watermark.search.EmailEmbeddedImagePossibleWatermark");
exports.EmailHtmlBodyTextPossibleWatermark = java.import("com.groupdocs.watermark.search.EmailHtmlBodyTextPossibleWatermark");
exports.EmailSubjectTextPossibleWatermark = java.import("com.groupdocs.watermark.search.EmailSubjectTextPossibleWatermark");
exports.FormattedTextFragmentCollection = java.import("com.groupdocs.watermark.search.FormattedTextFragmentCollection");
exports.HyperlinkPossibleWatermark = java.import("com.groupdocs.watermark.search.HyperlinkPossibleWatermark");
exports.ImageColorHistogramSearchCriteria = java.import("com.groupdocs.watermark.search.ImageColorHistogramSearchCriteria");
exports.ImageDctHashSearchCriteria = java.import("com.groupdocs.watermark.search.ImageDctHashSearchCriteria");
exports.ImageThumbnailSearchCriteria = java.import("com.groupdocs.watermark.search.ImageThumbnailSearchCriteria");
exports.IsImageSearchCriteria = java.import("com.groupdocs.watermark.search.IsImageSearchCriteria");
exports.IsTextSearchCriteria = java.import("com.groupdocs.watermark.search.IsTextSearchCriteria");
exports.PdfAnnotationPossibleWatermark = java.import("com.groupdocs.watermark.search.PdfAnnotationPossibleWatermark");
exports.PdfArtifactPossibleWatermark = java.import("com.groupdocs.watermark.search.PdfArtifactPossibleWatermark");
exports.PdfAttachedImagePossibleWatermark = java.import("com.groupdocs.watermark.search.PdfAttachedImagePossibleWatermark");
exports.PdfHyperlinkPossibleWatermark = java.import("com.groupdocs.watermark.search.PdfHyperlinkPossibleWatermark");
exports.PdfTextPossibleWatermark = java.import("com.groupdocs.watermark.search.PdfTextPossibleWatermark");
exports.PdfXObjectPossibleWatermark = java.import("com.groupdocs.watermark.search.PdfXObjectPossibleWatermark");
exports.PossibleWatermarkCollection = java.import("com.groupdocs.watermark.search.PossibleWatermarkCollection");
exports.PresentationBackgroundPossibleWatermark = java.import("com.groupdocs.watermark.search.PresentationBackgroundPossibleWatermark");
exports.PresentationChartBackgroundPossibleWatermark = java.import("com.groupdocs.watermark.search.PresentationChartBackgroundPossibleWatermark");
exports.PresentationHyperlinkPossibleWatermark = java.import("com.groupdocs.watermark.search.PresentationHyperlinkPossibleWatermark");
exports.PresentationShapePossibleWatermark = java.import("com.groupdocs.watermark.search.PresentationShapePossibleWatermark");
exports.RotateAngleSearchCriteria = java.import("com.groupdocs.watermark.search.RotateAngleSearchCriteria");
exports.SearchableObjects = java.import("com.groupdocs.watermark.search.SearchableObjects");
exports.SizeSearchCriteria = java.import("com.groupdocs.watermark.search.SizeSearchCriteria");
exports.SpreadsheetAttachedImagePossibleWatermark = java.import("com.groupdocs.watermark.search.SpreadsheetAttachedImagePossibleWatermark");
exports.SpreadsheetBackgroundPossibleWatermark = java.import("com.groupdocs.watermark.search.SpreadsheetBackgroundPossibleWatermark");
exports.SpreadsheetCellPossibleWatermark = java.import("com.groupdocs.watermark.search.SpreadsheetCellPossibleWatermark");
exports.SpreadsheetChartBackgroundPossibleWatermark = java.import("com.groupdocs.watermark.search.SpreadsheetChartBackgroundPossibleWatermark");
exports.SpreadsheetHeaderFooterPossibleWatermark = java.import("com.groupdocs.watermark.search.SpreadsheetHeaderFooterPossibleWatermark");
exports.SpreadsheetHyperlinkPossibleWatermark = java.import("com.groupdocs.watermark.search.SpreadsheetHyperlinkPossibleWatermark");
exports.SpreadsheetShapePossibleWatermark = java.import("com.groupdocs.watermark.search.SpreadsheetShapePossibleWatermark");
exports.TextFormattingSearchCriteria = java.import("com.groupdocs.watermark.search.TextFormattingSearchCriteria");
exports.TextSearchCriteria = java.import("com.groupdocs.watermark.search.TextSearchCriteria");
exports.WordProcessingShapePossibleWatermark = java.import("com.groupdocs.watermark.search.WordProcessingShapePossibleWatermark");
exports.WordProcessingTextHyperlinkPossibleWatermark = java.import("com.groupdocs.watermark.search.WordProcessingTextHyperlinkPossibleWatermark");
exports.WordProcessingTextPossibleWatermark = java.import("com.groupdocs.watermark.search.WordProcessingTextPossibleWatermark");
exports.Color = java.import("com.groupdocs.watermark.watermarks.Color");
exports.Font = java.import("com.groupdocs.watermark.watermarks.Font");
exports.ImageWatermark = java.import("com.groupdocs.watermark.watermarks.ImageWatermark");
exports.Margins = java.import("com.groupdocs.watermark.watermarks.Margins");
exports.MeasureValue = java.import("com.groupdocs.watermark.watermarks.MeasureValue");
exports.TextWatermark = java.import("com.groupdocs.watermark.watermarks.TextWatermark");
exports.TileOptions = java.import("com.groupdocs.watermark.watermarks.TileOptions");
exports.FileType = java.import("com.groupdocs.watermark.common.FileType");
exports.FormatFamily = java.import("com.groupdocs.watermark.common.FormatFamily");
exports.HorizontalAlignment = java.import("com.groupdocs.watermark.common.HorizontalAlignment");
exports.UnitOfMeasurement = java.import("com.groupdocs.watermark.common.UnitOfMeasurement");
exports.VerticalAlignment = java.import("com.groupdocs.watermark.common.VerticalAlignment");
exports.PdfAnnotationType = java.import("com.groupdocs.watermark.contents.PdfAnnotationType");
exports.PdfPageMarginType = java.import("com.groupdocs.watermark.contents.PdfPageMarginType");
exports.SpreadsheetAutoShapeType = java.import("com.groupdocs.watermark.contents.SpreadsheetAutoShapeType");
exports.SpreadsheetMsoDrawingType = java.import("com.groupdocs.watermark.contents.SpreadsheetMsoDrawingType");
exports.DiagramSearchableObjects = java.import("com.groupdocs.watermark.search.DiagramSearchableObjects");
exports.EmailSearchableObjects = java.import("com.groupdocs.watermark.search.EmailSearchableObjects");
exports.PdfSearchableObjects = java.import("com.groupdocs.watermark.search.PdfSearchableObjects");
exports.PresentationSearchableObjects = java.import("com.groupdocs.watermark.search.PresentationSearchableObjects");
exports.SpreadsheetSearchableObjects = java.import("com.groupdocs.watermark.search.SpreadsheetSearchableObjects");
exports.WordProcessingSearchableObjects = java.import("com.groupdocs.watermark.search.WordProcessingSearchableObjects");
exports.FontStyle = java.import("com.groupdocs.watermark.watermarks.FontStyle");
exports.MarginType = java.import("com.groupdocs.watermark.watermarks.MarginType");
exports.SizingType = java.import("com.groupdocs.watermark.watermarks.SizingType");
exports.TextAlignment = java.import("com.groupdocs.watermark.watermarks.TextAlignment");
exports.TileMeasureType = java.import("com.groupdocs.watermark.watermarks.TileMeasureType");
exports.TileType = java.import("com.groupdocs.watermark.watermarks.TileType");
exports.StreamBuffer = class StreamBuffer {
constructor() {
const self = java.newInstanceSync('com.groupdocs.watermark.contracts.StreamBuffer')
self.write = function (chunk) {
const array = Array.from(chunk)
const javaArray = java.newArray('byte', array)
self.__proto__.write.call(self, javaArray, 0, javaArray.length)
}
return self
}
}
/** STREAM METHODS * */
exports.License.setLicenseFromStream = function (license, licenseStream, callback) {
const inputStreamBuffer = new exports.StreamBuffer()
licenseStream.on('data', chunk => {
inputStreamBuffer.write(chunk)
})
licenseStream.on('end', () => {
let error
try {
license.setLicense(inputStreamBuffer.toInputStream())
} catch (err) {
error = err
}
callback(error)
})
}