请教各位达人,DELPHI下如何读取,编辑PDF文件?(200)

Discussion in 'ActiveX 控件' started by vclsaga, Nov 3, 2010.

  1. vc

    vclsaga New Member Member

    问题同上。我目前安装的PDF控件有:Synactis In-The-BoxeDocEnginePowerPdf但都没有编辑PDF的功能(也可能是我没找到)请教各位达人,有什么免费的控件没有?谢谢!!!
     
  2. hn

    hnnycmr New Member Member

    http://www.fuxinsoftware.com.cn/downloads/里面有试用版的SDK或使用dll
     
  3. vc

    vclsaga New Member Member

    感谢 hnnycmr这个是试用的,我找到个破解的,可以实现我的功能PDFlib-7.0.5-MSWin32下载地址:http://berlin.soft-ware.net/dl/awaommeved/p01075/2010051015/PDFlib-7.0.5-MSWin32.zip破解下载地址:http://download.csdn.net/down/1226567/zhupf公布代码:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, gtCstDocEng, gtClasses, gtCstPlnEng, gtCstPDFEng, gtExPDFEng, gtPDFEng, StdCtrls, gtCstSpdEng, gtQProEng, OleServer, PDFlib_com_TLB, ShellAPI;type TForm1 = class(TForm) Button1: TButton;
    PDF1: TPDF;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    private { Private declarations } public { Public declarations } end;
    var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);var infile: string;
    starpage, endpage, font: Integer;
    //起始页,终止页 i, manual, page: integer;
    //循环变量,PDF句柄,PDF页句柄 pageno: Integer;
    pageno_s: string;
    optlist: string;begin
    infile := ExtractFilePath(Application.ExeName) + 'label.PDF';
    PDF1.set_parameter('license', 'w700602-009100-731090-Y6WPH2-5SE4A2');
    if PDF1.begin
    _document('New.pdf', '')=-1 then
    begin
    ShowMessage('错误:'+pdf1.get_errmsg());
    Exit;
    end;

    PDF1.set_info('Creator','zhaowei');
    PDF1.set_info('Author','zhaowei');
    PDF1.set_info('Title', 'PDF');
    manual := PDF1.open_pdi_document(infile, '');
    if manual=-1 then
    begin
    ShowMessage('错误:'+pdf1.get_errmsg());
    Exit;
    end;

    endpage := Round(PDF1.pcos_get_number(manual, 'length:pages'));
    for pageno:=1 to endpagedo
    begin
    //Font := PDF1.load_font('Arial','winansi','');
    //PDF1.setfont(font, 18);
    page := pdf1.open_pdi_page(manual, pageno, '');
    PDF1.begin
    _page_ext(500, 790, '');
    PDF1.fit_pdi_page(page, -155, -2, '');
    PDF1.end_page_ext('');
    PDF1.close_pdi_page(page);
    end;

    //for pageno:=1 to endpagedo
    //begin
    //page := PDF1.open_pdi_page(manual, pageno, '');
    //if page=-1 then
    Continue;
    //PDF1.begin
    _page_ext(500, 790, '');
    //PDF1.fit_pdi_page(page, 0, 0, 'boxsize={500 790} fitmethod=meet');
    //PDF1.end_page_ext('');
    //PDF1.close_pdi_page(page);
    //end;

    PDF1.end_document('');
    PDF1.close_pdi_document(manual);end;
    procedure TForm1.FormCreate(Sender: TObject);var s: string;begin
    s :='regsvr32 '+ExtractFilePath(Application.ExeName) + 'pdflib_com.dll /s';
    WinExec(PChar(s), SW_HIDE)end;
    end.