How to find out end of file in raster format

solomon slmnraj.raj25 at gmail.com
Sun Dec 6 18:41:36 PST 2009


> On Dec 5, 2009, at 11:32 PM, solomon wrote:
> >=20
> > Hi,
> >=20
> > I am developing a filter for my custom printer, i am developing based =
> on rastertoepson filter. i want to know one thing how to find out when =
> do we reach end of file of the printable file.
>
> When cupsRasterReadHeader/cupsRasterReadHeader2 returns 0, you have =
> reached the end-of-file (or detected a bad raster header/corrupt file).  =
> There will never be any additional data at the end of a properly formed =
> CUPS raster stream.
>
> > suppose in main before entering in to print data we are checking for =
> end of file using while statement as shown below:
> > while (cupsRasterReadHeader2(ras, &header))
> >=20
> > this loop will execute up to end of file. but if my page is longer =
> than end of file(printable file) i want to quit the printing may be as =
> shown below
>
> You need to call cupsRasterReadPixels for each line in the page.  Thus =
> the normal print loop looks something like this:
>
>     /* Read all pages in the raster stream */
>     while (cupsRasterReadHeader(ras, &header))
>     {
>       /* Allocate memory for reading pixels */
>       unsigned char *buffer =3D malloc(header.cupsBytesPerLine);
>
>       /* Read all of the lines on the current page */
>       for (y =3D 0; y < header.cupsHeight; y ++)
>         if (cupsRasterReadPixels(ras, buffer, header.cupsBytesPerLine))
>         {
>           /* Output the line to the printer */
>           ...
>         }
>         else
>           break;
>     }
>
>
> ___________________________________________________
> Michael Sweet, Senior Printing System Engineer
>
>


*buffer =3D malloc

here what do you mean is it variable?

>





More information about the cups-devel mailing list