• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

DelphiPdf的使用方法

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
此方法安装了llPDFLib.v3.6 控件、对pdf左侧、右侧正文进行了操作。

procedure TForm1.Button1Click(Sender: TObject);
var node,nd1:TPDFOutlineNode;
    PW,ph:integer;
    bmp:TBitmap;
begin
  bmp:=TBitmap.Create;
  bmp.LoadFromFile('d:\4601.bmp');
  sPdf:=TPDFDocument.Create(nil);
  //pdf文档信息
  sPdf.DocumentInfo.CreationDate:=Now;
  sPdf.DocumentInfo.Producer:='Producer';
  sPdf.DocumentInfo.Author:='Author';
  sPdf.DocumentInfo.Creator:='Creator';
  sPdf.DocumentInfo.Keywords:='Keywords';
  sPdf.DocumentInfo.Subject:='subject';
  sPdf.DocumentInfo.Title:='Title';

  sPdf.FileName:='d:\tt.pdf';
  sPdf.Compression:=ctFlate;
  spdf.OwnerPassword:='123';
  sPdf.ProtectionEnabled:=True;
  sPdf.PageMode:= pmUseOutlines;
  sPdf.AutoLaunch:=true;
  sPdf.PageLayout:=plSinglePage;

  sPdf.BeginDoc;
  node:=sPdf.Outlines.Add(nil,'目录1',TPDFGoToPageAction.Create,GB2312_CHARSET);
  node.Expanded:=True;
  TPDFGoToPageAction(node.Action).PageIndex:=0;
  nd1:=sPdf.Outlines.AddChild(node,'第一章',TPDFGoToPageAction.Create,GB2312_CHARSET);
  nd1.Expanded:=true;
  TPDFGoToPageAction(nd1.Action).PageIndex:=0;
  pw:=sPdf.PageWidth;
  ph:=sPdf.PageHeight;
  sPdf.CurrentPage.SetActiveFont('黑体',[fsUnderline],50,GB2312_CHARSET);
  with sPdf do
  begin
    Canvas.Font.Size:=50;
    Canvas.Font.Color:=clRed;
    Canvas.Font.Style:=[fsBold,fsUnderline];
    Canvas.MoveTo(0,10);
    Canvas.LineTo(PW,10);
    SetTextAlign(sPdf.Canvas.Handle, TA_CENTER or TA_TOP); //居中
    Canvas.TextOut(Round(pw/2),30,'新的故事就要开始了');
    Canvas.TextOut(50,30,IntToStr(pw)+','+inttostr(ph));
    Canvas.MoveTo(0,50);
    Canvas.LineTo(PW,50);
    Canvas.Draw(100,100,bmp);
  end;
  sPdf.NewPage;
  nd1:=sPdf.Outlines.AddChild(node,'第二章',TPDFGoToPageAction.Create,GB2312_CHARSET);
  nd1.Expanded:=true;
  TPDFGoToPageAction(nd1.Action).PageIndex:=1;
  sPdf.EndDoc;
  sPdf.Free;
  bmp.Free;
end;

  


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
四大机器学习编程语言对比:R、Python、MATLAB、Octave发布时间:2022-07-18
下一篇:
Delphi2009[Tiburon]正式版的一些升级说明发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap