c# itextsharp convert pdf to image : Add password to pdf control application utility azure web page asp.net visual studio cips2ed40-part121

F.1. CODE LISTINGS FOR CHAPTER 1
379
*
Write a blank color table.
*
It has 256 entries (number of colors)
*
that are each 4 bytes.
*
*********************************************/
buffer[0] = 0x00;
for(i=0; i<(256*4); i++)
fwrite(buffer, 1, 1, fp);
/*********************************************
*
*
Write a zero image.
*
*********************************************/
buffer[0] = 0x00;
for(i=0; i<bmheader->sizeofbitmap; i++)
fwrite(buffer, 1, 1, fp);
fclose(fp);
} /* ends create_allocate_bmp_file */
/******************************************
*
*
write_bmp_image(...
*
*
This function writes an image array
*
to a bmp image file.
*
******************************************/
write_bmp_image(file_name, array)
char
*file_name;
short **array;
{
char
*buffer, c;
FILE
*image_file;
Add password to pdf - C# PDF Password Library: add, remove, edit PDF file password in C#.net, ASP.NET, MVC, WinForms, WPF
Help to Improve the Security of Your PDF Document by Setting Password
pdf user password; copy text from protected pdf to word
Add password to pdf - VB.NET PDF Password Library: add, remove, edit PDF file password in vb.net, ASP.NET, MVC, WinForms, WPF
Help to Improve the Security of Your PDF Document by Setting Password
adding password to pdf file; add password to pdf online
380
APPENDIX F. SOURCE CODE LISTINGS
int
pad = 0,
position;
int
bytes, i, j;
long
height = 0, width = 0;
struct bitmapheader bmheader;
struct bmpfileheader file_header;
struct ctstruct rgb[GRAY_LEVELS+1];
union short_char_union scu;
read_bmp_file_header(file_name, &file_header);
read_bm_header(file_name, &bmheader);
height = bmheader.height;
width = bmheader.width;
if(height < 0) height = height*(-1);
buffer = (char *) malloc(width * sizeof(char ));
for(i=0; i<width; i++)
buffer[i] = ’\0’;
image_file = fopen(file_name, "rb+");
/****************************************
*
*
Write the color table first.
*
****************************************/
position
= fseek(image_file, 54, SEEK_SET);
for(i=0; i<GRAY_LEVELS+1; i++){
rgb[i].blue = i;
rgb[i].green = i;
rgb[i].red
= i;
} /* ends loop over i */
for(i=0; i<bmheader.colorsused; i++){
buffer[0] = rgb[i].blue;
fwrite(buffer , 1, 1, image_file);
buffer[0] = rgb[i].green;
fwrite(buffer , 1, 1, image_file);
buffer[0] = rgb[i].red;
fwrite(buffer , 1, 1, image_file);
buffer[0] = 0x00;
fwrite(buffer , 1, 1, image_file);
} /* ends loop over i */
C# PDF insert image Library: insert images into PDF in C#.net, ASP
C#.NET PDF SDK - Add Image to PDF Page in C#.NET. How to Insert & Add Image, Picture or Logo on PDF Page Using C#.NET. Add Image to PDF Page Using C#.NET.
pdf password online; add copy protection pdf
VB.NET PDF insert image library: insert images into PDF in vb.net
VB.NET PDF - Add Image to PDF Page in VB.NET. Guide VB.NET Programmers How to Add Images in PDF Document Using XDoc.PDF SDK for VB.NET.
pdf protected mode; crystal report to pdf with password
F.1. CODE LISTINGS FOR CHAPTER 1
381
position
= fseek(image_file,
file_header.bitmapoffset,
SEEK_SET);
pad = calculate_pad(width);
for(i=0; i<height; i++){
for(j=0; j<width; j++){
if(bmheader.bitsperpixel == 8){
scu.s_num = 0;
if(bmheader.height > 0)
scu.s_num = array[height-1-i][j];
else
scu.s_num = array[i][j];
buffer[j] = scu.s_alpha[0];
} /* ends if bits_per_pixel == 8 */
else{
printf("\nERROR bitsperpixel is not 8");
exit(1);
}
} /* ends loop over j */
bytes = fwrite(buffer, 1, width, image_file);
if(pad != 0){
for(j=0; j<pad; j++)
buffer[j] = 0x00;
fwrite(buffer, 1, pad, image_file);
} /* ends if pad != 0 */
} /* ends loop over i */
fclose(image_file);
free(buffer);
} /* ends write_bmp_image */
/**********************************************
*
*
is_a_bmp(...
C# PDF Sticky Note Library: add, delete, update PDF note in C#.net
C#.NET PDF SDK - Add Sticky Note to PDF Page in C#.NET. Able to add notes to PDF using C# source code in Visual Studio .NET framework.
create password protected pdf; create password protected pdf reader
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
PDF; C# Protect: Add Password to PDF; C# Form: extract value from fields; C# Annotate: PDF Markup & Drawing. XDoc.PDF for VB.NET▶: VB
pdf file password; add password to pdf document
382
APPENDIX F. SOURCE CODE LISTINGS
*
*
This function looks at a file to see if it
*
is a bmp file. First look at the file
*
extension. Next look at the filetype to
*
ensure it is 0x4d42.
*
***********************************************/
int is_a_bmp(file_name)
char *file_name;
{
char
*cc;
int
result = 0;
struct bmpfileheader file_header;
cc = strstr(file_name, ".bmp");
if(cc == NULL)
return(result);
read_bmp_file_header(file_name, &file_header);
if(file_header.filetype != 0x4d42)
return(result);
result = 1;
return(result);
} /* ends is_a_bmp */
/******************************************
*
*
calculate_pad(...
*
*
This function calculates the pad needed
*
at the end of each row of pixels in a
*
bmp image.
*
******************************************/
int calculate_pad(width)
long width;
{
int pad = 0;
C# PDF File Permission Library: add, remove, update PDF file
PDF; C# Protect: Add Password to PDF; C# Form: extract value from fields; C# Annotate: PDF Markup & Drawing. XDoc.PDF for VB.NET▶: VB
a pdf password online; convert pdf password protected to word online
C# HTML5 PDF Viewer SDK to view, annotate, create and convert PDF
in Visual Studio .NET project. Support to add password to PDF document and edit password on PDF file. Able to protect PDF document
break pdf password online; copy from protected pdf
F.1. CODE LISTINGS FOR CHAPTER 1
383
pad = ( (width%4) == 0) ? 0 : (4-(width%4));
return(pad);
} /* ends calculate_pad */
/*********************************************
*
*
equate_bmpfileheaders(...
*
*
This function sets the elements of the
*
destination header to the values of the
*
source header.
*
*********************************************/
equate_bmpfileheaders(src, dest)
struct bmpfileheader *src, *dest;
{
dest->filetype
= src->filetype;
dest->filesize
= src->filesize;
dest->reserved1
= src->reserved1;
dest->reserved2
= src->reserved2;
dest->bitmapoffset = src->bitmapoffset;
} /* ends equate_bmpfileheaders */
/******************************************
*
*
flip_image_array(...
*
*
This function flips an image array
*
about its horizontal mid-point.
*
******************************************/
flip_image_array(the_image, rows, cols)
long
cols, rows;
short **the_image;
{
C# PDF Digital Signature Library: add, remove, update PDF digital
PDF; C# Protect: Add Password to PDF; C# Form: extract value from fields; C# Annotate: PDF Markup & Drawing. XDoc.PDF for VB.NET▶: VB
advanced pdf password remover; convert password protected pdf to excel online
VB.NET PDF File Permission Library: add, remove, update PDF file
PDF; C# Protect: Add Password to PDF; C# Form: extract value from fields; C# Annotate: PDF Markup & Drawing. XDoc.PDF for VB.NET▶: VB
copy protecting pdf files; acrobat password protect pdf
384
APPENDIX F. SOURCE CODE LISTINGS
int i, j;
long rd2;
short **temp;
temp = allocate_image_array(rows, cols);
rd2 = rows/2;
for(i=0; i<rd2; i++){
for(j=0; j<cols; j++){
temp[rows-1-i][j] = the_image[i][j];
} /* ends loop over j */
} /* ends loop over i */
for(i=rd2; i<rows; i++){
for(j=0; j<cols; j++){
temp[rows-1-i][j] = the_image[i][j];
} /* ends loop over j */
} /* ends loop over i */
for(i=0; i<rows; i++)
for(j=0; j<cols; j++)
the_image[i][j] = temp[i][j];
free_image_array(temp, rows);
} /* ends flip_image_array */
Listing 1.3 - The BMP I/O Routines
/************************************************************
*
*
file cips.h
*
*
Functions: This file contains no functions. It
*
contains declarations of the data structures used
*
by the C Image Processing Systems CIPS.
*
*
Purpose:
*
To declare data structures.
*
*
Modifications:
F.1. CODE LISTINGS FOR CHAPTER 1
385
*
June 1990 = created
*
**********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
#include <dos.h>
#include <math.h>
#include <malloc.h>
#include <string.h>
#include <sys\types.h>
#include <sys\stat.h>
#define MAX_NAME_LENGTH
80
#define ROWS
100
#define COLS
100
#define GRAY_LEVELS
255
#define PREWITT
1
#define PEAK_SPACE
50
#define PEAKS
30
#define KIRSCH
2
#define SOBEL
3
#define STACK_SIZE
40000
#define STACK_FILE_LENGTH
500
#define FORGET_IT
-50
#define STACK_FILE
"c:stack"
#define OTHERC 1
#undef MSC
/**************************************************
*
*
The following struct defines the information
*
you need to read from the tiff file
*
header.
*
***************************************************/
struct tiff_header_struct{
short lsb;
long bits_per_pixel;
long image_length;
386
APPENDIX F. SOURCE CODE LISTINGS
long image_width;
long strip_offset;
};
/**************************************************
*
*
The following struct defines the information
*
you need to read from the bmp file
*
header.
*
***************************************************/
struct bmpfileheader{
unsigned short filetype;
unsigned long
filesize;
short reserved1;
short reserved2;
unsigned long
bitmapoffset;
};
struct bitmapheader{
unsigned long
size;
long
width;
long
height;
unsigned short planes;
unsigned short bitsperpixel;
unsigned long
compression;
unsigned long
sizeofbitmap;
unsigned long
horzres;
unsigned long
vertres;
unsigned long
colorsused;
unsigned long
colorsimp;
};
struct ctstruct{
unsigned char blue;
unsigned char green;
unsigned char red;
};
/*********************************************
*
F.1. CODE LISTINGS FOR CHAPTER 1
387
*
The following unions are used
*
to put the bytes from the header
*
into either an integer or a floating
*
point number.
*
**********************************************/
union short_char_union{
short s_num;
char s_alpha[2];
};
union int_char_union{
int i_num;
char i_alpha[2];
};
union long_char_union{
long l_num;
char l_alpha[4];
};
union float_char_union{
float f_num;
char f_alpha[4];
};
union ushort_char_union{
short s_num;
char s_alpha[2];
};
union uint_char_union{
int i_num;
char i_alpha[2];
};
union ulong_char_union{
long l_num;
char l_alpha[4];
};
Listing 1.4 - The cips.h Include File
388
APPENDIX F. SOURCE CODE LISTINGS
/***********************************************
*
*
file c:\cips\round.c
*
*
Functions: This file contains
*
main
*
*
Purpose:
*
This program takes an image file and
*
rounds if off by copying a part of it
*
to another file.
*
*
External Calls:
*
imageio.c - does_not_exit
*
get_image_size
*
allocate_image_array
*
read_image_array
*
is_a_tiff
*
is_a_bmp
*
create_allocate_tiff_file
*
read_bmp_file_header
*
read_bm_header
*
create_allocate_bmp_file
*
write_image_array
*
free_image_array
*
*
*
Modifications:
*
31 March 1991 - created
*
8 May 1993 - Made this program
*
command line driven.
*
6 August 1998 - Made this work with
*
entire image arrays at once.
*
18 September 1998 - modified to work with
*
all I O routines in imageio.c.
*
***********************************************/
#include "cips.h"
main(argc, argv)
int argc;
char *argv[];
Documents you may be interested
Documents you may be interested