0

Im creating PDF's with Debenu and saving them. Then AcroPDF.LoadFile loads the PDF. If I start my app and load a file, all is well. I can even resize with this PDF after loading. However, if I have resized my app in any way (doesn matter if it is back to the size i started) and then load, the PDF loses resolution.

The AcroPDF doesnt align and isnt anchored (doesnt matter if it is). And when I open the generated PDF with Arcobat Reader the resolution is great.

This problem only seems to occur with the generated PDF's. Not with any other

Here is my code:

procedure TForm1.Button1Click(Sender: TObject);
var
  PDF: TDebenuPDFLibraryDLL0915;
begin
  PDF := TDebenuPDFLibraryDLL0915.Create('DebenuPDFLibraryDLL0915.dll');
  try
    PDF.UnlockKey(Key);

    PDF.SelectPage(1);
    PDF.SetPageSize('a4');
    PDF.AddImageFromFile('c:\Tool\Picture.jpg', 0);
    PDF.DrawImage(0,842,595,842);
    PDF.SaveToFile('C:\Tool\Test.pdf');

    AcroPDF.LoadFile('C:\Tool\Test.pdf');
  finally
    PDF.Free;
  end;
end;

Software: Win7 64, Delphi XE5

Eszee
  • 264
  • 2
  • 14

1 Answers1

1

I would suggest not using the ACROPDF Library all together (I'm assuming you - imported the active x control - created a _TLB unit - created a visual component)

The problem you have is exactly the same as what I got plus a couple of others I found down the line:

  • If adobe launches a new version of READER (which they do a lot) you'll need to update your component(by updating your READER, importing the active X control and re-create the component). If you don't do this and you try to open a .PDF of a later version you'll get a COM exception.

  • There is NO forwards compatibility (as stated above)

  • Limited backwards compatability

I would suggest simply calling

ShellExecute(Handle, nil, PChar("c:\MyPDF.PDF"), nil,  nil, SW_SHOWNORMAL);

and let Windows call the default PDF editor (probably Adobe Reader) and let the default app do the work.

Ryno Coetzee
  • 516
  • 4
  • 13
  • Rgr. Thank you. I will use this for the time being. Do you know of a way tou launch the pdf within the app itself. Im writing an app that makes bills. The client will want to tweak the layout of the bill, so it would be convient if the end product could be refreshed within the app – Eszee Apr 17 '14 at 09:24
  • I believe this might help you : http://www.delphipages.com/forum/showthread.php?t=192496 – Ryno Coetzee Apr 17 '14 at 09:28
  • and this http://stackoverflow.com/questions/796883/how-to-shell-to-another-app-and-have-it-appear-in-a-delphi-form – Ryno Coetzee Apr 17 '14 at 09:35
  • verry nice, could the parent be a 'container' like a panel? – Eszee Apr 17 '14 at 09:37
  • nm, i think i found the answer here http://stackoverflow.com/questions/7611103/embedding-window-into-another-process – Eszee Apr 17 '14 at 09:45