Bugzilla – Attachment 101581 Details for
Bug 156300
CUPS support for poppler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
Poppler fix to generate necessary PostScript headers
poppler-0.5.4_psheader_fix.patch (text/x-diff), 5.44 KB, created by
Klaus Singvogel
on 2006-10-16 15:29:04 UTC
(
hide
)
Description:
Poppler fix to generate necessary PostScript headers
Filename:
MIME Type:
Creator:
Klaus Singvogel
Created:
2006-10-16 15:29:04 UTC
Size:
5.44 KB
patch
obsolete
>diff -Naur poppler-0.5.4.org/poppler/PSOutputDev.cc poppler-0.5.4/poppler/PSOutputDev.cc >--- poppler-0.5.4.org/poppler/PSOutputDev.cc 2006-10-09 09:42:58.000000000 +0200 >+++ poppler-0.5.4/poppler/PSOutputDev.cc 2006-10-09 09:43:11.000000000 +0200 >@@ -34,6 +34,7 @@ > #include "Page.h" > #include "Stream.h" > #include "Annot.h" >+#include "XRef.h" > #include "PSOutputDev.h" > #include "UGooString.h" > >@@ -1153,20 +1154,119 @@ > void PSOutputDev::writeHeader(int firstPage, int lastPage, > PDFRectangle *mediaBox, PDFRectangle *cropBox, > int pageRotate) { >+ Object info, obj1; > double x1, y1, x2, y2; >+ GooString *s; >+ int i; > > switch (mode) { > case psModePS: > writePS("%!PS-Adobe-3.0\n"); >- writePSFmt("%%%%Creator: xpdf/pdftops %s\n", xpdfVersion); >- writePSFmt("%%%%LanguageLevel: %d\n", >- (level == psLevel1 || level == psLevel1Sep) ? 1 : >- (level == psLevel2 || level == psLevel2Sep) ? 2 : 3); >- if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep) { >- writePS("%%DocumentProcessColors: (atend)\n"); >- writePS("%%DocumentCustomColors: (atend)\n"); >+ break; >+ case psModeEPS: >+ writePS("%!PS-Adobe-3.0 EPSF-3.0\n"); >+ break; >+ case psModeForm: >+ writePS("%!PS-Adobe-3.0 Resource-Form\n"); >+ break; >+ } >+ writePSFmt("%%Producer: xpdf/pdftops %s\n", xpdfVersion); >+ xref->getDocInfo(&info); >+ if (info.dictLookup("Creator", &obj1)->isString()) { >+ writePS("%%Creator: "); >+ s = obj1.getString(); >+ if ((s->getChar(0) & 0xff) == 0xfe && >+ (s->getChar(1) & 0xff) == 0xff) { >+ // Convert UTF-16 to UTF-8... >+ for (i = 2; i < s->getLength() && i < 400; i += 2) { >+ int ch = ((s->getChar(i) & 255) << 8) | (s->getChar(i + 1) & 255); >+ >+ if (ch >= 0xd800 && ch <= 0xdbff) { >+ // Multi-word UTF-16 char... >+ i += 2; >+ int lch = ((s->getChar(i) & 255) << 8) | (s->getChar(i + 1) & 255); >+ >+ if (lch < 0xdc00 || lch >= 0xdfff) continue; >+ >+ ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; >+ } >+ >+ if (ch < 0x80) >+ { >+ /* >+ * Single byte ASCII... >+ */ >+ >+ writePSChar(ch); >+ } >+ else if (ch < 0x800) >+ { >+ /* >+ * Two-byte UTF-8... >+ */ >+ >+ writePSChar(0xc0 | (ch >> 6)); >+ writePSChar(0x80 | (ch & 0x3f)); >+ } >+ else if (ch < 0x10000) >+ { >+ /* >+ * Three-byte UTF-8... >+ */ >+ >+ writePSChar(0xe0 | (ch >> 12)); >+ writePSChar(0x80 | ((ch >> 6) & 0x3f)); >+ writePSChar(0x80 | (ch & 0x3f)); >+ } >+ else >+ { >+ /* >+ * Four-byte UTF-8... >+ */ >+ >+ writePSChar(0xf0 | (ch >> 18)); >+ writePSChar(0x80 | ((ch >> 12) & 0x3f)); >+ writePSChar(0x80 | ((ch >> 6) & 0x3f)); >+ writePSChar(0x80 | (ch & 0x3f)); >+ } >+ } >+ } else { >+ for (i = 0; i < s->getLength() && i < 200; ++i) { >+ writePSChar(s->getChar(i)); >+ } >+ } >+ writePS("\n"); >+ } >+ obj1.free(); >+ if (info.dictLookup("Title", &obj1)->isString()) { >+ writePS("%%Title: "); >+ s = obj1.getString(); >+ if ((s->getChar(0) & 0xff) == 0xfe && >+ (s->getChar(1) & 0xff) == 0xff) { >+ // cheap Unicode-to-ASCII conversion >+ for (i = 3; i < s->getLength() && i < 400; i += 2) { >+ writePSChar(s->getChar(i)); >+ } >+ } else { >+ for (i = 0; i < s->getLength() && i < 200; ++i) { >+ writePSChar(s->getChar(i)); >+ } > } >- writePS("%%DocumentSuppliedResources: (atend)\n"); >+ writePS("\n"); >+ } >+ obj1.free(); >+ info.free(); >+ writePSFmt("%%%%LanguageLevel: %d\n", >+ (level == psLevel1 || level == psLevel1Sep) ? 1 : >+ (level == psLevel2 || level == psLevel2Sep) ? 2 : 3); >+ if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep) { >+ writePS("%%DocumentProcessColors: (atend)\n"); >+ writePS("%%DocumentCustomColors: (atend)\n"); >+ } >+ writePS("%%DocumentSuppliedResources: (atend)\n"); >+ >+ switch (mode) { >+ case psModePS: > writePSFmt("%%%%DocumentMedia: plain %d %d 0 () ()\n", > paperWidth, paperHeight); > writePSFmt("%%%%BoundingBox: 0 0 %d %d\n", paperWidth, paperHeight); >@@ -1177,15 +1277,6 @@ > writePS("%%EndDefaults\n"); > break; > case psModeEPS: >- writePS("%!PS-Adobe-3.0 EPSF-3.0\n"); >- writePSFmt("%%%%Creator: xpdf/pdftops %s\n", xpdfVersion); >- writePSFmt("%%%%LanguageLevel: %d\n", >- (level == psLevel1 || level == psLevel1Sep) ? 1 : >- (level == psLevel2 || level == psLevel2Sep) ? 2 : 3); >- if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep) { >- writePS("%%DocumentProcessColors: (atend)\n"); >- writePS("%%DocumentCustomColors: (atend)\n"); >- } > epsX1 = cropBox->x1; > epsY1 = cropBox->y1; > epsX2 = cropBox->x2; >@@ -1207,20 +1298,9 @@ > floor(x2) != ceil(x2) || floor(y2) != ceil(y2)) { > writePSFmt("%%%%HiResBoundingBox: %g %g %g %g\n", x1, y1, x2, y2); > } >- writePS("%%DocumentSuppliedResources: (atend)\n"); > writePS("%%EndComments\n"); > break; > case psModeForm: >- writePS("%!PS-Adobe-3.0 Resource-Form\n"); >- writePSFmt("%%%%Creator: xpdf/pdftops %s\n", xpdfVersion); >- writePSFmt("%%%%LanguageLevel: %d\n", >- (level == psLevel1 || level == psLevel1Sep) ? 1 : >- (level == psLevel2 || level == psLevel2Sep) ? 2 : 3); >- if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep) { >- writePS("%%DocumentProcessColors: (atend)\n"); >- writePS("%%DocumentCustomColors: (atend)\n"); >- } >- writePS("%%DocumentSuppliedResources: (atend)\n"); > writePS("%%EndComments\n"); > writePS("32 dict dup begin\n"); > writePSFmt("/BBox [%d %d %d %d] def\n",
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 156300
: 101581 |
101582
|
101584
|
101585