[NTG-pdftex] [pdftex-Feature Requests][4348] Support custom /Filter for pdf data streams

pdftex-featurerequests at sarovar.org pdftex-featurerequests at sarovar.org
Wed Apr 4 18:30:04 CEST 2012


Feature Requests item #4348, was opened at 2012-04-04 16:30
Status: Open
Priority: 3
Submitted By: Christian Feuersaenger (ludewich)
Assigned to: Nobody (None)
Summary: Support custom /Filter for pdf data streams 
Category: PDF generation
Group: None
Resolution: None


Initial Comment:
Hi,

while working with binary streams in pdftex/luatex I encountered a problem with
/Filter : if I provide a /Filter argument for my stream (I wanted to use base
64) and \pdfcompresslevel>0, pdftex will overwrite my filter.

The result looks like

4 0 obj <<
/ShadingType 5 /BitsPerCoordinate 24 /BitsPerComponent 16 /VerticesPerRow 25 /ColorSpace /DeviceRGB/Decode [-16383.999992 16384 -16383.999992 16384 0 1] /Function << /FunctionType 3 /Domain [0 1] /Functions [ << /FunctionType 2 /Domain [0 1] /C0 [0 0 1] /C1 [1 1 0] /N 1 >> << /FunctionType 2 /Domain [0 1] /C0 [1 1 0] /C1 [1 0.5 0] /N 1 >> << /FunctionType 2 /Domain [0 1] /C0 [1 0.5 0] /C1 [1 0 0] /N 1 >> ] /Bounds [ 0.33333 0.66666] /Encode [ 0 1 0 1 0 1] >>  /Filter /ASCIIHexDecode 
/Length 4822      
/Filter /FlateDecode
>>
stream
....

which results in a complete loss of data because my own /Filter argument is
ignored; the file is corrupted. To correct the file, I have to enter

/Filter [/FlateDecode /ASCIIHexDecode]

FEATURE REQUEST:
I believe it would be cool if pdftex would scan the attributes for a /Filter
argument and insert its compression filter as first filter.

WORK-AROUND:
set \pdfcompresslevel=0 before generating the pdf stream object containing a custom filter.

This happens with
pdftex -version
pdfTeX 3.1415926-2.3-1.40.12 (TeX Live 2011)
kpathsea version 6.0.1
Copyright 2011 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.5.2; using libpng 1.5.2
Compiled with zlib 1.2.5; using zlib 1.2.5
Compiled with xpdf version 3.02pl5

I generated the pdf with
	\immediate\pdfobj stream attr {%
		% stream length will be computed automatically
		/ShadingType \pgfplotslibrarysurf at type\space
		/BitsPerCoordinate \pgfplotslibrarysurf at bitspercoordinate\space
		/BitsPerComponent 16
		\if5\pgfplotslibrarysurf at type
			/VerticesPerRow \pgfkeysvalueof{/pgfplots/surf shading/cols}
		\else
			/BitsPerFlag 8
		\fi
		/ColorSpace /Device\pgfplotslibrarysurf at colorspace
		/Decode [\pgfplotslibrarysurf at decode]
		/Function \pgfkeysvalueof{/pgfplots/surf shading/colormap}
		\ifx\pgfplotslibrarysurf at filter@decode\pgfutil at empty
		\else
			/Filter /\pgfplotslibrarysurf at filter@decode\space
		\fi
	} {%
		\pgfplotslibrarysurf at binarystream
	}%


I attached the offending (corrupt) pdf file.


----------------------------------------------------------------------

You can respond by visiting: 
http://sarovar.org/tracker/?func=detail&atid=496&aid=4348&group_id=106


More information about the ntg-pdftex mailing list