Reflow PDF Documents Using XLIFF Data
Content reflow is designed to eliminate formatting headaches when translating or updating PDFs. Instead of manually copy-pasting content and fixing layouts, it extracts text into XLIFF format, an industry-standard translation file that maintains
Fonts
Layouts
Tables
No more manual reformatting.
The format provides seamless integration with translation tools and enterprise scalability.
How Does Content Reflow Work for my translation needs?
Unlike traditional translation workflows that require manually extracting and reinserting text, XLIFF Reflow automates this process by converting text into XLIFF format, an industry-standard file type for translation workflows.
Right-to-left (RTL) language translation is supported for RTL languages for Arabic and Hebrew. You can use SetFlipPageContentsForBiDirectionalTranslations(bool) to invert the position of images and text on the x-axis and invert vector artwork on the x-axis.You may want to invert the position of text, position of images and vector artwork in a RTL translation as it can, in some cases, improve the look of the translated page.
Step 1
Extract Text into XLIFF Format and save the fielded PDF
// Open a PDF to translate.
PDFDoc doc(input_path + "document.pdf");
// 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, set the XLIFF exported version, default is 1.2
// options.SetXLIFFVersion(TransPDFOptions::e_xliff_version_2);
// Extract the xlf to file and field the PDF for translation
TransPDF::ExtractXLIFF(doc, output_path + "output.xlf", pageSet);
// Save the fielded PDF
doc.Save(output_path + "document-fielded.pdf", SDFDoc::e_linearized);// Open a PDF to translate.
FileStream istm = new FileStream(input_path + "document.pdf", FileMode.Open, FileAccess.Read);
using (PDFDoc doc = new PDFDoc(istm))
{
// 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, set the XLIFF exported version, default is 1.2
// options.SetXLIFFVersion(TransPDFOptions.XLIFFVersion.e_xliff_version_2);
// Extract the xlf to file and field the PDF for translation
TransPDF.ExtractXLIFF(doc, output_path + "output.xlf", pageSet);
// Save the fielded PDF
doc.Save(output_path + "document-fielded.pdf", SDFDoc.SaveOptions.e_linearized);
}Step 2
Do your translation. Here you would send the XLIFF file to your preferred computer assisted software, online or running locally.
Step 3
Reflow Translated Text Back into the fielded PDF
For more extensive code samples please go to the Document Translation Reflow samples page.
Last updated
Was this helpful?