Localization in GemBox.PdfViewer
If you want to use a language other than English, you can use localization options to change the viewer's text. You can either choose one of the preset languages or provide your own translations.
Out of the box, GemBox.PdfViewer supports these languages:
- English (en)
- German (de)
- Spanish (es)
You can pick the language when initializing the viewer. The following example shows how to initialize the viewer in German:
GemBoxPdfViewer.create({
container: "#viewer",
ui: {
localization: "de",
},
});
You can provide translations for other languages. The easiest option is to copy the following code and translate the texts into the desired language:
const translations = {
bookmarks: "Bookmarks",
thumbnails: "Thumbnails",
signatureOptions: "Signature options",
indexing: "of {number}",
printPrepare: "Preparing document for printing...",
thickness: "Thickness",
color: "Color",
fontSize: "Font Size",
opacity: "Opacity",
zoom: {
percentage: "{number}{'%'}",
automatic: "Automatic",
pageFit: "Page Fit",
pageWidth: "Page Width",
},
tooltips: {
sidePanelToggle: "Side Panel Toggle",
pinUnpinSidePanel: "Pin/Unpin Side Panel",
closeSidePanel: "Close Side Panel",
open: "Open",
download: "Download",
print: "Print",
digitalSignature: "Sign",
addSignature: "Add a Signature",
page: "Page",
previousPage: "Previous Page",
nextPage: "Next Page",
zoomIn: "Zoom In",
zoomOut: "Zoom Out",
textSelectionTool: "Text Selection Tool",
panMode: "Pan Mode",
annotationMode: "Annotation Mode",
more: "More",
closeSearch: "Close Search",
search: "Search",
previousMatch: "Previous Match",
nextMatch: "Next Match",
thumbnails: "Thumbnails",
bookmarks: "Bookmarks",
delete: "Delete",
addFreeText: "Add Free Text",
addHandDrawing: "Add Hand Drawing",
},
mobileMenu: {
selection: "Selection",
pan: "Pan",
annotation: "Annotation",
search: "Search",
},
digitalSignature: {
confirm: "Are you sure you want to sign the file?",
sign: "Sign",
password: "Password ...",
success: "Signing succeeded. You can now download the document.",
failed: "Signing failed.",
authorizationFailed: "Authorization of the signing failed.",
},
password: {
title: "Password Required",
description: "The document is protected. Please enter the password to view it.",
placeholder: "Password",
unlock: "Unlock",
},
signature: {
add: "Add",
cancel: "Cancel",
clear: "Clear signature",
dialogTitle: "Add a signature",
descriptionLabel: "Description (alt text)",
descriptionPlaceholder: "Description",
type: "Type",
draw: "Draw",
image: "Image",
typePlaceholder: "Type your signature",
drawPlaceholder: "Draw your signature",
imagePlaceholder: "Drag a file here to upload",
imageBrowseLink: "Or browse image files",
invalidFileFormatTitle: "Invalid File Format.",
invalidFileFormatDescription: "The provided file format is not supported for creating a signature.",
cantConvertImageTitle: "Unable to Convert Image",
cantConvertImageDescription: "There's an issue with converting the image into a usable signature format.",
sidePanel: {
eSignatureTitle: "Add e-signature",
eSignatureDescription: "Type, draw, or add image of the signature",
eSignatureButton: "Add signature",
digitalSignatureTitle: "Add digital signature",
digitalSignatureDescription: "Apply a digital signature to this document",
digitalSignatureButton: "Finish signing",
},
},
};
GemBoxPdfViewer.create({
container: "#viewer",
ui: {
localization: translations,
},
});Localization when using ASP.NET Core tag helper
When using tag helper, you can choose the present language when initializing the PDF viewer:
<gembox-pdfviewer style="width:600px; height:350px;" initial-document="./document.pdf" license-key="FREE-LIMITED-KEY">
<pdfviewer-localization locale="de" />
</gembox-pdfviewer>Or you can provide your own translations:
@{
var translationsJson = """
{
"bookmarks": "Bookmarks",
"thumbnails": "Thumbnails",
"indexing": "of {number}",
"printPrepare": "Preparing document for printing...",
"zoom": {
"percentage": "{number}{'%'}",
"automatic": "Automatic",
"pageFit": "Page Fit",
"pageWidth": "Page Width"
},
"tooltips": {
"sideMenuToggle": "Side Menu Toggle",
"open": "Open",
"download": "Download",
"print": "Print",
"page": "Page",
"previousPage": "Previous Page",
"nextPage": "Next Page",
"zoomIn": "Zoom In",
"zoomOut": "Zoom Out",
"textSelectionTool": "Text Selection Tool",
"panMode": "Pan Mode",
"more": "More",
"closeSearch": "Close Search",
"search": "Search",
"previousMatch": "Previous Match",
"nextMatch": "Next Match",
"pinUnpinToolbar": "Pin/Unpin Toolbar",
"closeToolbar": "Close Toolbar",
"thumbnails": "Thumbnails",
"bookmarks": "Bookmarks"
},
"mobileMenu": {
"selection": "Selection",
"pan": "Pan",
"search": "Search"
}
}
""";
}
<gembox-pdfviewer style="width:600px; height:350px;" license-key="FREE-LIMITED-KEY" initial-document="./document.pdf">
<pdfviewer-localization data="@translationsJson" />
</gembox-pdfviewer>