PDFium Component Docs

AddJpegImage Yöntem

Bu API girdisi tanımlayıcıları, imzaları, kod bloklarını ve PDF terimlerini özgün biçiminde korur.
Bileşen: TPdf  ·  Birim: PDFium
Belirtilen koordinatları kullanarak geçerli PDF sayfasına JPEG görüntüsü ekler

Söz dizimi

function AddJpegImage(JpegImage: TStream; X, Y, Width, Height: Double): Boolean;

JpegImageTStream. Ham JPEG sıkıştırılmış veriyi içeren bir akış. Bu yöntem çağrıldığında akış konumu JPEG verisinin başında olmalıdır

Return Value

Döndürür: True JPEG verisi başarıyla çözümlenip sayfaya gömülürse True döndürür False if the stream does not contain valid JPEG data or if the embedding operation fails.

Açıklama

AddJpegImage embeds a JPEG image supplied as a raw byte stream onto the current PDF page. Because the JPEG data is passed directly without re-encoding, image quality is preserved exactly as stored in the source stream. This makes the method well-suited for high-volume document generation where decoding and re-compressing images would introduce unnecessary quality loss or CPU overhead.

The JpegImage akış, SOI işaretçisinden başlayan eksiksiz ve geçerli bir JPEG dosyası içermelidir. Bu yöntemi çağırmadan önce akışın geçerli konumu JPEG verisinin başında olmalıdır. Herhangi bir TStream descendant is accepted — TFileStream, TMemoryStream, database blob streams, and so on.

The X and Y parameters specify the lower-left corner of the placement rectangle in PDF user units (origin at page lower-left, Y increases upward). Width and Height sayfadaki işlenmiş boyutu ayarlayın; JPEG piksel boyutundan bağımsız olarak sığacak şekilde ölçeklenir

The method returns True on success. If the stream does not contain valid JPEG data, it returns False bir istisna yükseltmeden başarısız olabilir; bu nedenle kaynağı belirsiz verilerle çalışırken çağıranlar dönüş değerini denetlemelidir

Örnek

var
  Stream: TFileStream;
begin
  Stream := TFileStream.Create('C:\Images\photo.jpg', fmOpenRead or fmShareDenyNone);
  try
    Pdf1.NewPage(595, 842);
    if not Pdf1.AddJpegImage(Stream, 72, 400, 300, 225) then
      ShowMessage('Failed to embed JPEG image.');
  finally
    Stream.Free;
  end;
end;

Ayrıca bkz.

AddImage, AddPicture