يوفر losLab PDF Library لمحترفي Delphi وC++Builder محرك PDF مع مصدر متاح لسير عمل سطح المكتب والخادم وDLL وActiveX وDylib، مع فحوص PDF/A وPDF/UA ودعم توقيع PAdES وخيارات عرض متعددة دون خدمة PDF خارجية.
هذه المقالة موجّهة إلى teams building PDF analysis, migration, search, evidence capture, or support-inspection tools. وهي تتعامل مع استخراج النصوص والصور والخطوط كجزء من هندسة المستندات في بيئة الإنتاج، لا كاستدعاء سريع لمكوّن.
الخطر العملي هو أن extraction output is easy to over-trust even though PDF content order, font encoding, image color spaces, and page resources rarely match user-visible reading order exactly. لذلك يحتاج المسار إلى عقد واضح وتشخيص قابل للملاحظة وملفات اختبار واقعية.
قرارات البنية
Separate extraction facts from interpretation. whether output needs visual order, content-stream order, or search-oriented order / image extraction format, color conversion, compression retention, and naming
- whether output needs visual order, content-stream order, or search-oriented order
- image extraction format, color conversion, compression retention, and naming
- font subset naming, encoding diagnostics, and missing ToUnicode handling
- confidence flags for OCR layers, hidden text, clipped content, and rotated pages
مسار التنفيذ
Preserve page and resource context. The order below keeps the workflow reviewable for Delphi and C++Builder teams.
- scan page resources and content streams while preserving object references
- extract text runs with coordinates, font identity, Unicode mapping, and style signals
- extract images with page location, dimensions, color space, and original object data when needed
- classify fonts by subset, embedded status, and encoding behavior
- produce an analysis report that distinguishes facts from inferred reading order
أدلة التحقق
Extraction evidence that remains explainable. Keep these fields with the output or support record.
- page number, object reference, coordinates, decoded text, font, and confidence
- image size, color space, compression, mask, and export filename
- font subset name, embedded state, encoding map, and ToUnicode status
- warnings for hidden, clipped, rotated, or overlapping content
Extracted text is not always authored text
A professional extraction workflow should record where each text run, image, and font resource came from, how it was decoded, and which assumptions were used to group it into searchable or reviewable content.
تصميم حزمة الدعم
بمجرد نشر PDFlibPas، تكون حزمة الدعم الأكثر فائدة هي التي تشرح المدخلات والملف التعريفي والمخرجات والمرحلة الدقيقة التي فشلت
- page number, object reference, coordinates, decoded text, font, and confidence
- image size, color space, compression, mask, and export filename
- font subset name, embedded state, encoding map, and ToUnicode status
- warnings for hidden, clipped, rotated, or overlapping content
- terminology snapshot: text extraction, image extraction, font resource, ToUnicode
ملاحظات المراجعة الهندسية حول استخراج النصوص والصور والخطوط
استخدم ملاحظات المراجعة هذه للتأكد من أن الميزة تجاوزت مرحلة العرض التجريبي ويمكن الدفاع عنها أثناء الإصدار والدعم وتصعيد العملاء
- القرار: whether output needs visual order, content-stream order, or search-oriented order. نقطة الضغط في التنفيذ: extract text runs with coordinates, font identity, Unicode mapping, and style signals. دليل القبول: font subset name, embedded state, encoding map, and ToUnicode status. محفز الانحدار: OCR layers can contain stale or misaligned text over scanned pages
- القرار: image extraction format, color conversion, compression retention, and naming. نقطة الضغط في التنفيذ: extract images with page location, dimensions, color space, and original object data when needed. دليل القبول: warnings for hidden, clipped, rotated, or overlapping content. محفز الانحدار: PDF drawing order may not equal human reading order
- القرار: font subset naming, encoding diagnostics, and missing ToUnicode handling. نقطة الضغط في التنفيذ: classify fonts by subset, embedded status, and encoding behavior. دليل القبول: page number, object reference, coordinates, decoded text, font, and confidence. محفز الانحدار: ligatures and custom encodings can make copied text differ from visible text
- القرار: confidence flags for OCR layers, hidden text, clipped content, and rotated pages. نقطة الضغط في التنفيذ: produce an analysis report that distinguishes facts from inferred reading order. دليل القبول: image size, color space, compression, mask, and export filename. محفز الانحدار: images may be masks, soft masks, or repeated resources rather than standalone pictures
- القرار: whether output needs visual order, content-stream order, or search-oriented order. نقطة الضغط في التنفيذ: scan page resources and content streams while preserving object references. دليل القبول: font subset name, embedded state, encoding map, and ToUnicode status. محفز الانحدار: OCR layers can contain stale or misaligned text over scanned pages
- القرار: image extraction format, color conversion, compression retention, and naming. نقطة الضغط في التنفيذ: extract text runs with coordinates, font identity, Unicode mapping, and style signals. دليل القبول: warnings for hidden, clipped, rotated, or overlapping content. محفز الانحدار: PDF drawing order may not equal human reading order
- القرار: font subset naming, encoding diagnostics, and missing ToUnicode handling. نقطة الضغط في التنفيذ: extract images with page location, dimensions, color space, and original object data when needed. دليل القبول: page number, object reference, coordinates, decoded text, font, and confidence. محفز الانحدار: ligatures and custom encodings can make copied text differ from visible text
الحالات الحدية
- PDF drawing order may not equal human reading order
- ligatures and custom encodings can make copied text differ from visible text
- images may be masks, soft masks, or repeated resources rather than standalone pictures
- OCR layers can contain stale or misaligned text over scanned pages
ملاحظات Delphi / C++Builder
PDFlibPas should sit behind a small service boundary that receives files, streams, profiles, and credentials, then returns output paths, warnings, metrics, and validation status. تشمل المصطلحات المهمة text extraction, image extraction, font resource, ToUnicode, content stream, coordinates.
مثال كود Delphi
يوضح مخطط Delphi التالي حد خدمة عمليًا لهذا الموضوع. اجعل فحوص السياسة والتسجيل والتحقق خارج جزء استدعاء المنتج الضيق حتى يبقى سير العمل قابلاً للاختبار.
procedure ExtractForIndexing(const FileName, OutputDir: string);
var
Pdf: TPDFlib;
begin
Pdf := TPDFlib.Create;
try
Pdf.LoadFromFile(FileName, '');
SaveExtractedText(OutputDir, ExtractDocumentText(Pdf));
SaveEmbeddedImages(OutputDir, ExtractDocumentImages(Pdf));
SaveFontInventory(OutputDir, BuildFontInventory(Pdf));
finally
Pdf.Free;
end;
end;
قائمة فحص الإنتاج
- شغّل سير العمل على ملف فارغ وملف عميل عادي وملف أسوأ حالة
- افتح ملف PDF الناتج في العارض أو المدقق أو الطابعة أو التطبيق اللاحق المستهدف
- سجّل إصدار المنتج وإصدار الملف التعريفي وتجزئة الإدخال ومسار الإخراج والوقت المنقضي وعدد التحذيرات
- احتفظ بكلمات المرور والشهادات والملفات المؤقتة وبيانات العملاء وفق قواعد احتفاظ واضحة
- أضف مستندات انحدار عندما يكشف ملف عميل عن حالة حدية جديدة
توثيق المنتج
أمثلة كود إضافية
var
ImgList, I: Integer;
begin
Pdf.SelectPage(1);
ImgList := Pdf.GetPageImageList(0);
for I := 0 to Pdf.GetImageListCount(ImgList) - 1 do
begin
Writeln(Pdf.GetImageListItemFormatDesc(ImgList, I, 0));
Pdf.SaveImageListItemDataToFile(ImgList, I, 0,
Format('page1-img%.2d.bin', [I]));
end;
Pdf.ReleaseImageList(ImgList);
end;var
I: Integer;
begin
Pdf.FindFonts;
for I := 1 to Pdf.FontCount do // font indexes start at 1, not 0
if Pdf.SelectFont(Pdf.GetFontID(I)) = 1 then
Writeln(Format('%s type=%d embedded=%d subset=%d',
[Pdf.FontName, Pdf.FontType,
Pdf.GetFontIsEmbedded, Pdf.GetFontIsSubsetted]));
end;