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();
}
}