How to add hebrew font to PDF document.

Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.

Moderator: Alex

Post Reply
oren2020
Posts: 2
Joined: Sat Jun 27, 2020 11:48 pm

How to add hebrew font to PDF document.

Post by oren2020 »

Hi all ;
im convert tiff to searchable pdf using vintasoft sample
but i see that the font is glyphlessfont embeded
i want to add hebrew font (arial,david,miryam etc...)
please how can i do it ?
***i saw that there is memeber pdffont *****
this is the code:

Code: Select all

       private void button1_Click_1(object sender, EventArgs e)
        {
            ConvertTiffToSearchablePdf (OcrLanguage.Hebrew, @"e:\tstOren.tiff", @"e:\tstOrenNew.pdf");

        }
        public static void ConvertTiffToSearchablePdf(
Vintasoft.Imaging.Ocr.OcrLanguage ocrLanguage,
string tiffFilename,
string pdfFilename)
        {
            // create an image collection
            using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
            {
                // add images from TIFF file into image collection
                images.Add(tiffFilename);

                // create a searchable PDF document
                using (Vintasoft.Imaging.Pdf.PdfDocument document =
                    new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14))
                {
                    System.Console.WriteLine("Create OCR engine...");
                    // create the Tesseract OCR engine
                    using (Vintasoft.Imaging.Ocr.Tesseract.TesseractOcr tesseractOcr =
                        new Vintasoft.Imaging.Ocr.Tesseract.TesseractOcr())
                    {
                        System.Console.WriteLine("Initialize OCR engine...");
                        // init the Tesseract OCR engine
                        tesseractOcr.Init(new Vintasoft.Imaging.Ocr.OcrEngineSettings(ocrLanguage));

                        // create a PDF document builder
                        Vintasoft.Imaging.Pdf.Ocr.PdfDocumentBuilder documentBuilder =
                            new Vintasoft.Imaging.Pdf.Ocr.PdfDocumentBuilder(document);
                        // specify that the best image compression must be calculated automatically
                        documentBuilder.ImageCompression = Vintasoft.Imaging.Pdf.PdfCompression.Auto;
                        // specify that image must be place over text
                        documentBuilder.PageCreationMode = Vintasoft.Imaging.Pdf.Ocr.PdfPageCreationMode.ImageOverText;

                        // for each image in image collection
                        foreach (Vintasoft.Imaging.VintasoftImage image in images)
                        {
                            System.Console.WriteLine("Recognize text in image...");
                            // recognize text on image
                            Vintasoft.Imaging.Ocr.Results.OcrPage page = tesseractOcr.Recognize(image);

                            System.Console.WriteLine("Add page to a PDF document...");
                            // add recognized OCR page to the PDF document
                            documentBuilder.AddPage(image, page);
                        }

                        // shutdown OCR engine
                        tesseractOcr.Shutdown();

                        System.Console.WriteLine("Save changes in PDF document...");
                        // save changes in PDF document
                        document.SaveChanges();
                    }
                }

Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: How to add hebrew font to PDF document.

Post by Alex »

Hi Oren,

Please read how to add font to a PDF document here:
https://www.vintasoft.com/docs/vsimagin ... ument.html

Best regards, Alexander
Post Reply