Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
Important
With the release of Version 4 of PDFtoolkit, form field processing has got simpler. PDF-to-image conversion is much more simpler. A special article titled "Form Fields Creation and Processing Using PDFtoolkit v4" has been written for users of Version 4. This article has been left here for users of older versions of PDFtoolkit.
Last month in our series, we saw how to perform some basic tasks in meeting everyday PDF-related needs.
This month, we will see how to:
function ExtractText( APageNo: Integer): TgtWideStringList; function ExtractTextFormatted( APageNo: Integer): TgtWideStringList;This method extracts text from a specified page and returns the text in a
TStringList
.
PDFDoc: TgtPDFDocument; LStrList: TgtWideStringList; edExtPageno: TEdit; edExtTxtFileName: TEdit; edExtPageno: TEdit; rbExtTxt: TRadioButton; ... PDFDoc.LoadFromFile('input_file.pdf') ... if PDFDoc.IsLoaded then begin try LStrList := TgtWideStringList.Create; if rbExtTxt.Checked then // Extracts text without worrying about formatting LStrList := PDFDoc.ExtractText((edExtPageno.Text)) else // Extracts text with whatever formatting is possible LStrList := PDFDoc.ExtractTextFormatted( StrToInt(edExtPageno.Text)); LStrList.SaveToFile(edExtTxtFileName.Text); finally LStrList.Free; end; end;
procedure SetFormFieldValue(FieldName: string; Value: string);
Specify the field name and the new value, and its done.
edEditFormFieldName: TEdit; edNewValue: TEdit; ... if PDFDoc.IsLoaded then begin PDFDoc.SetFormFieldValue( edEditFormFieldName.Text, edNewValue.Text); end; SaveDocument;
TgtPDFFileAttachment
, specify the file that needs to be attached, specify the file name for the attachment in the PDF, location where the attachment icon will be, type of the icon used for the attachment, and call the method:
procedure InsertFileAttachment( AFile: TgtPDFFileAttachment; PageNumber: Integer); property FileAttachmentIcon: TgtFileAttachmentIcon read FFileAttachmentIcon write FFileAttachmentIcon; TgtFileAttachmentIcon = (faGraph, faPaperclip, faPushPin, faTag);Here is the code:
LFileAttach: TgtPDFFileAttachment; edAttachment: TEdit; edAttachmentName: TEdit; edAttachPageno: TEdit; ... try LFileAttach := TgtPDFFileAttachment.Create; // pathname of the attachment in the file system LFileAttach.FileName := edAttachment.Text; // name of the attachment in the document LFileAttach.AttachmentName := edAttachmentName.Text; // location of the attachment icon LFileAttach.SetBounds(50,50,300,300); // type of the attachment icon LFileAttach.FileAttachmentIcon := faGraph; // Insert the attachment PDFDoc.InsertFileAttachment( LFileAttach, StrToInt(edAttachPageno.Text)); SaveDocument; finally LFileAttach.Free; end;
Downloads:
---o0O0o---
Our .NET Developer Tools | |
---|---|
Gnostice Document Studio .NETMulti-format document-processing component suite for .NET developers. |
PDFOne .NETA .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications. |
Our Delphi/C++Builder developer tools | |
---|---|
Gnostice Document Studio DelphiMulti-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms. |
eDocEngine VCLA Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools. |
PDFtoolkit VCLA Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents. |
Our Java developer tools | |
---|---|
Gnostice Document Studio JavaMulti-format document-processing component suite for Java developers. |
PDFOne (for Java)A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications. |
Our Platform-Agnostic Cloud and On-Premises APIs | |
---|---|
StarDocsCloud-hosted and On-Premises REST-based document-processing and document-viewing APIs |
Privacy | Legal | Feedback | Newsletter | Blog | Resellers | © 2002-2024 Gnostice Information Technologies Private Limited. All rights reserved. |