property AttachmentType[Index: Integer]: WString; // read only
PDF file specification dictionary'si, gömülü yükün IANA MIME türünü kodlayan isteğe bağlı bir /Subtype adı taşıyabilir (örneğin application#2Fpdf, image#2Fpng, text#2Fcsv). PDFium Delphi Component PDF hex kaçışlarını çözer (#2F'i /'ye geri çevirir) ve değeri "application/pdf" veya "image/png" gibi sade bir Unicode stringi olarak sunar
Çıkarılan baytları nasıl yönlendireceğinize karar vermek için bu property'yi kullanın — örneğin application/pdf eklerini başka bir TPdf örneğinde satır içi açmak, resimleri bir TImage'e göndermek veya geri kalan her şeyi bir kaydetme penceresiyle kaydetmek. Yazar bir subtype kaydetmediyse property boş string döndürür; bu durumda AttachmentName üzerinde uzantı tahminine geri dönün
Property salt okunurdur. MIME girdisi, PDFium içinde ek oluşturulurken sabitlenir ve yerinde değiştirilemez; subtype'ı yeniden yazmanız gerekiyorsa yuvayı yeniden oluşturun
| Index | Integer. Zero-based attachment slot. Must satisfy 0 <= Index < AttachmentCount. Out-of-range indexes return an empty string. |
/Subtype'ı hiç yazmadı. Boş bir türü hata saymayın
var
I: Integer;
Mime, Name: string;
begin
Pdf1.FileName := 'mixed-attachments.pdf';
Pdf1.Active := True;
for I := 0 to Pdf1.AttachmentCount - 1 do
begin
Name := Pdf1.AttachmentName[I];
Mime := LowerCase(Pdf1.AttachmentType[I]);
if Mime = 'application/pdf' then
Memo1.Lines.Add('PDF: ' + Name)
else if StartsText('image/', Mime) then
Memo1.Lines.Add('Image: ' + Name)
else
Memo1.Lines.Add(Format('%s [%s]', [Name, Mime]));
end;
end;