Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions Samples/TestFiles/find-replace-test_(en_to_fr)-2.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en">
<file id="f-1" original="../../TestFiles/find-replace-test.pdf">
<unit id="A-a">
<!--
<fmt id="1-0" name="0" size="14.0" rise="0.0" scale="100"
colour="ffffff" colid="0" israwchars="1" fname="LatoBlack" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
-->
<segment id='p1-1' state="initial">
<source>2 </source>
<target>2 </target>
</segment>
</unit>
<unit id="A-LR">
<!--
<fmt id="2-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
-->
<segment id='p1-2' state="initial">
<source>You plan to embed PDF functionality into an application. But before you dive into the project, you must decide: do you go with a more expensive commercial PDF SDK — or a lower-cost alternative such as an open-source library or an open-source wrapper?</source>
<target>Vous envisagez d&#8217;int&#233;grer des fonctionnalit&#233;s PDF dans une application. Mais avant de vous lancer dans le projet, vous devez d&#233;cider : optez-vous pour un SDK PDF commercial plus co&#251;teux - ou une alternative moins co&#251;teuse telle qu&#8217;une biblioth&#232;que open source ou un wrapper open source ?</target>
</segment>

<!--
<fmt id="3-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
-->
<segment id='p1-3' state="initial">
<source>There are non-trivial costs to switching later. Developers have to re-learn the new library, re-adjust the backend, customize the UI to match what users are accustomed to, as well as migrate documents, form data, annotations, and more. </source>
<target>Il y a des co&#251;ts non n&#233;gligeables &#224; changer plus tard. Les d&#233;veloppeurs doivent r&#233;apprendre la nouvelle biblioth&#232;que, r&#233;ajuster le backend, personnaliser l&#8217;interface utilisateur pour qu&#8217;elle corresponde &#224; ce &#224; quoi les utilisateurs sont habitu&#233;s, ainsi que migrer des documents, des donn&#233;es de formulaire, des annotations, etc. </target>
</segment>

<!--
<fmt id="4-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
<fmt id="4-1" name="1" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="1" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
underline="1" strike="0" link=""/>
-->
<segment id='p1-4' state="initial">
<source>
According to <pc id='4-1' type='fmt'>market research</pc> conducted by Stax Inc., the average Net Promoter Score (NPS) for the top five PDF SDK vendors is 35%. And 70% of customers express interest in switching despite the high costs.
</source>
<target>D&#8217;apr&#232;s une <pc id='4-1' type='fmt'>&#233;tude de march&#233;</pc> men&#233;e par Stax Inc., le Net Promoter Score (NPS) moyen des cinq principaux fournisseurs de SDK PDF est de 35 %. Et 70 % des clients expriment leur int&#233;r&#234;t &#224; changer de client malgr&#233; les co&#251;ts &#233;lev&#233;s.</target>
</segment>

<!--
<fmt id="5-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
-->
<segment id='p1-5' state="initial">
<source>This dissatisfaction implies that picking the right PDF SDK is a lot harder than it seems. And to help you avoid the same mistakes as past implementations, we’ve written this article.</source>
<target>Cette insatisfaction implique que choisir le bon SDK PDF est beaucoup plus difficile qu&#8217;il n&#8217;y para&#238;t. Et pour vous aider &#224; &#233;viter les m&#234;mes erreurs que les impl&#233;mentations pr&#233;c&#233;dentes, nous avons r&#233;dig&#233; cet article.</target>
</segment>

<!--
<fmt id="6-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="1" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
<fmt id="6-1" name="1" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="1" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
underline="1" strike="0" link=""/>
-->
<segment id='p1-6' state="initial">
<source>
(We also<pc id='6-1' type='fmt'> </pc><pc id='6-1' type='fmt'>recently surveyed 57</pc> unique organizations that switched from PDF.js to a commercial SDK. Read our<pc id='6-1' type='fmt'> </pc><pc id='6-1' type='fmt'>comprehensive guide to PDF.js</pc> to learn more.)
</source>
<target>(Nous avons &#233;galement<pc id='6-1' type='fmt'> </pc><pc id='6-1' type='fmt'>r&#233;cemment interrog&#233; 57</pc> organisations uniques qui sont pass&#233;es d&#8217;un PDF.js &#224; un SDK commercial. Lisez notre<pc id='6-1' type='fmt'> </pc><pc id='6-1' type='fmt'>guide complet sur les PDF.js</pc> pour en savoir plus.) </target>
</segment>
</unit>
<unit id="A-b4">
<!--
<fmt id="7-0" name="0" size="30.0" rise="0.0" scale="100"
colour="0206a8" colid="2" israwchars="1" fname="LatoBlack" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
-->
<segment id='p1-7' state="initial">
<source>Overview </source>
<target>Aper&#231;u </target>
</segment>
</unit>
</file>
</xliff>
78 changes: 78 additions & 0 deletions Samples/TestFiles/translation-test-(en_to_ar).xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file original="../../TestFiles/translation-test.pdf" source-language="en" datatype="x-pdf" product-name="InfixXLIFF">
<header>
<tool tool-id="InfixXLIFF" tool-name="InfixXLIFF" tool-company="Apryse"/>
</header>
<body>
<!--
<cstyle id="1-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
-->
<trans-unit id='p1-1' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>You plan to embed PDF functionality into an application. But before you dive into the project, you must decide: do you go with a more expensive commercial PDF SDK — or a lower-cost alternative such as an open-source library or an open-source wrapper?</source>
<target>تخطط لتضمين وظائف ملفات PDF في تطبيقك. ولكن قبل أن تبدأ المشروع، عليك أن تقرر: هل ستختار حزمة تطوير برامج PDF تجارية باهظة الثمن، أم بديلاً أقل تكلفة مثل مكتبة مفتوحة المصدر أو غلاف برمجي مفتوح المصدر؟</target>
</trans-unit>

<!--
<cstyle id="2-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
-->
<trans-unit id='p1-2' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>There are non-trivial costs to switching later. Developers have to re-learn the new library, re-adjust the backend, customize the UI to match what users are accustomed to, as well as migrate documents, form data, annotations, and more. </source>
<target>هناك تكاليف غير تافهة للتبديل لاحقًا. يجب على المطورين إعادة تعلم المكتبة الجديدة، وإعادة ضبط الخلفية، وتخصيص واجهة المستخدم لتتناسب مع ما اعتاد عليه المستخدمون، بالإضافة إلى ترحيل المستندات وبيانات النماذج والتعليقات التوضيحية والمزيد.</target>
</trans-unit>

<!--
<cstyle id="3-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>

<cstyle id="3-1" name="1" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
underline="1" strike="0" link=""/>
-->
<trans-unit id='p1-3' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>According to <g id='3-1' ctype='x-cstyle'>market research</g> conducted by Stax Inc., the average Net Promoter Score (NPS) for the top five PDF SDK vendors is 35%. And 70% of customers express interest in switching despite the high costs.</source>
<target>وفقًا لأبحاث السوق التي أجرتها شركة Stax Inc.، فإن متوسط درجة صافي المروجين (NPS) لأفضل خمسة بائعي SDK لملفات PDF هو 35%. ويعرب 70% من العملاء عن اهتمامهم بالتبديل على الرغم من التكاليف العالية.</target>
</trans-unit>

<!--
<cstyle id="4-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
-->
<trans-unit id='p1-4' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>This dissatisfaction implies that picking the right PDF SDK is a lot harder than it seems. And to help you avoid the same mistakes as past implementations, we’ve written this article.</source>
<target>يشير هذا الاستياء إلى أن اختيار حزمة تطوير برامج PDF المناسبة أصعب بكثير مما يبدو. وللمساعدة في تجنب ارتكاب نفس الأخطاء التي حدثت في التطبيقات السابقة، كتبنا هذا المقال.</target>
</trans-unit>

<!--
<cstyle id="5-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>

<cstyle id="5-1" name="1" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
underline="1" strike="0" link=""/>
-->
<trans-unit id='p1-5' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>(We also<g id='5-1' ctype='x-cstyle'> </g><g id='5-1' ctype='x-cstyle'>recently surveyed 57</g> unique organizations that switched from PDF.js to a commercial SDK. Read our<g id='5-1' ctype='x-cstyle'> </g><g id='5-1' ctype='x-cstyle'>comprehensive guide to PDF.js</g> to learn more.) </source>
<target>(لقد أجرينا أيضًا مؤخرًا مسحًا شمل 57 منظمة فريدة انتقلت من PDF.js إلى SDK تجاري. اقرأ دليلنا الشامل حول PDF.js لمعرفة المزيد.)</target>
</trans-unit>

<!--
<cstyle id="6-0" name="0" size="30.0" rise="0.0" scale="100"
colour="0206a8" colid="1" israwchars="1" fname="LatoBlack" fweight="normal" fstyle="normal"
underline="0" strike="0" link=""/>
-->
<trans-unit id='p1-6' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>Overview </source>
<target>نظرة عامة</target>
</trans-unit>

</body>
</file>
</xliff>
78 changes: 78 additions & 0 deletions Samples/TestFiles/translation-test-(en_to_he).xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file original="../../TestFiles/translation-test.pdf" source-language="en" datatype="x-pdf" product-name="InfixXLIFF">
<header>
<tool tool-id="InfixXLIFF" tool-name="InfixXLIFF" tool-company="Apryse"/>
</header>
<body>
<!--
<cstyle id="1-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0"/>
-->
<trans-unit id='p1-1' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>You plan to embed PDF functionality into an application. But before you dive into the project, you must decide: do you go with a more expensive commercial PDF SDK — or a lower-cost alternative such as an open-source library or an open-source wrapper?</source>
<target>אתם מתכננים להטמיע פונקציונליות של PDF באפליקציה. אבל לפני שאתם צוללים לתוך הפרויקט, עליכם להחליט: האם אתם בוחרים ב-PDF SDK מסחרי יקר יותר - או בחלופה זולה יותר כמו ספריית קוד פתוח או עטיפת קוד פתוח?</target>
</trans-unit>

<!--
<cstyle id="2-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0"/>
-->
<trans-unit id='p1-2' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>There are non-trivial costs to switching later. Developers have to re-learn the new library, re-adjust the backend, customize the UI to match what users are accustomed to, as well as migrate documents, form data, annotations, and more. </source>
<target>ישנן עלויות לא טריוויאליות למעבר מאוחר יותר. מפתחים צריכים ללמוד מחדש את הספרייה החדשה, להתאים מחדש את ה-backend, להתאים אישית את ממשק המשתמש כך שיתאים למה שהמשתמשים רגילים אליו, וכן להעביר מסמכים, נתוני טפסים, הערות ועוד.</target>
</trans-unit>

<!--
<cstyle id="3-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0"/>

<cstyle id="3-1" name="1" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
underline="1" strike="0"/>
-->
<trans-unit id='p1-3' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>According to <g id='3-1' ctype='x-cstyle'>market research</g> conducted by Stax Inc., the average Net Promoter Score (NPS) for the top five PDF SDK vendors is 35%. And 70% of customers express interest in switching despite the high costs.</source>
<target>לפי מחקר שוק שערכה Stax Inc., ציון ה-Net Promoter Score (NPS) הממוצע עבור חמשת ספקי PDF SDK המובילים הוא 35%. ו-70% מהלקוחות מביעים עניין במעבר למרות העלויות הגבוהות.</target>
</trans-unit>

<!--
<cstyle id="4-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0"/>
-->
<trans-unit id='p1-4' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>This dissatisfaction implies that picking the right PDF SDK is a lot harder than it seems. And to help you avoid the same mistakes as past implementations, we’ve written this article.</source>
<target>חוסר שביעות רצון זה מרמז שבחירת ערכת פיתוח התוכנה (SDK) המתאימה ל-PDF קשה הרבה יותר ממה שנדמה. וכדי לעזור לכם להימנע מאותן טעויות כמו ביישומים קודמים, כתבנו מאמר זה.</target>
</trans-unit>

<!--
<cstyle id="5-0" name="0" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" fname="Lato" fweight="normal" fstyle="normal"
underline="0" strike="0"/>

<cstyle id="5-1" name="1" size="12.0" rise="0.0" scale="100"
colour="1d446c" colid="0" israwchars="1" fname="Lato" fweight="bold" fstyle="normal"
underline="1" strike="0"/>
-->
<trans-unit id='p1-5' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>(We also<g id='5-1' ctype='x-cstyle'> </g><g id='5-1' ctype='x-cstyle'>recently surveyed 57</g> unique organizations that switched from PDF.js to a commercial SDK. Read our<g id='5-1' ctype='x-cstyle'> </g><g id='5-1' ctype='x-cstyle'>comprehensive guide to PDF.js</g> to learn more.) </source>
<target>(לאחרונה גם סקרנו 57 ארגונים ייחודיים שעברו מ-PDF.js ל-SDK מסחרי. קראו את המדריך המקיף שלנו ל-PDF.js למידע נוסף.)</target>
</trans-unit>

<!--
<cstyle id="6-0" name="0" size="30.0" rise="0.0" scale="100"
colour="0206a8" colid="1" israwchars="1" fname="LatoBlack" fweight="normal" fstyle="normal"
underline="0" strike="0"/>
-->
<trans-unit id='p1-6' approved="yes" translate="yes" xml:space="default" datatype="plaintext">
<source>Overview </source>
<target>סקירה כללית</target>
</trans-unit>

</body>
</file>
</xliff>
Binary file added Samples/TestFiles/translation-test.pdf
Binary file not shown.
73 changes: 73 additions & 0 deletions Samples/TransPDFArabicTest/GO/TransPDFArabic_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//---------------------------------------------------------------------------------------
// Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
// Consult LICENSE.txt regarding license information.
//---------------------------------------------------------------------------------------

Comment thread
mrmartinclark marked this conversation as resolved.
package main
import (
"testing"
"flag"
. "github.com/pdftron/pdftron-go/v2"
)

var licenseKey string
var modulePath string

func init() {
flag.StringVar(&licenseKey, "license", "", "License key for Apryse SDK")
flag.StringVar(&modulePath, "modulePath", "", "Path for downloaded modules")
}

//---------------------------------------------------------------------------------------
// The following sample illustrates how to extract xlf from a PDF document for translation.
// It then applies a pre-prepared translated xlf file to the PDF to produce a translated PDF.
//---------------------------------------------------------------------------------------

// Relative path to the folder containing test files.
var inputPath = "../TestFiles/"
var outputPath = "../TestFiles/Output/"

//---------------------------------------------------------------------------------------

func TestTransPDFArabic(t *testing.T) {

// The first step in every application using PDFNet is to initialize the
// library and set the path to common PDF resources. The library is usually
// initialized only once, but calling Initialize() multiple times is also fine.
PDFNetInitialize(licenseKey)

// Open a PDF document to translate
doc := NewPDFDoc(inputPath + "translation-test.pdf")
options := NewTransPDFOptions()

// Set the source language in the options
options.SetSourceLanguage("en")

// Set the number of pages to process in each batch
options.SetBatchSize(20)

// Optionally, subset the pages to process
// This PDF only has a single page, but you can specify a subset of pages like this
// options.SetPages("-2,5-6,9,11-")

// Optionally, flip the text boxes, vector artwork and images on the to page top retain continuity.
// options.SetFlipPageContentsForBiDirectionalTranslations(true);

// Extract the xlf to file and field the PDF for translation
TransPDFExtractXLIFF(doc, outputPath + "translation-test-arabic.xlf", options)

// Save the fielded PDF
doc.Save(outputPath + "translation-test-arabic-fielded.pdf", uint(SDFDocE_linearized))

// The extracted xlf can be translated in a system of your choice.
// In this sample a pre-prepared translated file is used - translation-test-(en_to_ar).xlf

// Perform the translation using the pre-prepared translated xliff
TransPDFApplyXLIFF(doc, inputPath + "translation-test-(en_to_ar).xlf", options)

// Save the translated PDF
doc.Save(outputPath + "translation-test-arabic.pdf", uint(SDFDocE_linearized))
doc.Close()

PDFNetTerminate()
}
6 changes: 6 additions & 0 deletions Samples/TransPDFArabicTest/PHP/RunTest.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
setlocal
set TEST_NAME=TransPDFTestArabic
set PATH=..\..\..\PDFNetC\Lib;%PATH%
php.exe %TEST_NAME%.php
endlocal
4 changes: 4 additions & 0 deletions Samples/TransPDFArabicTest/PHP/RunTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
TEST_NAME=TransPDFTestArabic
export LD_LIBRARY_PATH=../../../PDFNetC/Lib
php -d extension="../../../PDFNetC/Lib/PDFNetPHP.so" $TEST_NAME.php
Loading