简体   繁体   English

如何在Pdf Winforms C#中突出显示文本

[英]How to highlight text in Pdf Winforms C#

I have a pdf file which I want to open in a Windows Forms Application and perform following tasks- 我有一个要在Windows窗体应用程序中打开并执行以下任务的pdf文件:

  1. View the pdf document 查看pdf文件
  2. Zoom +/- document 缩放+/-文件
  3. Search Text 搜寻文字
  4. Highlight a specific text 高亮显示特定文字
  5. Show it in a listbox/dropdown 在列表框/下拉列表中显示
  6. select those words and highlight in pdf 选择这些单词并在pdf中突出显示
  7. Remove selection/Highlight. 删除选择/突出显示。

I have tried using certain libraries like pdfSharp/iTextSharp even Acrobat Reader OCX control. 我尝试使用某些库,例如pdfSharp / iTextSharp甚至Acrobat Reader OCX控件。

Its really bugging me..is there any help?? 它真的困扰我..有什么帮助吗?

I'd suggest looking at some means of converting the PDF if you don't have a direct need to edit it. 如果您不需要直接编辑PDF,建议您考虑一些转换PDF的方法。 Even then, it may be easier to convert to a different form, make changes, and then convert back. 即使那样,转换为其他形式,进行更改然后再转换回来也可能会更容易。 PDF is a form of PostScript, which makes it powerful, but also makes it a mess to deal with and my personal preference is to skip that headache. PDF是PostScript的一种形式,它使它功能强大,但也使处理过程变得一团糟,我个人的喜好是避免头痛。 Not always avoidable (had a lot of fun creating Thai support in PDF print@home ticket creation once without bloating the document beyond unusable), but highly recommended where possible. 并非总是可以避免的(一次在创建PDF print @ home票证中创建泰文支持而又不会使文档膨胀到无法使用的程度很有趣),但强烈建议在可能的情况下使用。

Anyways, there are a variety of PDF conversion libraries out there, some of which may be available for .NET. 无论如何,那里有各种各样的PDF转换库,其中一些可用于.NET。 Worst case, you may need to create a managed C++ layer to allow your C# code to access them. 最坏的情况是,您可能需要创建一个托管C ++层,以允许您的C#代码访问它们。

Doesn't acrobat reader OCX already have all those features ? Acrobat Reader OCX是否已经具有所有这些功能? What exactly doesnt the OCX do that you need to do in your code ? OCX在代码中究竟不需要做什么?

You might try contacting Adobe and getting their full SDK for PDF. 您可以尝试联系Adobe并获取其完整的PDF SDK。 It might have controls which you can use to solve your problem. 它可能具有可用于解决问题的控件。

Come to think of it , is there even an SDK for PDF from Adobe ? 想一想,甚至还有Adobe的PDF的SDK吗?

You have not mentioned your preference of using Free or Commercial PDF Viewer option. 您尚未提到使用“免费”或“商业PDF查看器”选项的偏好。 If you are open to use Commercial PSF viewer, you may evaluate SyncFusion PDF Viewer control , Telerik PDF Viewer , Dynamic PDF Viewer or TallComponents . 如果您愿意使用Commercial PSF Viewer,则可以评估SyncFusion PDF Viewer控件Telerik PDF ViewerDynamic PDF ViewerTallComponents I have checked feature set and all seem to have features you are looking for. 我已经检查了功能集,似乎都在寻找您想要的功能。 I do not represent or promote any of these SDKs, I have used TallComponents and Dynamic PDF for PDF manipulation and both have excellent support, I would say PDF Veterans in .NET space. 我不代表或宣传这些SDK中的任何一个,我使用TallComponents和Dynamic PDF进行PDF操作,并且都具有出色的支持,我想说.NET空间中的PDF退伍军人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM