将文件从MSword转换为PDF提取后,我收到错误 PDF标题签名未找到。
public void Extract_inputpdf()
{
text_input_File = string.Empty;
StringBuilder sb_inputpdf = new StringBuilder();
PdfReader reader_inputPdf = new PdfReader(path); //read PDF
for (int i = 0; i <=reader_inputPdf.NumberOfPages ; i++)
{
TextWithFont_inputPdf inputpdf = new TextWithFont_inputPdf();
text_input_File = iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(reader_inputPdf, i, inputpdf);
sb_inputpdf.Append(text_input_File);
input_pdf = sb_inputpdf.ToString();
}
reader_inputPdf.Close();
clear();
}
任何人都可以告诉我如何解决这个问题.Thanku
// word to pdf
if (Extentsion_path == ".doc" || Extentsion_path == ".docx")
{
uploadFInput.SaveAs(targetPathip);
string wordFileName = targetPathip;
_Word.Visible = false;
_Word.ScreenUpdating = false;
// Cast as Object for word Open method
filename = (object)wordFileName;
// Use the dummy value as a placeholder for optional arguments
Microsoft.Office.Interop.Word.Document doc = _Word.Documents.Open(ref filename, ref _MissingValue,
ref _MissingValue, ref _MissingValue, ref _MissingValue, ref _MissingValue, ref _MissingValue,
ref _MissingValue, ref _MissingValue, ref _MissingValue, ref _MissingValue, ref _MissingValue,
ref _MissingValue, ref _MissingValue, ref _MissingValue, ref _MissingValue);
doc.Activate();
object outputFileName = pdfFileName = Path.ChangeExtension(wordFileName, "pdf");
object fileFormat = WdSaveFormat.wdFormatPDF;
// Save document into PDF Format
doc.SaveAs(ref outputFileName, ref fileFormat, ref _MissingValue, ref _MissingValue,
ref _MissingValue, ref _MissingValue, ref _MissingValue, ref _MissingValue,
ref _MissingValue, ref _MissingValue, ref _MissingValue, ref _MissingValue,
ref _MissingValue, ref _MissingValue, ref _MissingValue, ref _MissingValue);
// Close the Word document, but leave the Word application open.
// doc has to be cast to type _Document so that it will find the
// correct Close method.
object saveChanges = WdSaveOptions.wdDoNotSaveChanges;
((_Document)doc).Close(ref saveChanges, ref _MissingValue, ref _MissingValue);
doc = null;
// word has to be cast to type _Application so that it will find
// the correct Quit method.
((_Application)_Word).Quit(ref _MissingValue, ref _MissingValue, ref _MissingValue);
_Word = null;
//uploadFInput.SaveAs(pdfFileName);
// = targetPathip;
uploadFInput.SaveAs(pdfFileName);
LblFleip.Text = pdfFileName;
}
else
{
uploadFInput.SaveAs(targetPathip);
LblFleip.Text = targetPathip;
}
答案 0 :(得分:2)
您可以在记事本中打开PDF文件并首先检查签名存在。