diff --git a/html/arabic/net/html-extensions-and-conversions/_index.md b/html/arabic/net/html-extensions-and-conversions/_index.md index a3dbf4135..1e5674bba 100644 --- a/html/arabic/net/html-extensions-and-conversions/_index.md +++ b/html/arabic/net/html-extensions-and-conversions/_index.md @@ -128,6 +128,10 @@ url: /ar/net/html-extensions-and-conversions/ تعلم كيفية إنشاء مستند HTML وحفظه كملف ZIP باستخدام C# ومكتبة Aspose.HTML خطوة بخطوة. ### [إنشاء PDF من HTML – دليل كامل مع Aspose.Html](./create-pdf-from-html-complete-guide-with-aspose-html/) +### [كيفية تحويل HTML إلى تدفق باستخدام معالج مخصص في C#](./how-to-convert-html-to-stream-with-a-custom-handler-in-c/) + +### [تحويل HTML إلى PDF بخط عريض ومائل باستخدام Aspose.HTML](./convert-html-to-pdf-with-bold-italic-font-using-aspose-html/) + ## خاتمة في الختام، تعد امتدادات HTML وتحويلاتها عناصر أساسية لتطوير الويب الحديث. يعمل Aspose.HTML for .NET على تبسيط العملية وجعلها في متناول المطورين من جميع المستويات. باتباع دروسنا التعليمية، ستكون على الطريق الصحيح لتصبح مطور ويب ماهرًا يتمتع بمجموعة واسعة من المهارات. diff --git a/html/arabic/net/html-extensions-and-conversions/convert-html-to-pdf-with-bold-italic-font-using-aspose-html/_index.md b/html/arabic/net/html-extensions-and-conversions/convert-html-to-pdf-with-bold-italic-font-using-aspose-html/_index.md new file mode 100644 index 000000000..8ae0a5685 --- /dev/null +++ b/html/arabic/net/html-extensions-and-conversions/convert-html-to-pdf-with-bold-italic-font-using-aspose-html/_index.md @@ -0,0 +1,242 @@ +--- +category: general +date: 2026-10-05 +description: تحويل HTML إلى PDF باستخدام Aspose.HTML مع إضافة أنماط الخط العريض والمائل. + تعلّم كيفية حفظ HTML كملف PDF وتخصيص خيارات العرض. +draft: false +images: +- PLACEHOLDER_URL/og-image.png +keywords: +- convert html to pdf +- save html as pdf +- add font style pdf +- set bold italic font +- aspose html pdf conversion +language: ar +lastmod: 2026-10-05 +og_description: تحويل HTML إلى PDF باستخدام Aspose.HTML، مع إضافة أنماط الخط الغامق + والمائل. يوضح هذا الدليل كيفية حفظ HTML كملف PDF، وتكوين مضاد التعرج، وضمان عرض + نص واضح وحاد. +og_image_alt: Screenshot of PDF generated from HTML using Aspose.HTML with bold‑italic + font +og_title: تحويل HTML إلى PDF بخط عريض ومائل باستخدام Aspose.HTML +schemas: +- author: Aspose + dateModified: '2026-10-05' + description: Convert HTML to PDF with Aspose.HTML while adding bold and italic font + styles. Learn how to save HTML as PDF and customize rendering options. + headline: Convert HTML to PDF with bold‑italic font using Aspose.HTML + type: TechArticle +- description: Convert HTML to PDF with Aspose.HTML while adding bold and italic font + styles. Learn how to save HTML as PDF and customize rendering options. + name: Convert HTML to PDF with bold‑italic font using Aspose.HTML + steps: + - name: Enable antialiasing for smoother images + text: Antialiasing reduces jagged edges on raster graphics. Setting `UseAntialiasing` + replaces the older `SmoothingMode` property and yields a cleaner visual result. + - name: Enable text hinting for clearer rendering + text: Text hinting aligns glyphs to pixel boundaries, which makes small fonts + easier to read. The `UseHinting` flag supersedes the older `TextRenderingHint`. + - name: Define bold and italic font style (set bold italic font) + text: Aspose.HTML represents font styles with the `WebFontStyle` flags. By combining + `Bold` and `Italic`, you instruct the renderer to apply both styles to any matching + text. + - name: Combine options and **save HTML as PDF** + text: Now that image, text, and font options are configured, you can invoke `Document.Save` + with the `HtmlSaveOptions` instance. The output file will be a PDF that reflects + all of the rendering tweaks. + - name: Full, runnable example + text: Putting all of the pieces together gives you a self‑contained program you + can copy, paste, and run. + type: HowTo +tags: +- Aspose.HTML +- C# +- PDF generation +- HTML-to-PDF +title: تحويل HTML إلى PDF بخط عريض ومائل باستخدام Aspose.HTML +url: /ar/net/html-extensions-and-conversions/convert-html-to-pdf-with-bold-italic-font-using-aspose-html/ +--- + +{{< blocks/products/pf/main-wrap-class >}} +{{< blocks/products/pf/main-container >}} +{{< blocks/products/pf/tutorial-page-section >}} + +# تحويل HTML إلى PDF مع خط عريض‑مائل باستخدام Aspose.HTML + +إذا كنت بحاجة إلى **تحويل HTML إلى PDF** وتريد أن يحافظ الناتج على النص العريض والمائل، يوضح لك هذا الدليل بالضبط كيفية القيام بذلك باستخدام Aspose.HTML. ستتعلم كيفية *حفظ HTML كـ PDF* مع تكوين خيارات العرض للحصول على صور ناعمة ونص واضح. + +يغطي الدليل كل شيء من تحميل ملف HTML المصدر إلى تعريف **نمط خط عريض‑مائل**، بحيث يمكنك إنتاج ملفات PDF ذات مظهر احترافي دون معالجة لاحقة إضافية. لا تحتاج إلى أدوات خارجية—فقط مكتبة Aspose.HTML for .NET. + +## المتطلبات المسبقة + +* .NET 6.0 أو أحدث مثبت +* Visual Studio 2022 (أو أي بيئة تطوير C#) +* رخصة صالحة لـ Aspose.HTML for .NET أو مفتاح تقييم مؤقت +* ملف HTML (`input.html`) تريد تحويله + +وجود هذه العناصر يضمن تشغيل الكود دون فقدان الاعتمادات. + +## تحويل HTML إلى PDF مع خيارات عرض مخصصة + +الخطوة الأولى هي تحميل مستند HTML وإنشاء مثال من `HtmlSaveOptions` سيحمل جميع تفضيلات العرض الخاصة بنا. هذا الكائن يخبر Aspose.HTML كيف يتعامل مع الصور والنصوص والخطوط أثناء **aspose html pdf conversion**. + +```csharp +using Aspose.Html; +using Aspose.Html.Rendering.Image; +using Aspose.Html.Rendering.Text; + +// Load the HTML document you want to convert +var document = new Document("YOUR_DIRECTORY/input.html"); + +// Create a container for all save options +var saveOptions = new HtmlSaveOptions(); +``` + +### تمكين مضاد التعرج للحصول على صور أكثر سلاسة + +مضاد التعرج يقلل من الحواف المتعرجة في الرسومات النقطية. ضبط `UseAntialiasing` يستبدل الخاصية القديمة `SmoothingMode` ويعطي نتيجة بصرية أنظف. + +```csharp +var imageOptions = new ImageRenderingOptions +{ + UseAntialiasing = true // smoother image rendering +}; + +saveOptions.ImageRenderingOptions = imageOptions; +``` + +### تمكين إرشاد النص للحصول على عرض أوضح + +إرشاد النص يضبط الحروف على حدود البكسل، مما يجعل الخطوط الصغيرة أسهل للقراءة. علم `UseHinting` يحل محل الخاصية القديمة `TextRenderingHint`. + +```csharp +var textOptions = new TextOptions +{ + UseHinting = true // clearer text rendering +}; + +saveOptions.TextOptions = textOptions; +``` + +### تعريف نمط الخط العريض والمائل (set bold italic font) + +يمثل Aspose.HTML أنماط الخط باستخدام أعلام `WebFontStyle`. من خلال دمج `Bold` و `Italic`، تقوم بإرشاد المُعالج لتطبيق كلا النمطين على أي نص مطابق. + +```csharp +var fontStyle = new WebFontStyle +{ + Style = WebFontStyle.Bold | WebFontStyle.Italic // set bold italic font +}; + +// Apply the style to the document's default font settings +document.DefaultFont = new FontSettings +{ + FontStyle = fontStyle +}; +``` + +> **نصيحة احترافية:** إذا كان HTML الخاص بك يحدد النص بالفعل باستخدام وسوم `` أو ``، فإن المُعالج يحترم هذه الوسوم تلقائيًا. نهج `WebFontStyle` الصريح مفيد عندما تريد فرض نمط عبر المستند بأكمله. + +### دمج الخيارات و **حفظ HTML كـ PDF** + +الآن بعد تكوين خيارات الصورة والنص والخط، يمكنك استدعاء `Document.Save` مع مثال `HtmlSaveOptions`. سيكون ملف الإخراج PDF يعكس جميع تعديلات العرض. + +```csharp +// Save the document as a PDF using the configured options +document.Save("YOUR_DIRECTORY/output.pdf", saveOptions); +``` + +### مثال كامل قابل للتنفيذ + +جمع كل الأجزاء معًا يمنحك برنامجًا مستقلًا يمكنك نسخه، لصقه، وتشغيله. + +```csharp +using Aspose.Html; +using Aspose.Html.Rendering.Image; +using Aspose.Html.Rendering.Text; +using Aspose.Html.Drawing; + +class Program +{ + static void Main() + { + // 1️⃣ Load the HTML document you want to convert + var document = new Document("YOUR_DIRECTORY/input.html"); + + // 2️⃣ Configure image rendering (antialiasing) + var imageOptions = new ImageRenderingOptions + { + UseAntialiasing = true + }; + + // 3️⃣ Configure text rendering (hinting) + var textOptions = new TextOptions + { + UseHinting = true + }; + + // 4️⃣ Define bold‑italic font style + var fontStyle = new WebFontStyle + { + Style = WebFontStyle.Bold | WebFontStyle.Italic + }; + document.DefaultFont = new FontSettings + { + FontStyle = fontStyle + }; + + // 5️⃣ Bundle all options into HtmlSaveOptions + var saveOptions = new HtmlSaveOptions + { + ImageRenderingOptions = imageOptions, + TextOptions = textOptions + }; + + // 6️⃣ Save the HTML as a PDF + document.Save("YOUR_DIRECTORY/output.pdf", saveOptions); + } +} +``` + +**الناتج المتوقع:** ملف باسم `output.pdf` موجود في `YOUR_DIRECTORY`. افتحه بأي عارض PDF وسترى محتوى HTML الأصلي معروضًا بصور ناعمة ونص **عريض‑مائل** حيثما ينطبق. + +## الأسئلة الشائعة وتعامل مع الحالات الطرفية + +| السؤال | الجواب | +|----------|--------| +| *ماذا لو كان HTML الخاص بي يستخدم خط ويب مخصص؟* | أضف ملف الخط إلى نفس المجلد الذي يحتوي على ملف HTML وأشر إليه باستخدام `@font-face` داخل كتلة `