An rvf document that contains tables and text like {*/SPXX/*} in few cell, this file rvf should be exported to pdf.
You have to search the text like {*/SPXX/*} inside the cells, get the text coordinate (Rect of Cell), store the coordinates, and delete the text {*/SPXX/*}.
At the time of export, you must create empty fields to be signed at the corresponding few cells:
create the signature field using the TPDFDigitalSignatureAnnotation.Create function to which the cell coordinates will be passed.
(for all {*/SPXX/*} result).
Can this be done?
Thanks
Create form field to export PDF - llPDFLib
-
- Posts: 16
- Joined: Tue Nov 10, 2009 7:27 pm
-
- Site Admin
- Posts: 17524
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Create form field to export PDF - llPDFLib
Ideas:
1) Search for fields, create a list of cells containing them. Remove fields. It must be done before formatting and drawing, because removing text may change positions of objects.
2) Assign OnDrawBorder event to tables. Draw nothing, but remember coordinates for cells that in the list created on the step 1.
1) Search for fields, create a list of cells containing them. Remove fields. It must be done before formatting and drawing, because removing text may change positions of objects.
2) Assign OnDrawBorder event to tables. Draw nothing, but remember coordinates for cells that in the list created on the step 1.
-
- Posts: 16
- Joined: Tue Nov 10, 2009 7:27 pm
Re: Create form field to export PDF - llPDFLib
This code find all
but
return TopLeft coord Table.
I need TopLeft coord Cell.
Thanks
Code: Select all
SetLength(Firme, 0);
while ActiveEditor.RichViewEdit.SearchText('{PS01}',[rvseoDown]) do begin
inc(i);
SetLength(Firme, i+1);
ActiveEditor.RichViewEdit.GetItemCoords(ActiveEditor.RichViewEdit.CurItemNo, Firme[i].X,Firme[i].Y);
Firme[i].page:=ActiveEditor.CurrentPage;
end
Code: Select all
ActiveEditor.RichViewEdit.GetItemCoords(ActiveEditor.RichViewEdit.CurItemNo, Firme[i].X,Firme[i].Y)
I need TopLeft coord Cell.
Thanks
-
- Site Admin
- Posts: 17524
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Create form field to export PDF - llPDFLib
I did not know you use ScaleRichView.
Yes, in this case you can use methods returning coordinates.
However, do not use methods of TRichViewEdit (i.e. TSRichViewEdit.RichViewEdit), they return coordinates in internal RichViewEdit, not coordinates on a page.
You can use TSRichViewEdit.GetItemCoords100 instead.
However, if you need cell coordinates, it's more difficult. There are no documented methods to get them. You can still use my advice about OnDrawBorder event.
Or, if you need a function, it is below. It returns coordinates of the cell containing the caret, relative to its page.
You can call it after SearchText, when the caret is in the correct cell.
There is one problem: the returned coordinates are scaled according to ActiveEditor.ZoomPercent. You can get size in 100% by multiplying coordinates in R by 100/ActiveEditor.ZoomPercent (by calling ActiveEditor.ZoomRectOut(R, ActiveEditor.ZoomPercent/100).
Or assign ActiveEditor.ZoomPercent = 100.
Yes, in this case you can use methods returning coordinates.
However, do not use methods of TRichViewEdit (i.e. TSRichViewEdit.RichViewEdit), they return coordinates in internal RichViewEdit, not coordinates on a page.
You can use TSRichViewEdit.GetItemCoords100 instead.
However, if you need cell coordinates, it's more difficult. There are no documented methods to get them. You can still use my advice about OnDrawBorder event.
Or, if you need a function, it is below. It returns coordinates of the cell containing the caret, relative to its page.
Code: Select all
var
RVData: TCustomRVFormattedData;
R, PageR: TRect;
begin
RVData := TCustomRVFormattedData(
ActiveEditor.RichViewEdit.TopLevelEditor.RVData.GetSourceRVData);
if not (RVData is TRVTableCellData) then
exit;
// Cell rect in coordinates relative to this cell
R := Rect(0, 0, TRVTableCellData(RVData).Width, TRVTableCellData(RVData).GetHeight);
// Cell rect in client coordinates of ActiveEditor.RichViewEdit
RVData.RotateRectFromDocToScreen(R, rvtrbAbsRoot);
// Cell rect in client coordinates of ActiveEditor
R.TopLeft := ActiveEditor.ConvertRVToSRV(R.TopLeft, ActiveEditor.RichViewEdit);
R.BottomRight := ActiveEditor.ConvertRVToSRV(R.BottomRight, ActiveEditor.RichViewEdit);
// Page rect in client coordinates of ActiveEditor
PageR := ActiveEditor.GetPageClientRect(ActiveEditor.CurrentPage);
// Cell rect in coordinates relative to this page
OffsetRect(R, -PageR.Left, -PageR.Top);
end;
There is one problem: the returned coordinates are scaled according to ActiveEditor.ZoomPercent. You can get size in 100% by multiplying coordinates in R by 100/ActiveEditor.ZoomPercent (by calling ActiveEditor.ZoomRectOut(R, ActiveEditor.ZoomPercent/100).
Or assign ActiveEditor.ZoomPercent = 100.
-
- Posts: 16
- Joined: Tue Nov 10, 2009 7:27 pm
Re: Create form field to export PDF - llPDFLib
It works perfectly with
Thanks
Code: Select all
ActiveEditor.ViewProperty.ZoomPercent:=100;