Commit ab704303 authored by Claes Sjofors's avatar Claes Sjofors

Convert image to pdf-file, tmp file name fix

parent 471c7737
...@@ -258,6 +258,7 @@ void CnvPdfObj::print_end() ...@@ -258,6 +258,7 @@ void CnvPdfObj::print_end()
int CnvPdfObj::print_image() int CnvPdfObj::print_image()
{ {
pwr_tCmd cmd;
cnv_tImImage image; cnv_tImImage image;
cnv_tPixmap pixmap; cnv_tPixmap pixmap;
pwr_tFileName fname; pwr_tFileName fname;
...@@ -314,7 +315,7 @@ number + topdf->v_outline.size() + topdf->v_pages.size() + topdf->v_content.size ...@@ -314,7 +315,7 @@ number + topdf->v_outline.size() + topdf->v_pages.size() + topdf->v_content.size
start = (int) topdf->fp[topdf->cf].tellp(); start = (int) topdf->fp[topdf->cf].tellp();
strcpy( fname, "/tmp/pwr_cnv.jpg"); sprintf( fname, "/tmp/pwr_cnv_%08u.jpg", dcli_random());
cnv_print_image( image, fname); cnv_print_image( image, fname);
ifstream fimg( fname); ifstream fimg( fname);
...@@ -330,7 +331,8 @@ number + topdf->v_outline.size() + topdf->v_pages.size() + topdf->v_content.size ...@@ -330,7 +331,8 @@ number + topdf->v_outline.size() + topdf->v_pages.size() + topdf->v_content.size
cnv_free_image( image, pixmap); cnv_free_image( image, pixmap);
fimg.close(); fimg.close();
system( "rm /tmp/pwr_cnv.jpg"); sprintf( cmd, "rm %s", fname);
system( cmd);
return 1; return 1;
} }
......
...@@ -1222,3 +1222,14 @@ int dcli_read_line( char *line, int maxsize, FILE *file) ...@@ -1222,3 +1222,14 @@ int dcli_read_line( char *line, int maxsize, FILE *file)
return 1; return 1;
} }
unsigned int dcli_random()
{
pwr_tTime t;
time_GetTime( &t);
int itime = t.tv_nsec + t.tv_sec % 10000;
srand( itime);
return (unsigned int)((double) rand() / ((double) RAND_MAX + 1) * 999999);
}
...@@ -90,6 +90,7 @@ char *dcli_pwr_dir( const char *dir); ...@@ -90,6 +90,7 @@ char *dcli_pwr_dir( const char *dir);
int dcli_wildcard( char *wildname, int dcli_wildcard( char *wildname,
char *name); char *name);
int dcli_read_line( char *line, int maxsize, FILE *file); int dcli_read_line( char *line, int maxsize, FILE *file);
unsigned int dcli_random();
/* Functions in module co_dcli_file */ /* Functions in module co_dcli_file */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment