我的目标是在一个空白页(DIN A4)的 PDF 文件上绘制一张我不知道尺寸的上传图像。对于水平图像,我有一个包含一页水平空白页的 PDF 文件,对于垂直图像,我有一个包含一页垂直页的 PDF 文件。
\n\n到目前为止,这是我的代码:
\n\nFile image = convertMultipartFileToFile(file); //I get a MultipartFile from my RequestParam (Spring) - converting works fine\nBufferedImage awtImage = ImageIO.read(image);\n\nString path = "";\n\nif (awtImage.getWidth() > awtImage.getHeight()) {\n path = MyController.class.getResource("/pdf4ImageUploadHorizontal.pdf").getPath();\n} else {\n path = MyController.class.getResource("/pdf4ImageUploadVertical.pdf").getPath();\n}\n\npdf = new File(path);\nPDDocument doc = PDDocument.load(pdf);\nPDPage page = doc.getPage(0);\nint actualPDFWidth = 0;\nint actualPDFHeight = 0;\nif (awtImage.getWidth() > awtImage.getHeight()) {\n\n actualPDFWidth = (int) PDRectangle.A4.getHeight();\n actualPDFHeight = (int) PDRectangle.A4.getWidth();\n} else {\n actualPDFWidth = (int) PDRectangle.A4.getWidth();\n actualPDFHeight = …Run Code Online (Sandbox Code Playgroud) 我在 Delphi Firemonkey XE7 中为应用程序创建了一个 Stringgrid,并用我的 MySQL 数据库中的数据填充它。为了放大字体大小,我使用了以下代码:
procedure TFormSearchRecipient.sgRecipientDrawColumnCell(Sender: TObject;
const Canvas: TCanvas; const Column: TColumn; const Bounds: TRectF;
const Row: Integer; const Value: TValue; const State: TGridDrawStates);
var b : TRectF; border: integer;
begin
//following leaves in the end a border so that the marked item can be seen
b := bounds;
border:= 2;
b.Top := b.Top + border;
b.Left := b.Left - border;
b.Height := b.Height - 2 * border;
b.Width := b.Width - 2 * border; …Run Code Online (Sandbox Code Playgroud) 我正准备学习将MsWord与Delphi联系起来.小...非常小...我编写的程序正在工作,但我没有得到一个对象点后的提议.
我的代码(我复制了我认为可能有用的所有内容):
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ComObj, ComCtrls, Vcl.StdCtrls;
var
Form1: TForm1;
word, doc : Variant;
implementation
procedure TForm1.Button1Click(Sender: TObject);
begin
try
word := CreateOleObject('Word.Application');
word.Visible := true;
doc := word.Documents.Add();
word.Selection.Font.Name := ('Arial');
doc.Range.Text := 'The answer is 42.';
//doc.Save;
except
ShowMessage('Microsoft Word couldn''t start');
end;
end;
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我为什么在输入"word"后我没有得到任何功能或财产建议.或"doc." 以及如何解决这个问题?
提前致谢,
LEA
delphi ×2
delphi-xe7 ×2
firemonkey ×1
header ×1
image ×1
java ×1
ms-word ×1
object ×1
pdf ×1
pdfbox ×1
stringgrid ×1
variant ×1