| 1807 | */ |
| 1808 | |
| 1809 | static ssize_t /* O - Length of next line */ |
| 1810 | copy_trailer(cups_file_t *fp, /* I - File to read from */ |
| 1811 | pstops_doc_t *doc, /* I - Document info */ |
| 1812 | ppd_file_t *ppd, /* I - PPD file */ |
| 1813 | int number, /* I - Number of pages */ |
| 1814 | char *line, /* I - Line buffer */ |
| 1815 | ssize_t linelen, /* I - Length of initial line */ |
| 1816 | size_t linesize) /* I - Size of line buffer */ |
| 1817 | { |
| 1818 | /* |
| 1819 | * Write the trailer comments... |
| 1820 | */ |
| 1821 | |
| 1822 | (void)ppd; |
| 1823 | |
| 1824 | puts("%%Trailer"); |
| 1825 | |
| 1826 | while (linelen > 0) |
| 1827 | { |
| 1828 | if (!strncmp(line, "%%EOF", 5)) |
| 1829 | break; |
| 1830 | else if (strncmp(line, "%%Trailer", 9) && |
| 1831 | strncmp(line, "%%Pages:", 8) && |
| 1832 | strncmp(line, "%%BoundingBox:", 14)) |
| 1833 | fwrite(line, 1, (size_t)linelen, stdout); |
| 1834 | |
| 1835 | linelen = (ssize_t)cupsFileGetLine(fp, line, linesize); |
| 1836 | } |
| 1837 | |
| 1838 | fprintf(stderr, "DEBUG: Wrote %d pages...\n", number); |
| 1839 | |
| 1840 | printf("%%%%Pages: %d\n", number); |
| 1841 | if (doc->number_up > 1 || doc->fit_to_page) |
| 1842 | printf("%%%%BoundingBox: %.0f %.0f %.0f %.0f\n", |
| 1843 | PageLeft, PageBottom, PageRight, PageTop); |
| 1844 | else |
| 1845 | printf("%%%%BoundingBox: %d %d %d %d\n", |
| 1846 | doc->new_bounding_box[0], doc->new_bounding_box[1], |
| 1847 | doc->new_bounding_box[2], doc->new_bounding_box[3]); |
| 1848 | |
| 1849 | return (linelen); |
| 1850 | } |
| 1851 | |
| 1852 | |
| 1853 | /* |
no test coverage detected