Disable right-click menu in PdfViewer?
PdfViewerLocalizationProvider.CurrentProvider = new MyLocalizationProvider();} 自定義radPdfViewerNavigator1中文化選項
public class MyLocalizationProvider : PdfViewerLocalizationProvider
{
public override string GetLocalizedString(string id)
{
switch (id)
{
case PdfViewerStringId.ContextMenuCopy:
return "複製(&C)";
case PdfViewerStringId.ContextMenuSelectAll:
return "全選(&A)";
case PdfViewerStringId.ContextMenuDeselectAll:
return "取消全選(&D)";
case PdfViewerStringId.ContextMenuHand:
return "手形工具(&H)";
case PdfViewerStringId.ContextMenuSelection:
return "選取工具(&S)";
case PdfViewerStringId.ContextMenuPreviousPage:
return "上一頁(&P)";
case PdfViewerStringId.ContextMenuNextPage:
return "下一頁(&N)";
case PdfViewerStringId.ContextMenuPrint:
return "列印(&R)...";
case PdfViewerStringId.ContextMenuFind:
return "尋找下一個(&F)";
case PdfViewerStringId.NavigatorOpenButton:
return "打開";
case PdfViewerStringId.NavigatorPrintButton:
return "列印";
case PdfViewerStringId.RotateCounterclockwiseButton:
return "逆時針旋轉";
case PdfViewerStringId.RotateClockwiseButton:
return "順時針旋轉";
case PdfViewerStringId.NavigatorPreviousPageButton:
return "上一頁";
case PdfViewerStringId.NavigatorNextPageButton:
return "下一頁";
case PdfViewerStringId.NavigatorCurrentPageTextBox:
return "目前頁面";
case PdfViewerStringId.NavigatorTotalPagesLabel:
return "總頁數";
case PdfViewerStringId.NavigatorZoomInButton:
return "放大";
case PdfViewerStringId.NavigatorZoomOutButton:
return "縮小";
case PdfViewerStringId.NavigatorZoomDropDown:
return "縮放下拉選單";
case PdfViewerStringId.NavigatorHandToolButton:
return "移動工具";
case PdfViewerStringId.NavigatorSelectToolButton:
return "選取工具";
case PdfViewerStringId.NavigatorFindNextButton:
return "尋找下一個";
case PdfViewerStringId.NavigatorFindPreviousButton:
return "尋找上一個";
case PdfViewerStringId.NavigatorSearchTextBox:
return "搜尋";
case PdfViewerStringId.NavigatorNoResultMessage:
return "根據指定的條件找不到結果。";
case PdfViewerStringId.NavigatorNoResultMessageHeader:
return "資訊";
case PdfViewerStringId.NavigatorDefaultStrip:
return "預設工具列";
case PdfViewerStringId.PrintPreviewGroupBoxPreview:
return "預覽";
case PdfViewerStringId.PrintPreviewGroupBoxOrientation:
return "方向";
case PdfViewerStringId.PrintPreviewGroupBoxSettings:
return "設定";
case PdfViewerStringId.PrintPreviewButtonPrint:
return "列印";
case PdfViewerStringId.PrintPreviewButtonCancel:
return "取消";
case PdfViewerStringId.PrintPreviewButtonWatermark:
return "浮水印";
case PdfViewerStringId.PrintPreviewButtonSettings:
return "列印設定";
case PdfViewerStringId.PrintPreviewLabelPageSizeInches:
return "{0:F2} x {1:F2} 英吋";
case PdfViewerStringId.PrintPreviewLabelPageSizeCm:
return "{0:F2}公分 x {1:F2}公分";
case PdfViewerStringId.PrintPreviewLabelScale:
return "縮放: {0}%";
case PdfViewerStringId.PrintPreviewLabelCurrentPage:
return "第 {0} 頁,共 {1} 頁";
case PdfViewerStringId.PrintPreviewFormTitle:
return "列印預覽";
case PdfViewerStringId.PrintPreviewPrintError:
return "列印文件時發生錯誤!";
case PdfViewerStringId.PrintPreviewRadioPortrait:
return "直向";
case PdfViewerStringId.PrintPreviewRadioLandscape:
return "橫向";
case PdfViewerStringId.PrintPreviewRadioAuto:
return "自動";
case PdfViewerStringId.NavigatorFitToWidthButton:
return "符合寬度";
case PdfViewerStringId.NavigatorFitToPageButton:
return "符合頁面";
case PdfViewerStringId.PageThumbnailsLabel:
return "頁面縮圖";
case PdfViewerStringId.SaveButton:
return "另存新檔";
case PdfViewerStringId.CloseButton:
return "關閉";
case PdfViewerStringId.NavigatorShowSignatureButton:
return "簽章面板";
case PdfViewerStringId.SignatureDialogTitle:
return "簽章驗證狀態";
case PdfViewerStringId.SignaturePanel_Invalid:
return "至少有一個簽章無效。";
case PdfViewerStringId.SignaturePanel_Unknown:
return "至少有一個簽章有問題。";
case PdfViewerStringId.SignaturePanel_Valid:
return "已簽署且所有簽章都有效。";
case PdfViewerStringId.SignaturePropertiesDialogHeader:
return "簽章驗證狀態";
case PdfViewerStringId.SignaturePropertiesDialogViewModel_IsDocumentModified_False:
return "自此簽章套用後,文件未被修改。";
case PdfViewerStringId.SignaturePropertiesDialogViewModel_IsDocumentModified_True:
return "自簽章套用後,文件已被更改或損壞。";
case PdfViewerStringId.SignaturePropertiesDialogViewModel_SignatureIsInvalid:
return "簽章無效。";
case PdfViewerStringId.SignaturePropertiesDialogViewModel_SignatureIsUnknown:
return "簽章有效性未知。";
case PdfViewerStringId.SignaturePropertiesDialogViewModel_SignatureIsValid:
return "簽章有效,簽署者:";
case PdfViewerStringId.SignaturePropertiesDialogViewModel_SignerValidity_Unknown:
return "簽署者身份未知。";
case PdfViewerStringId.SignaturePropertiesDialogViewModel_SignerValidity_UntrustedRoot:
return "簽署者身份未知,因為它未包含在您的信任憑證清單中,且其父憑證均不受信任。";
case PdfViewerStringId.SignaturePropertiesDialogViewModel_SignerValidity_Valid:
return "簽署者身份有效。";
case PdfViewerStringId.SelectCertButton:
return "選取";
case PdfViewerStringId.SignButton:
return "簽署";
case PdfViewerStringId.EnterAPassTextBox:
return "輸入密碼";
case PdfViewerStringId.SelectCertTextBox:
return "選取憑證";
}
return base.GetLocalizedString(id);
}
}
We are experiencing a critical issue with the RadPdfViewer
control after upgrading to version 2024.4.1113. Previously, we were using version 2017.X and everything worked correctly.
After the upgrade, when some users try to load PDFs in the viewer, the documents are either:
Completely blank,
Filled with black squares,
Or displayed in a distorted/incorrect format.
The issue is inconsistent — the same PDF files that display incorrectly for some users render just fine for others. All users are accessing the same application via a Windows RDS (Remote Desktop Services) environment.
What makes this even more confusing is that:
The issue only affects certain users on the RDS server.
The exact same PDF can be opened successfully by one user but fails for another.
The application and environment are otherwise identical between users.
We’ve confirmed that the issue started only after upgrading the Telerik controls to the latest version.
Can you please assist us in identifying the cause and provide any recommendations or patches that could resolve this issue?
Environment:
Telerik UI for WinForms v2024.4.1113
Windows Server with RDS
.NET Framework version: 4.7.1
Application in VB.NET (WinForms)
Please let us know if any logs, test files, or further information is required.
Best regards,
André Borges,
F3M
Hi,
I've been struggling to work out how to export the current pdf page as shown in the pdfViewer after it has been rotated using controls in the pdfViewerNavigator. I'm trying to save the image in png format but it seems to export the page in the original orientation ignoring the applied rotation.
Also whilst searching the forum for a solution, I came across the code
this.radPdfViewer1.PdfViewerElement.CurrentPage.PageNo
but it appears that PageNo no longer exists in 2020.3.1020.
Currently i'm using
pdfViewer.ExportPage ( 0, _tempImageFileName, 1.0, true, ImageFormat.Png );
which exports the first page as a png, which works, I just need to save the currently selected page that may or may not have been rotated.
Is this possible, if so how ?
¡Hi everyone! I have this issue loading a pdf with the RadPdfViewer.
On the RadPdfViewer DataError event i got an InvalidOperationException with only the "Stack empty" messsage,
This is the stacktrace of the exception thown by the PdfExceptionEventArgs
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.Stack`1.Pop() at Telerik.Windows.Pdf.Documents.Fixed.FormatProviders.Old.Pdf.DocumentModel.PdfContext.RestoreGraphicState() at Telerik.Windows.Pdf.Documents.Fixed.FormatProviders.Old.Pdf.PdfReader.Parsers.ContentStreamParser.InvokeGeneralGraphicsStateOperator(String op, Object[] pars) at Telerik.Windows.Pdf.Documents.Fixed.FormatProviders.Old.Pdf.PdfReader.Parsers.ContentStreamParser.InvokeOperator(String op, Object[] pars)
Can you please tell me what could be the possible reason of this issue ? Thanks
PS. The file is on the zip attached
I have this code, and I just want to export all pages or a specific page from the loaded PDF in the RadPdfViewer, without saving the file to the computer.
The function RadPdfViewer.ExportPage returns a Bitmap, but when I assign the result of this function to a new variable of type Bitmap, an error occurs.
'1º Option - Work
For i As Integer = 1 To RadPdfViewer1.Document.Pages.Count
Dim guid As Guid = Guid.NewGuid
RadPdfViewer1.ExportPage(i, "C:\temp\" & guid.ToString() & ".pdf", 1, True, ImageFormat.Png)
Dim bitmap As Bitmap = New Bitmap("C:\temp\" & guid.ToString() & ".pdf")
Dim reader As BarcodeReader = New BarcodeReader With {
.AutoRotate = True,
.TryInverted = True
}
Dim result As Result = reader.Decode(bitmap)
If result Is Nothing Then Continue For
Dim decoded As String = result.ToString().Trim()
If decoded Is Nothing Then Continue For
If decoded <> TextBox1.Text Then TextBox1.Text = TextBox1.Text & vbNewLine & vbNewLine & decoded
bitmap.Dispose()
My.Computer.FileSystem.DeleteFile("C:\temp\" & guid.ToString() & ".pdf")
Next
'2 Option - Dont Work
Dim bitmap As Bitmap = RadPdfViewer1.ExportPage(1, 1, False, ImageFormat.Png)
'3º Option - Dont Work
For Each bitmap As Bitmap In RadPdfViewer1.ExportPages(1, False, ImageFormat.Bmp)
Dim reader As BarcodeReader = New BarcodeReader With {
.AutoRotate = True,
.TryInverted = True
}
Dim result As Result = reader.Decode(bitmap)
If result Is Nothing Then Continue For
Dim decoded As String = result.ToString().Trim()
If decoded Is Nothing Then Continue For
If decoded <> TextBox1.Text Then TextBox1.Text = TextBox1.Text & vbNewLine & vbNewLine & decoded
Next
Hi, I'm using a RadPdfViewer to show a Pdf.
If the pdf is signed the signatures panel is showed, but the signature is always showed as not valid, even if it is valid.
The error is that the "The signer's identity isunknown".
I tried also to call the SignatureField.Signature.Validate() method and it throws an exception like this:
No signature validation handler was found for the subfilter: ETSI.CAdES.detached
Any suggestion?
Thanks.
We have incomming PDF documents that have been annotated/marked up/stamped (we beleive using Adobe). When you view or print from Telerik the "annotations" are missing or wrongly formated.
Chrome and Edge both display the PDF correctly.
Are there any properties or techniques I can use to get Telerik PDF to include the annotations ?
Attached are the original PDF "PDFMarkUp.pdf" and the PDF as printed by Telerik "PDFMarkUpOUT.pdf" (Replicates the Telerik View )
How to convert PDF pages to images in .NET Framework app? I've scoured the site, and it seems you recommend something like this:
RadPdfViewer pdfViewer = new RadPdfViewer();
pdfViewer.DocumentLoaded += (sender, e) =>
{
if (sender is RadPdfViewerElement pdfViewerElement)
{
for (int i = 1; i <= pdfViewerElement.Document.Pages.Count; i++)
{
Image pageImage = pdfViewerElement.ExportPage(i, 1, true, ImageFormat.Jpeg);
// Use pageImage
}
}
};
pdfViewer.LoadDocument(pdfPath);
pdfViewer.LoadElementTree();
Application.DoEvents();
Is this really the best way for .NET Framework apps? There is an example that uses PdfProcessing instead of PdfViewer, but requires the assembly Telerik.Documents.Fixed.FormatProviders.Image.Skia, which I don't have available in my Visual Studio with latest update of Telerik UI for WinForms 2024.3.806.462. Nor is it available on nuget, or I don't know how to find it.
I'm using Visualstudio2022 Dark theme on my program. When I load a fillable PDF to the PDF viewer, the back color of the form fields turns to black when I click on them.
I tried changing the annotations color and the text color of the form fields, but nothing works.
How do I change the back color from black to white of the form fields on a fillable PDF?