나는 WinForms 응용 프로그램. 내가 사용하는 pdf 파일을 암호를 다시 설정 값에서 pdf 파일로 저장되는 키 값 쌍(이메일:[email protected] 통:11111).
내가 무엇을 하고 싶:
읽 PDF 파일을 줄고 채우기 위해 적당한 텍스트 상자.
내가 무엇을 했:
public bool CreatePDF(string location, string email, string key)
{
if(location != "" && email != "" && key != "")
{
PdfWriter pdfwriter = new PdfWriter(location);
PdfDocument pdf = new PdfDocument(pdfwriter);
Document document = new Document(pdf);
Paragraph fields = new Paragraph("Email: "+email + "\n" + "Secret Key: "+key);
document.Add(fields);
document.Close();
return true;
}
else
{
return false;
}
}
public string ReadPDF(string location)
{
var pdfDocument = new PdfDocument(new PdfReader(location));
StringBuilder processed = new StringBuilder();
var strategy = new LocationTextExtractionStrategy();
string text = "";
for (int i = 1; i <= pdfDocument.GetNumberOfPages(); ++i)
{
var page = pdfDocument.GetPage(i);
text += PdfTextExtractor.GetTextFromPage(page, strategy);
processed.Append(text);
}
return text;
}
}
사전에 감사들!. 에 어떤 제안이 CreatePDF 도 환영합니다.