Skip to content

Labels ​

Labels are the texts that the component shows, and the ones it announces to screen readers. They are in English by default. Pass the ones you want to change to the labels option, and the others keep their English text.

ts
const pic = new PaperPic(container, {
  src: '/receipt.jpg',
  labels: {
    apply: 'Aplicar',
    cancel: 'Cancelar',
    zoomLevel: percent => `Zoom ${percent} %`,
  },
})

Five labels are functions, because their text includes a value. A function is new each time it is created, and the viewer takes a new one as a change, so create the labels that hold functions once, and not on every render.

KeyEnglishUse
adjustAdjustThe button that opens the ruler of brightness and contrast
adjustmentLevelBrightness +30Function of the name and the value from -100 to 100, announced after moving the ruler of Adjust
adjustUnavailableNot available in black and whiteThe description of Adjust in black and white, which keeps it disabled
appliedChanges appliedAnnounced when the changes are applied
applyApplyThe button that applies the changes
applyErrorThe changes could not be appliedShown when Apply fails
brightnessBrightnessThe choice of brightness in Adjust, and the name of its ruler
cancelCancelThe button that leaves the edit mode
cancelToolCancel this toolThe button that closes a tool and discards its changes
confirmDoneThe button that closes a tool and keeps its changes
contrastContrastThe choice of contrast in Adjust, and the name of its ruler
cornerBottomLeftBottom left cornerThe name of a corner handle
cornerBottomRightBottom right cornerThe name of a corner handle
cornerKeysArrow keys move it, 10 times further with Shift. Enter finishes.The description of a corner handle: what the keys do, and that Enter finishes
cornerMovedTop left corner: 120, 80Function of the corner and its position in pixels of the image, announced after moving a corner
cornerSelectedTop left corner: tap where it goesFunction of the corner, shown and announced after pressing a corner handle, until a tap on the image moves it
cornerTopLeftTop left cornerThe name of a corner handle
cornerTopRightTop right cornerThe name of a corner handle
cropCropThe Crop button
cropHintDrag the cornersWhat to do in Crop
discardDiscardThe button that confirms losing the changes
discardQuestionDiscard your changes?The question before losing the changes
downloadDownloadThe download button
editEditThe button that starts editing
editBarEditing controlsThe name of the edit bar, for screen readers
editingEditingAnnounced when the edit mode starts
finishClean upThe Clean up button, and the name of its choice of finish
finishGrayGrayChooses gray in Clean up
finishLevelSensitivity 50%Function of the percent, announced after moving the ruler of Clean up
finishMonoBlack and whiteChooses black and white in Clean up
finishOriginalOriginalChooses the original tones in Clean up, which turns it off
finishSensitivitySensitivityThe name of the ruler of Clean up
fitHeightFit to heightThe button that fits the height of the image
fitWidthFit to widthThe button that fits the width of the image
flipFlipThe Flip button
inUseIn useThe description of Adjust or Clean up while its setting is in effect, which a dot shows
keepEditingKeep editingThe button that goes back to editing instead of losing the changes
loadErrorThe image could not be loadedShown when the image fails to load
loadingLoading imageShown while the image loads
paperPaper sizeThe name of the choice of paper size, in Straighten
paperA4A4Chooses A4 in Straighten
paperAutoAutoChooses the automatic proportions in Straighten
paperCardCardChooses the size of an ID or a bank card in Straighten
paperLetterLetterChooses US Letter in Straighten
perspectiveStraightenThe Straighten button
perspectiveFoundDocument found. Check its cornersShown and announced when Straighten finds the document
perspectiveHintDrag each corner to a corner of the documentWhat to do in Straighten
previewErrorThe changes could not be shownShown when an edit cannot be shown
processingApplying changesShown while Apply runs
redactRedactThe Redact button, and the name of its choice of color
redactAngleAngle 12°Function of the angle in degrees, announced after turning the area of Redact
redactAreaAreaThe area of Redact, which moves it as a whole
redactBlackBlackChooses black in Redact
redactHintDraw an area over what to hideWhat to do in Redact
redactTurnTurnThe handle that turns the area of Redact
redactTurnKeysArrow keys turn it 1 degree, or 10 with Shift. Enter finishes.The description of the handle that turns the area: what the keys do, and that Enter finishes
redactWhiteWhiteChooses white in Redact
redoRedoThe Redo button
rotateLeftRotate leftThe rotate button of the edit bar, and one of the two of a read-only viewer
rotateRightRotate rightThe other rotate button of a read-only viewer
toolbarImage controlsThe name of the toolbar, for screen readers
undoUndoThe Undo button
viewerImage viewerThe name of the area that shows the image, for screen readers
zoomInZoom inThe zoom in button, in the toolbar and in the panels of Crop and Straighten
zoomLevelZoom 150%Function of the percent, announced after zooming from the toolbar or the keyboard
zoomOutZoom outThe zoom out button, in the toolbar and in the panels of Crop and Straighten

Released under the MIT License.