|
|
@ -1,4 +1,4 @@
|
|
|
|
/* $Id: tiff2pdf.c,v 1.69 2012-07-19 15:43:41 tgl Exp $
|
|
|
|
/* $Id: tiff2pdf.c,v 1.70 2013-05-02 14:44:29 tgl Exp $
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* tiff2pdf - converts a TIFF image to a PDF document
|
|
|
|
* tiff2pdf - converts a TIFF image to a PDF document
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -3609,7 +3609,9 @@ tsize_t t2p_write_pdf_header(T2P* t2p, TIFF* output){
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[16];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
buflen=sprintf(buffer, "%%PDF-%u.%u ", t2p->pdf_majorversion&0xff, t2p->pdf_minorversion&0xff);
|
|
|
|
buflen = snprintf(buffer, sizeof(buffer), "%%PDF-%u.%u ",
|
|
|
|
|
|
|
|
t2p->pdf_majorversion&0xff,
|
|
|
|
|
|
|
|
t2p->pdf_minorversion&0xff);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t)"\n%\342\343\317\323\n", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t)"\n%\342\343\317\323\n", 7);
|
|
|
|
|
|
|
|
|
|
|
@ -3623,10 +3625,10 @@ tsize_t t2p_write_pdf_header(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_obj_start(uint32 number, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_obj_start(uint32 number, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)number);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen );
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen );
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 obj\n", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 obj\n", 7);
|
|
|
|
|
|
|
|
|
|
|
@ -3665,13 +3667,13 @@ tsize_t t2p_write_pdf_name(unsigned char* name, TIFF* output){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/", 1);
|
|
|
|
for (i=0;i<namelen;i++){
|
|
|
|
for (i=0;i<namelen;i++){
|
|
|
|
if ( ((unsigned char)name[i]) < 0x21){
|
|
|
|
if ( ((unsigned char)name[i]) < 0x21){
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
nextchar=1;
|
|
|
|
nextchar=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( ((unsigned char)name[i]) > 0x7E){
|
|
|
|
if ( ((unsigned char)name[i]) > 0x7E){
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
nextchar=1;
|
|
|
|
nextchar=1;
|
|
|
@ -3679,57 +3681,57 @@ tsize_t t2p_write_pdf_name(unsigned char* name, TIFF* output){
|
|
|
|
if (nextchar==0){
|
|
|
|
if (nextchar==0){
|
|
|
|
switch (name[i]){
|
|
|
|
switch (name[i]){
|
|
|
|
case 0x23:
|
|
|
|
case 0x23:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x25:
|
|
|
|
case 0x25:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x28:
|
|
|
|
case 0x28:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x29:
|
|
|
|
case 0x29:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x2F:
|
|
|
|
case 0x2F:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x3C:
|
|
|
|
case 0x3C:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x3E:
|
|
|
|
case 0x3E:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x5B:
|
|
|
|
case 0x5B:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x5D:
|
|
|
|
case 0x5D:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x7B:
|
|
|
|
case 0x7B:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 0x7D:
|
|
|
|
case 0x7D:
|
|
|
|
sprintf(buffer, "#%.2X", name[i]);
|
|
|
|
snprintf(buffer, sizeof(buffer), "#%.2X", name[i]);
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
buffer[sizeof(buffer) - 1] = '\0';
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -3844,14 +3846,14 @@ tsize_t t2p_write_pdf_stream_end(TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32 number, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32 number, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Length ", 8);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Length ", 8);
|
|
|
|
if(len!=0){
|
|
|
|
if(len!=0){
|
|
|
|
written += t2p_write_pdf_stream_length(len, output);
|
|
|
|
written += t2p_write_pdf_stream_length(len, output);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)number);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -3892,10 +3894,10 @@ tsize_t t2p_write_pdf_stream_dict_end(TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)len);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)len);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n", 1);
|
|
|
|
|
|
|
|
|
|
|
@ -3909,7 +3911,7 @@ tsize_t t2p_write_pdf_stream_length(tsize_t len, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_catalog(T2P* t2p, TIFF* output)
|
|
|
|
tsize_t t2p_write_pdf_catalog(T2P* t2p, TIFF* output)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
tsize_t written = 0;
|
|
|
|
tsize_t written = 0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen = 0;
|
|
|
|
int buflen = 0;
|
|
|
|
|
|
|
|
|
|
|
|
written += t2pWriteFile(output,
|
|
|
|
written += t2pWriteFile(output,
|
|
|
@ -3948,7 +3950,6 @@ tsize_t t2p_write_pdf_info(T2P* t2p, TIFF* input, TIFF* output)
|
|
|
|
written += t2p_write_pdf_string(t2p->pdf_datetime, output);
|
|
|
|
written += t2p_write_pdf_string(t2p->pdf_datetime, output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/Producer ", 11);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/Producer ", 11);
|
|
|
|
_TIFFmemset((tdata_t)buffer, 0x00, sizeof(buffer));
|
|
|
|
|
|
|
|
snprintf(buffer, sizeof(buffer), "libtiff / tiff2pdf - %d", TIFFLIB_VERSION);
|
|
|
|
snprintf(buffer, sizeof(buffer), "libtiff / tiff2pdf - %d", TIFFLIB_VERSION);
|
|
|
|
written += t2p_write_pdf_string(buffer, output);
|
|
|
|
written += t2p_write_pdf_string(buffer, output);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n", 1);
|
|
|
@ -4089,7 +4090,7 @@ tsize_t t2p_write_pdf_pages(T2P* t2p, TIFF* output)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
tdir_t i=0;
|
|
|
|
tdir_t i=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
int page=0;
|
|
|
|
int page=0;
|
|
|
@ -4097,7 +4098,7 @@ tsize_t t2p_write_pdf_pages(T2P* t2p, TIFF* output)
|
|
|
|
(tdata_t) "<< \n/Type /Pages \n/Kids [ ", 26);
|
|
|
|
(tdata_t) "<< \n/Type /Pages \n/Kids [ ", 26);
|
|
|
|
page = t2p->pdf_pages+1;
|
|
|
|
page = t2p->pdf_pages+1;
|
|
|
|
for (i=0;i<t2p->tiff_pagecount;i++){
|
|
|
|
for (i=0;i<t2p->tiff_pagecount;i++){
|
|
|
|
buflen=sprintf(buffer, "%d", page);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%d", page);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
if ( ((i+1)%8)==0 ) {
|
|
|
|
if ( ((i+1)%8)==0 ) {
|
|
|
@ -4112,8 +4113,7 @@ tsize_t t2p_write_pdf_pages(T2P* t2p, TIFF* output)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "] \n/Count ", 10);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "] \n/Count ", 10);
|
|
|
|
_TIFFmemset(buffer, 0x00, 16);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%d", t2p->tiff_pagecount);
|
|
|
|
buflen=sprintf(buffer, "%d", t2p->tiff_pagecount);
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " \n>> \n", 6);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " \n>> \n", 6);
|
|
|
|
|
|
|
|
|
|
|
@ -4128,28 +4128,28 @@ tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int i=0;
|
|
|
|
unsigned int i=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[256];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<<\n/Type /Page \n/Parent ", 24);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<<\n/Type /Page \n/Parent ", 24);
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_pages);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_pages);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/MediaBox [", 11);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/MediaBox [", 11);
|
|
|
|
buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x1);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y1);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.x2);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.x2);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
buflen=sprintf(buffer, "%.4f",t2p->pdf_mediabox.y2);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%.4f",t2p->pdf_mediabox.y2);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "] \n", 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "] \n", 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Contents ", 10);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Contents ", 10);
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)(object + 1));
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(object + 1));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Resources << \n", 15);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Resources << \n", 15);
|
|
|
@ -4157,15 +4157,13 @@ tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
|
|
|
|
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i++){
|
|
|
|
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i++){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Im", 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Im", 3);
|
|
|
|
buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
|
|
|
|
buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "_", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "_", 1);
|
|
|
|
buflen = sprintf(buffer, "%u", i+1);
|
|
|
|
buflen = snprintf(buffer, sizeof(buffer), "%u", i+1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
buflen = sprintf(
|
|
|
|
buflen = snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
|
|
|
|
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
@ -4177,12 +4175,10 @@ tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/XObject <<\n", 12);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Im", 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Im", 3);
|
|
|
|
buflen = sprintf(buffer, "%u", t2p->pdf_page+1);
|
|
|
|
buflen = snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
buflen = sprintf(
|
|
|
|
buflen = snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
|
|
|
|
(unsigned long)(object+3+(2*i)+t2p->tiff_pages[t2p->pdf_page].page_extra));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
@ -4191,9 +4187,7 @@ tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
|
|
|
|
if(t2p->tiff_transferfunctioncount != 0) {
|
|
|
|
if(t2p->tiff_transferfunctioncount != 0) {
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/ExtGState <<", 13);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/ExtGState <<", 13);
|
|
|
|
t2pWriteFile(output, (tdata_t) "/GS1 ", 5);
|
|
|
|
t2pWriteFile(output, (tdata_t) "/GS1 ", 5);
|
|
|
|
buflen = sprintf(
|
|
|
|
buflen = snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)(object + 3));
|
|
|
|
(unsigned long)(object + 3));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
@ -4566,7 +4560,7 @@ tsize_t t2p_write_pdf_page_content_stream(T2P* t2p, TIFF* output){
|
|
|
|
if(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount>0){
|
|
|
|
if(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount>0){
|
|
|
|
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount; i++){
|
|
|
|
for(i=0;i<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount; i++){
|
|
|
|
box=t2p->tiff_tiles[t2p->pdf_page].tiles_tiles[i].tile_box;
|
|
|
|
box=t2p->tiff_tiles[t2p->pdf_page].tiles_tiles[i].tile_box;
|
|
|
|
buflen=sprintf(buffer,
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer),
|
|
|
|
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d_%ld Do Q\n",
|
|
|
|
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d_%ld Do Q\n",
|
|
|
|
t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
|
|
|
|
t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
|
|
|
|
box.mat[0],
|
|
|
|
box.mat[0],
|
|
|
@ -4581,7 +4575,7 @@ tsize_t t2p_write_pdf_page_content_stream(T2P* t2p, TIFF* output){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
box=t2p->pdf_imagebox;
|
|
|
|
box=t2p->pdf_imagebox;
|
|
|
|
buflen=sprintf(buffer,
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer),
|
|
|
|
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d Do Q\n",
|
|
|
|
"q %s %.4f %.4f %.4f %.4f %.4f %.4f cm /Im%d Do Q\n",
|
|
|
|
t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
|
|
|
|
t2p->tiff_transferfunctioncount?"/GS1 gs ":"",
|
|
|
|
box.mat[0],
|
|
|
|
box.mat[0],
|
|
|
@ -4606,59 +4600,48 @@ tsize_t t2p_write_pdf_xobject_stream_dict(ttile_t tile,
|
|
|
|
TIFF* output){
|
|
|
|
TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
written += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output);
|
|
|
|
written += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output);
|
|
|
|
written += t2pWriteFile(output,
|
|
|
|
written += t2pWriteFile(output,
|
|
|
|
(tdata_t) "/Type /XObject \n/Subtype /Image \n/Name /Im",
|
|
|
|
(tdata_t) "/Type /XObject \n/Subtype /Image \n/Name /Im",
|
|
|
|
42);
|
|
|
|
42);
|
|
|
|
buflen=sprintf(buffer, "%u", t2p->pdf_page+1);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_page+1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
if(tile != 0){
|
|
|
|
if(tile != 0){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "_", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "_", 1);
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)tile);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)tile);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/Width ", 8);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/Width ", 8);
|
|
|
|
_TIFFmemset((tdata_t)buffer, 0x00, 16);
|
|
|
|
|
|
|
|
if(tile==0){
|
|
|
|
if(tile==0){
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_width);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_width);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
|
|
|
|
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
|
|
|
|
buflen=sprintf(
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
buflen=sprintf(
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/Height ", 9);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/Height ", 9);
|
|
|
|
_TIFFmemset((tdata_t)buffer, 0x00, 16);
|
|
|
|
|
|
|
|
if(tile==0){
|
|
|
|
if(tile==0){
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)t2p->tiff_length);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->tiff_length);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
|
|
|
|
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)!=0){
|
|
|
|
buflen=sprintf(
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
buflen=sprintf(
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/BitsPerComponent ", 19);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/BitsPerComponent ", 19);
|
|
|
|
_TIFFmemset((tdata_t)buffer, 0x00, 16);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample);
|
|
|
|
buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/ColorSpace ", 13);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/ColorSpace ", 13);
|
|
|
|
written += t2p_write_pdf_xobject_cs(t2p, output);
|
|
|
|
written += t2p_write_pdf_xobject_cs(t2p, output);
|
|
|
@ -4702,11 +4685,10 @@ tsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){
|
|
|
|
t2p->pdf_colorspace ^= T2P_CS_PALETTE;
|
|
|
|
t2p->pdf_colorspace ^= T2P_CS_PALETTE;
|
|
|
|
written += t2p_write_pdf_xobject_cs(t2p, output);
|
|
|
|
written += t2p_write_pdf_xobject_cs(t2p, output);
|
|
|
|
t2p->pdf_colorspace |= T2P_CS_PALETTE;
|
|
|
|
t2p->pdf_colorspace |= T2P_CS_PALETTE;
|
|
|
|
buflen=sprintf(buffer, "%u", (0x0001 << t2p->tiff_bitspersample)-1 );
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%u", (0x0001 << t2p->tiff_bitspersample)-1 );
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " ", 1);
|
|
|
|
_TIFFmemset(buffer, 0x00, 16);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_palettecs );
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_palettecs );
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ]\n", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ]\n", 7);
|
|
|
|
return(written);
|
|
|
|
return(written);
|
|
|
@ -4740,10 +4722,10 @@ tsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){
|
|
|
|
X_W /= Y_W;
|
|
|
|
X_W /= Y_W;
|
|
|
|
Z_W /= Y_W;
|
|
|
|
Z_W /= Y_W;
|
|
|
|
Y_W = 1.0F;
|
|
|
|
Y_W = 1.0F;
|
|
|
|
buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Range ", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Range ", 7);
|
|
|
|
buflen=sprintf(buffer, "[%d %d %d %d] \n",
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "[%d %d %d %d] \n",
|
|
|
|
t2p->pdf_labrange[0],
|
|
|
|
t2p->pdf_labrange[0],
|
|
|
|
t2p->pdf_labrange[1],
|
|
|
|
t2p->pdf_labrange[1],
|
|
|
|
t2p->pdf_labrange[2],
|
|
|
|
t2p->pdf_labrange[2],
|
|
|
@ -4759,26 +4741,26 @@ tsize_t t2p_write_pdf_xobject_cs(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_transfer(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_transfer(T2P* t2p, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<< /Type /ExtGState \n/TR ", 25);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<< /Type /ExtGState \n/TR ", 25);
|
|
|
|
if(t2p->tiff_transferfunctioncount == 1){
|
|
|
|
if(t2p->tiff_transferfunctioncount == 1){
|
|
|
|
buflen=sprintf(buffer, "%lu",
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
(unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
|
(unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "[ ", 2);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "[ ", 2);
|
|
|
|
buflen=sprintf(buffer, "%lu",
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
(unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
|
(unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
buflen=sprintf(buffer, "%lu",
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
(unsigned long)(t2p->pdf_xrefcount + 2));
|
|
|
|
(unsigned long)(t2p->pdf_xrefcount + 2));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
buflen=sprintf(buffer, "%lu",
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
(unsigned long)(t2p->pdf_xrefcount + 3));
|
|
|
|
(unsigned long)(t2p->pdf_xrefcount + 3));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R ", 5);
|
|
|
@ -4800,7 +4782,7 @@ tsize_t t2p_write_pdf_transfer_dict(T2P* t2p, TIFF* output, uint16 i){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/FunctionType 0 \n", 17);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/FunctionType 0 \n", 17);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Domain [0.0 1.0] \n", 19);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Domain [0.0 1.0] \n", 19);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Range [0.0 1.0] \n", 18);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Range [0.0 1.0] \n", 18);
|
|
|
|
buflen=sprintf(buffer, "/Size [%u] \n", (1<<t2p->tiff_bitspersample));
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "/Size [%u] \n", (1<<t2p->tiff_bitspersample));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/BitsPerSample 16 \n", 19);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/BitsPerSample 16 \n", 19);
|
|
|
|
written += t2p_write_pdf_stream_dict(((tsize_t)1)<<(t2p->tiff_bitspersample+1), 0, output);
|
|
|
|
written += t2p_write_pdf_stream_dict(((tsize_t)1)<<(t2p->tiff_bitspersample+1), 0, output);
|
|
|
@ -4827,7 +4809,7 @@ tsize_t t2p_write_pdf_transfer_stream(T2P* t2p, TIFF* output, uint16 i){
|
|
|
|
tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[128];
|
|
|
|
char buffer[256];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
float X_W=0.0;
|
|
|
|
float X_W=0.0;
|
|
|
@ -4895,16 +4877,16 @@ tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<< \n", 4);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<< \n", 4);
|
|
|
|
if(t2p->pdf_colorspace & T2P_CS_CALGRAY){
|
|
|
|
if(t2p->pdf_colorspace & T2P_CS_CALGRAY){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
|
|
|
|
buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Gamma 2.2 \n", 12);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Gamma 2.2 \n", 12);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(t2p->pdf_colorspace & T2P_CS_CALRGB){
|
|
|
|
if(t2p->pdf_colorspace & T2P_CS_CALRGB){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/WhitePoint ", 12);
|
|
|
|
buflen=sprintf(buffer, "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f] \n", X_W, Y_W, Z_W);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Matrix ", 8);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Matrix ", 8);
|
|
|
|
buflen=sprintf(buffer, "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n",
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "[%.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f] \n",
|
|
|
|
X_R, Y_R, Z_R,
|
|
|
|
X_R, Y_R, Z_R,
|
|
|
|
X_G, Y_G, Z_G,
|
|
|
|
X_G, Y_G, Z_G,
|
|
|
|
X_B, Y_B, Z_B);
|
|
|
|
X_B, Y_B, Z_B);
|
|
|
@ -4923,11 +4905,11 @@ tsize_t t2p_write_pdf_xobject_calcs(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "[/ICCBased ", 11);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "[/ICCBased ", 11);
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_icccs);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_icccs);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R] \n", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R] \n", 7);
|
|
|
|
|
|
|
|
|
|
|
@ -4937,11 +4919,11 @@ tsize_t t2p_write_pdf_xobject_icccs(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_xobject_icccs_dict(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_xobject_icccs_dict(T2P* t2p, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/N ", 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/N ", 3);
|
|
|
|
buflen=sprintf(buffer, "%u \n", t2p->tiff_samplesperpixel);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%u \n", t2p->tiff_samplesperpixel);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Alternate ", 11);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Alternate ", 11);
|
|
|
|
t2p->pdf_colorspace ^= T2P_CS_ICCBASED;
|
|
|
|
t2p->pdf_colorspace ^= T2P_CS_ICCBASED;
|
|
|
@ -5006,7 +4988,7 @@ tsize_t t2p_write_pdf_xobject_decode(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[16];
|
|
|
|
char buffer[32];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
|
|
|
|
|
|
|
|
if(t2p->pdf_compression==T2P_COMPRESS_NONE){
|
|
|
|
if(t2p->pdf_compression==T2P_COMPRESS_NONE){
|
|
|
@ -5021,41 +5003,33 @@ tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<< /K -1 ", 9);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<< /K -1 ", 9);
|
|
|
|
if(tile==0){
|
|
|
|
if(tile==0){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
|
|
|
|
buflen=sprintf(buffer, "%lu",
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
(unsigned long)t2p->tiff_width);
|
|
|
|
(unsigned long)t2p->tiff_width);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
|
|
|
|
buflen=sprintf(buffer, "%lu",
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
(unsigned long)t2p->tiff_length);
|
|
|
|
(unsigned long)t2p->tiff_length);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
|
|
|
|
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
|
|
|
|
buflen=sprintf(
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/Columns ", 9);
|
|
|
|
buflen=sprintf(
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
|
|
|
|
if(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile-1)==0){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
|
|
|
|
buflen=sprintf(
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Rows ", 7);
|
|
|
|
buflen=sprintf(
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buffer,
|
|
|
|
|
|
|
|
"%lu",
|
|
|
|
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
|
|
|
|
(unsigned long)t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5082,21 +5056,17 @@ tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output
|
|
|
|
if(t2p->pdf_compressionquality%100){
|
|
|
|
if(t2p->pdf_compressionquality%100){
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/DecodeParms ", 13);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "/DecodeParms ", 13);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<< /Predictor ", 14);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "<< /Predictor ", 14);
|
|
|
|
_TIFFmemset(buffer, 0x00, 16);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->pdf_compressionquality%100);
|
|
|
|
buflen=sprintf(buffer, "%u", t2p->pdf_compressionquality%100);
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Columns ", 10);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Columns ", 10);
|
|
|
|
_TIFFmemset(buffer, 0x00, 16);
|
|
|
|
buflen = snprintf(buffer, sizeof(buffer), "%lu",
|
|
|
|
buflen = sprintf(buffer, "%lu",
|
|
|
|
|
|
|
|
(unsigned long)t2p->tiff_width);
|
|
|
|
(unsigned long)t2p->tiff_width);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Colors ", 9);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /Colors ", 9);
|
|
|
|
_TIFFmemset(buffer, 0x00, 16);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_samplesperpixel);
|
|
|
|
buflen=sprintf(buffer, "%u", t2p->tiff_samplesperpixel);
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /BitsPerComponent ", 19);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " /BitsPerComponent ", 19);
|
|
|
|
_TIFFmemset(buffer, 0x00, 16);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%u", t2p->tiff_bitspersample);
|
|
|
|
buflen=sprintf(buffer, "%u", t2p->tiff_bitspersample);
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) ">>\n", 3);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) ">>\n", 3);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5116,16 +5086,16 @@ tsize_t t2p_write_pdf_xobject_stream_filter(ttile_t tile, T2P* t2p, TIFF* output
|
|
|
|
tsize_t t2p_write_pdf_xreftable(T2P* t2p, TIFF* output){
|
|
|
|
tsize_t t2p_write_pdf_xreftable(T2P* t2p, TIFF* output){
|
|
|
|
|
|
|
|
|
|
|
|
tsize_t written=0;
|
|
|
|
tsize_t written=0;
|
|
|
|
char buffer[21];
|
|
|
|
char buffer[64];
|
|
|
|
int buflen=0;
|
|
|
|
int buflen=0;
|
|
|
|
uint32 i=0;
|
|
|
|
uint32 i=0;
|
|
|
|
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "xref\n0 ", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "xref\n0 ", 7);
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " \n0000000000 65535 f \n", 22);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " \n0000000000 65535 f \n", 22);
|
|
|
|
for (i=0;i<t2p->pdf_xrefcount;i++){
|
|
|
|
for (i=0;i<t2p->pdf_xrefcount;i++){
|
|
|
|
sprintf(buffer, "%.10lu 00000 n \n",
|
|
|
|
snprintf(buffer, sizeof(buffer), "%.10lu 00000 n \n",
|
|
|
|
(unsigned long)t2p->pdf_xrefoffsets[i]);
|
|
|
|
(unsigned long)t2p->pdf_xrefoffsets[i]);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 20);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, 20);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5149,17 +5119,14 @@ tsize_t t2p_write_pdf_trailer(T2P* t2p, TIFF* output)
|
|
|
|
snprintf(t2p->pdf_fileid + i, 9, "%.8X", rand());
|
|
|
|
snprintf(t2p->pdf_fileid + i, 9, "%.8X", rand());
|
|
|
|
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "trailer\n<<\n/Size ", 17);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "trailer\n<<\n/Size ", 17);
|
|
|
|
buflen = sprintf(buffer, "%lu", (unsigned long)(t2p->pdf_xrefcount+1));
|
|
|
|
buflen = snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount+1));
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
_TIFFmemset(buffer, 0x00, 32);
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/Root ", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n/Root ", 7);
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_catalog);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_catalog);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
_TIFFmemset(buffer, 0x00, 32);
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n/Info ", 12);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n/Info ", 12);
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_info);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_info);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
_TIFFmemset(buffer, 0x00, 32);
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n/ID[<", 11);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) " 0 R \n/ID[<", 11);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid,
|
|
|
|
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid,
|
|
|
|
sizeof(t2p->pdf_fileid) - 1);
|
|
|
|
sizeof(t2p->pdf_fileid) - 1);
|
|
|
@ -5167,9 +5134,8 @@ tsize_t t2p_write_pdf_trailer(T2P* t2p, TIFF* output)
|
|
|
|
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid,
|
|
|
|
written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid,
|
|
|
|
sizeof(t2p->pdf_fileid) - 1);
|
|
|
|
sizeof(t2p->pdf_fileid) - 1);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) ">]\n>>\nstartxref\n", 16);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) ">]\n>>\nstartxref\n", 16);
|
|
|
|
buflen=sprintf(buffer, "%lu", (unsigned long)t2p->pdf_startxref);
|
|
|
|
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)t2p->pdf_startxref);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
|
|
|
|
_TIFFmemset(buffer, 0x00, 32);
|
|
|
|
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n%%EOF\n", 7);
|
|
|
|
written += t2pWriteFile(output, (tdata_t) "\n%%EOF\n", 7);
|
|
|
|
|
|
|
|
|
|
|
|
return(written);
|
|
|
|
return(written);
|
|
|
|