TAcroPDF loses resolution after form has resized

坚强是说给别人听的谎言 提交于 2020-01-07 03:26:08

问题


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


回答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.



来源:https://stackoverflow.com/questions/23081551/tacropdf-loses-resolution-after-form-has-resized

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!