@@ -150,9 +150,6 @@ url: /ar/java/word-processing-formats/master-text-document-handling-java-groupdo
150150weight : 1
151151---
152152
153- {{< blocks/products/pf/main-wrap-class >}}
154- {{< blocks/products/pf/main-container >}}
155- {{< blocks/products/pf/tutorial-page-section >}}
156153
157154# كيفية إنشاء pdf من txt في Java باستخدام GroupDocs.Conversion
158155
@@ -232,11 +229,12 @@ Converter converter = new Converter();
2322291 . ** استيراد الفئات الضرورية**
233230 ` TxtLoadOptions ` يتيح لك تحديد ترميز ملف المصدر.
234231
235- ``` java
236- // Definition anchor: TxtLoadOptions configures how a text file is read before conversion.
237- TxtLoadOptions loadOptions = new TxtLoadOptions ();
238- ```
239- ``` java
232+ ``` java
233+ // Definition anchor: TxtLoadOptions configures how a text file is read before conversion.
234+ TxtLoadOptions loadOptions = new TxtLoadOptions ();
235+ ```
236+
237+ ``` java
240238import com.groupdocs.conversion.License ;
241239
242240License license = new License ();
@@ -246,23 +244,25 @@ license.setLicense("path/to/your/license.lic");
2462442 . ** حدد مسار ملف الإدخال**
247245 استبدل ` YOUR_DOCUMENT_DIRECTORY ` بالمسار المطلق لملف ` .txt ` الخاص بك.
248246
249- ``` java
250- String inputPath = " YOUR_DOCUMENT_DIRECTORY/sample.txt" ;
251- ```
252- ``` java
253- import com.groupdocs.conversion.options.load.TxtLoadOptions ;
254- import java.nio.charset.Charset ;
255- ```
247+ ``` java
248+ String inputPath = " YOUR_DOCUMENT_DIRECTORY/sample.txt" ;
249+ ```
250+
251+ ``` java
252+ import com.groupdocs.conversion.options.load.TxtLoadOptions ;
253+ import java.nio.charset.Charset ;
254+ ```
256255
2572563 . ** إنشاء وتكوين TxtLoadOptions**
258257 اضبط الترميز المطلوب، على سبيل المثال Shift_JIS للملفات اليابانية القديمة.
259258
260- ```java
261- loadOptions. setEncoding(" Shift_JIS" ); // Change to "UTF-8" or other charset as needed
262- ```
263- ``` java
264- String txtFilePath = " YOUR_DOCUMENT_DIRECTORY/yourfile.txt" ; // Input file path
265- ```
259+ ``` java
260+ loadOptions. setEncoding(" Shift_JIS" ); // Change to "UTF-8" or other charset as needed
261+ ```
262+
263+ ``` java
264+ String txtFilePath = " YOUR_DOCUMENT_DIRECTORY/yourfile.txt" ; // Input file path
265+ ```
266266
267267### تحويل مستند Txt
268268مع تحميل ملف النص بشكل صحيح، يصبح التحويل إلى PDF استدعاءً لطريقة واحدة.
@@ -274,36 +274,39 @@ license.setLicense("path/to/your/license.lic");
2742741 . ** استيراد فئات التحويل**
275275 ` PdfConvertOptions ` يتيح لك ضبط مخرجات PDF بدقة (مثل حجم الصفحة، الهوامش).
276276
277- ```java
278- // Definition anchor: PdfConvertOptions holds optional settings for PDF generation.
279- PdfConvertOptions pdfOptions = new PdfConvertOptions ();
280- ```
281- ``` java
282- TxtLoadOptions loadOptions = new TxtLoadOptions ();
283- loadOptions. setEncoding(Charset . forName(" shift_jis" ));
284- ```
277+ ``` java
278+ // Definition anchor: PdfConvertOptions holds optional settings for PDF generation.
279+ PdfConvertOptions pdfOptions = new PdfConvertOptions ();
280+ ```
281+
282+ ``` java
283+ TxtLoadOptions loadOptions = new TxtLoadOptions ();
284+ loadOptions. setEncoding(Charset . forName(" shift_jis" ));
285+ ```
285286
2862872 . ** حدد مسار ملف الإخراج**
287288 عدل ` YOUR_OUTPUT_DIRECTORY ` لتشير إلى المكان الذي تريد حفظ PDF فيه.
288289
289- ```java
290- String outputPath = " YOUR_OUTPUT_DIRECTORY/sample.pdf" ;
291- ```
292- ``` java
293- import com.groupdocs.conversion.Converter ;
294- import com.groupdocs.conversion.options.convert.PdfConvertOptions ;
295- ```
290+ ``` java
291+ String outputPath = " YOUR_OUTPUT_DIRECTORY/sample.pdf" ;
292+ ```
293+
294+ ``` java
295+ import com.groupdocs.conversion.Converter ;
296+ import com.groupdocs.conversion.options.convert.PdfConvertOptions ;
297+ ```
296298
2972993 . ** تهيئة المحول وإجراء التحويل**
298300 مرّر ` TxtLoadOptions ` لضمان تطبيق الترميز الصحيح أثناء التحويل.
299301
300- ```java
301- // Direct answer: Call converter.convert(inputPath, loadOptions, outputPath, pdfOptions) to produce the PDF.
302- converter. convert(inputPath, loadOptions, outputPath, pdfOptions);
303- ```
304- ``` java
305- String convertedFile = " YOUR_OUTPUT_DIRECTORY/ConvertedFile.pdf" ; // Output file path
306- ```
302+ ``` java
303+ // Direct answer: Call converter.convert(inputPath, loadOptions, outputPath, pdfOptions) to produce the PDF.
304+ converter. convert(inputPath, loadOptions, outputPath, pdfOptions);
305+ ```
306+
307+ ``` java
308+ String convertedFile = " YOUR_OUTPUT_DIRECTORY/ConvertedFile.pdf" ; // Output file path
309+ ```
307310
308311#### نصائح استكشاف الأخطاء وإصلاحها
309312- ** عدم تطابق الترميز** – تحقق من أن سلسلة الترميز تطابق الترميز الفعلي للملف؛ وإلا ستظهر الأحرف كـ � أو نص مشوش.
@@ -340,22 +343,8 @@ license.setLicense("path/to/your/license.lic");
340343** س: أين يمكنني العثور على أمثلة أكثر تفصيلاً ووثائق API؟**
341344ج: زر الوثائق الرسمية على [ GroupDocs Documentation] ( https://docs.groupdocs.com/conversion/java/ ) ودليل التحويل المخصص على [ GroupDocs Conversion Java Docs] ( https://docs.groupdocs.com/conversion/java/ ) . استكشف مرجع API الكامل على [ GroupDocs API Reference] ( https://reference.groupdocs.com/conversion/java/ ) .
342345
343- ```java
344- Converter converter = new Converter (txtFilePath, () - > loadOptions);
345-
346- PdfConvertOptions options = new PdfConvertOptions ();
347- converter. convert(convertedFile, options);
348- ```
349-
350346## دروس ذات صلة
351347
352348- [ كيفية تحويل صفحات محددة من مستند إلى PDF باستخدام GroupDocs.Conversion لـ Java] ( /conversion/java/pdf-conversion/convert-specific-pages-pdf-groupdocs-java/ )
353349- [ إخفاء التغييرات المتتبعة – دروس خيارات تحويل المستندات لـ GroupDocs.Conversion Java] ( /conversion/java/conversion-options/ )
354350- [ إعداد GroupDocs Conversion Maven - تحويل CSV إلى PDF في Java – دليل خطوة بخطوة] ( /conversion/java/pdf-conversion/convert-csv-to-pdf-java-groupdocs-conversion-guide/ )
355-
356- {{< / blocks/ products/ pf/ tutorial- page- section > }}
357-
358- {{< / blocks/ products/ pf/ main- container > }}
359- {{< / blocks/ products/ pf/ main- wrap- class > }}
360-
361- {{< blocks/ products/ products- backtop- button > }}
0 commit comments