我正在使用iTextSharp从PDF文件中读取文本.但是,有时我无法提取文本,因为PDF文件只包含图像.我每天都下载相同的PDF文件,我想查看PDF是否已被修改.如果无法获得文本和修改日期,MD5校验和是否是判断文件是否已更改的最可靠方法?
如果是的话,一些代码样本会受到赞赏,因为我对密码学没有多少经验.
我有一个简单的应用程序,它使用C#Web Client类下载网站HTML.这是我正在使用的代码的精简样本:
WebClient wc = new WebClient();
wc.Headers.Add("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
htmlCode = wc.DownloadString("https://www.oig.hhs.gov/exclusions/exclusions_list.asp");
Run Code Online (Sandbox Code Playgroud)
网站证书似乎存在问题,因为我遇到了这个例外:
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel." "The remote certificate is invalid according to the validation procedure.
如果您将链接复制并粘贴到浏览器中,则需要您在允许您查看网站之前同意风险.它是一个政府网站,所以我不担心任何病毒或任何东西.有没有告诉网络客户端绕过这个问题,并继续访问该网站?
我有一个脚本的SQL Server代理作业我试图从服务器转移到我的本地数据库,但我收到此错误消息:
消息14234,级别16,状态1,过程sp_verify_job,行243指定的"@notify_email_operator_name"无效(sp_help_operator返回有效值).
双击错误消息甚至不会将我带到失败的行.有没有人以前得到过这个?
我正在iTextSharp阅读PDF文档的内容:
PdfReader reader = new PdfReader(pdfPath);
using (StringWriter output = new StringWriter())
{
for (int i = 1; i <= reader.NumberOfPages; i++)
output.WriteLine(PdfTextExtractor.GetTextFromPage(reader, i, new SimpleTextExtractionStrategy()));
reader.Close();
pdfText = output.ToString();
}
Run Code Online (Sandbox Code Playgroud)
99%的时间它运作得很好.但是,有一个PDF文件有时会抛出此异常:
找不到PDF标题签名.StackTrace:在iTextSharp.text.pdf.PRTokeniser.CheckPdfHeader()位于iTextSharp.text.pdf.PdfReader.ReadPdf(),位于Reader.PDF的iTextSharp.text.pdf.PdfReader..ctor(String filename,Byte [] ownerPassword) .DownloadPdf(String url)在C:\ Documents\Visual Studio中
令人讨厌的是我不能总是重现错误.有时候它有效,有时则不然.有谁遇到过这个问题?
我有一个简单的强类型视图,但我似乎无法在帖子后更新我的表单上的文本框.
这是我的模型:
public class Repair
{
public string Number { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
在我看来是一个TextBox:
@Html.TextBoxFor(x => x.Number)
Run Code Online (Sandbox Code Playgroud)
我试图在发布到我的控制器后更新文本框:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(Repair r)
{
r.Number = "New Value";
return View(r);
}
Run Code Online (Sandbox Code Playgroud)
即使我将Number设置为新值,文本框中的文本也不会更改.我究竟做错了什么?
这对我来说太奇怪了:
delete from GearsDev.dbo.Products
from GearsDev.dbo.Products as C
inner join #Common as M
on M.item = C.ItemNumber
Run Code Online (Sandbox Code Playgroud)
#Common 是一个临时表,但其余部分对我没有意义.
你怎么能有两个from条款?
我对捆绑脚本和样式文件的正确方法感到困惑.目前,我的BundleConfig.cs看起来像这样:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
"~/Scripts/knockout-{version}.js",
"~/Scripts/knockout-{version}.debug.js",
"~/Scripts/knockout-sortable.js"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
bundles.Add(new StyleBundle("~/bundles/BootStrapcss").Include(
"~/BootStrap/css/bootstrap.css",
"~/BootStrap/css/bootstrap-fileupload.css"));
bundles.Add(new StyleBundle("~/bundles/BootStrap").Include(
"~/BootStrap/tpg-main.css",
"~/BootStrap/tpg-internal.css"));
bundles.Add(new ScriptBundle("~/bundles/BootStrapjs").Include(
"~/BootStrap/js/bootstrap-fileupload.js",
"~/BootStrap/js/bootstrap.js")); …Run Code Online (Sandbox Code Playgroud) 
通常情况下,使用表格会非常容易,但是现在每个人都说桌子很糟糕.我的大多数网络表单都是这样的:
[标签] [文本框]
[标签] [文本框]
[label] [combobox] [textbox]
我只是希望一切都整齐排列.
*编辑:为了澄清,我没有使用表格来布局我的网页表格.这是使用CSS完成的.但是,从一些评论来看,似乎表格可以排列我的控件.我认为这可能是最好的解决方案......
我的表单上有一个<select>元素,其 multiple 属性设置为“true”。填充元素后,如何使用 jquery 选择列表中的最后一项?我希望以与单击鼠标选择项目相同的方式选择该项目:
