Hi,
>> Sorry, I misspelled the name of function I uses : it was
>> pdf_text_new_from_host.
>>
>> I also tried pdf_text_from_unicode("/path/to/test.pdf", 17, PDF_TEXT_UTF8,
>> &text);
>>
>> but the result is the same
>>
>
> It's a bug then :-)
>
> I will try to reproduce and fix it this afternoon.
Did you call pdf_text_init() before using any function of the text
module? It's working ok for me...
I attach my test file
Cheers,
-Aleksander
/*
*
* File: pdf-disk.c
* Date: Mon Jan 19 14:19:42 2009
*
*/
/* Copyright (C) 2008 Free Software Foundation, Inc. */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <unistd.h>
#include <stdio.h>
#include <getopt.h>
#include <string.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#else
#include <stdlib.h>
#endif /* HAVE_MALLOC_H */
#include <sys/stat.h>
#include <xalloc.h>
#include <pdf.h>
int
main (int argc, char *argv[])
{
pdf_text_t filepath = NULL;
pdf_fsys_file_t file = NULL;
const pdf_char_t *utf8_path = "/tmp/pdf.txt";
pdf_text_init();
if(pdf_text_new_from_unicode(utf8_path, strlen(utf8_path), PDF_TEXT_UTF8, &filepath) != PDF_OK)
{
printf("new_from_unicode error\n");
return -1;
}
if(pdf_fsys_item_p(NULL, filepath) == PDF_TRUE)
{
printf("file exists!!\n");
}
else
{
printf("file DOESN'T exist!!\n");
return -2;
}
if(pdf_fsys_file_open(NULL, filepath, PDF_FSYS_OPEN_MODE_READ, &file) != PDF_OK)
{
printf("error opening file\n");
return -3;
}
if(pdf_fsys_file_close(file) != PDF_OK)
{
printf("error closing file\n");
return -4;
}
pdf_text_destroy(filepath);
printf("ALL OK\n");
return 0;
}
/* End of pdf-disk.c */