I successfully added AcroPDF in my application. When a PDF needs to be displayed I create an instance of AcroPDF dynamically and insert it into a TPanel with align set to alClient. My problem is that when the Form/Panel is resized the AcroPDF does not follow. Only if a new file is loaded. I tried several solutions to no avail. What should I do?
A:
Have a look of EzPDFlibrary PDF SDK, it can display PDF without Acrobat /AcroPDF.
Sarah
2010-10-27 12:27:25
AcroPDF does what I need. No need to purchase a third-party library if Adobe already provides what I want.
Eduardo Mauro
2010-10-27 12:35:40
+1
A:
It's a problem with recent versions of the Adobe OCX control, which you can work around by refocusing the control. In a preview dialog I have (which has an embedded, client-aligned AcroPdf control) I use the following OnResize
handler for the form:
if Visible and (fPreviewV7 <> nil) then begin
FocusControl(nil);
FocusControl(fPreviewV7);
end;
mghie
2010-10-27 13:16:12
+1
A:
If you use ActiveX from version 9 of Acrobat Reader try this code in OnResize event of TPanel:
procedure TForm.PanelResize(Sender: TObject);
var
rc: TRect;
h: THandle;
begin
if Assigned(AcroPdf) then
begin
if (Windows.GetClientRect(AcroPdf.Handle, rc)) then
begin
h := Windows.FindWindowEx(AcroPdf.Handle, 0, PChar('Static'), nil);
if (h <> 0) then
Windows.MoveWindow(h, 0, 0, rc.Right - rc.Left, rc.Bottom - rc.Top, True);
end;
end;
end;
The problem in that the child window of main AcroPdf window is not resized. So we found it by it's class name "Static" and manually move it to fill whole parent window. This code can not work on other versions of Acrobat Reader, because the window hierarchy and class name's may differ.
Schnider
2010-10-27 13:59:07