Its superconfusing for me, since pdfmaker and postscript are doing same, but in practice coding style is quite different.
I know how to make a line with 2 circles at its end, with moveto and lineto and arc command in Postscript language, however, apparently I have to move to pdfmark due to hyperlinks, pdfmark manual is super un-understandable, and there is no other reference(book/online tutorial).
So, I would be appreciate, if one could generate such thing (as my figure shows) with a little description.
Here's the most simplest version possible. This creates a clickable area in the bottom left corner of the PDF that goes off to a URL.
[/Rect [ 0 0 200 200 ] % Draw a rectangle
/Action % Define an action
<<
/Subtype /URI % Define the action's subtype as a hyperlink
/URI (http://www.example.com/) % Set the URL
>>
/Subtype /Link % Set the type of this PDFmark to a link
/ANN pdfmark % Add the annotation
By default a border will be drawn so you might want to clear that out:
[/Rect [ 0 0 200 200 ] % Draw a rectangle
/Action % Define an action
<<
/Subtype /URI % Define the action's subtype as a hyperlink
/URI (http://www.example.com/) % Set the URL
>>
/Border [0 0 0] % Remove the border
/Subtype /Link % Set the type of this PDFmark to a link
/ANN pdfmark % Add the annotation
This only creates a clickable area, however. You then need to draw some text to click on:
/Helvetica findfont 16 scalefont setfont % Set the font to Helvetica 16pt
5 100 moveto % Set the drawing location
(http://www.example.com/) show % Show some text
Lastly, pdfmark isn't technically defined within the standard so they recommend that if you're not using Adobe's Distiller that you define something to handle it. This code will basically just ignore pdfmark if the compiler doesn't recognize it:
/pdfmark where
{pop}
{
/globaldict where
{ pop globaldict }
{ userdict }
ifelse
/pdfmark /cleartomark load put
}
ifelse
And here's a full working PostScript program:
%!PS-Adobe-1.0
/pdfmark where
{pop}
{
/globaldict where
{ pop globaldict }
{ userdict }
ifelse
/pdfmark /cleartomark load put
}
ifelse
[/Rect [ 0 0 200 200 ] % Draw a rectangle
/Action % Define an action
<<
/Subtype /URI % Define the action's subtype as a hyperlink
/URI (http://www.example.com/) % Set the URL
>>
/Border [0 0 0] % Remove the border
/Subtype /Link % Set the type of this PDFmark to a link
/ANN pdfmark % Add the annotation
/Helvetica findfont 16 scalefont setfont % Set the font to Helvetica 16pt
5 100 moveto % Set the drawing location
(http://www.example.com/) show % Show some text
showpage
EDIT
Also, check out this manual for more in-depth instructions on pdfmark
EDIT 2
Also, also, I should point out that I've spaced things out for instructional purposes. In most cases you'll see the /Action written as a single line such as:
/Action << /Subtype /URI /URI (http://www.example.com/) >>
Related
Can anyone suggest how to extend page size on one side using postscript? I have to put a mark on a heavy bunch of documents. I use postscript for this (as technology that most native to pdfs, obviously as speed is critical for the task).
I am able to put a mark on the document itself, but I have to add a blank field to the right of each page and this is the problem.
This is what is going on (the mark [copy] is added above the pdf)
This is what has to be (page size extended with blank field on the right):
This is the content of my mark.ps file
<<
/EndPage
{
2 eq { pop false }
{
gsave
7.0 setlinewidth
70 780 newpath moveto
70 900 lineto
120 900 lineto
120 780 lineto
66.5 780 lineto
stroke
closepath
/Helvetica findfont 18 scalefont setfont
newpath
100 792.5 moveto
90 rotate
(COPY) true charpath fill
1 setlinewidth stroke
0 setgray
grestore
true
} ifelse
} bind
>> setpagedevice
This is how it is applied to pdf
gs \
-q \
-dBATCH \
-dNOPAUSE \
-sDEVICE=pdfwrite \
-sOutputFile=output.pdf \
-f mark.ps \
input.pdf
What I tried :
Change page size << /PageSize [595 1642] >> setpagedevice - didnt work
use -g option in gs like this: -g595x1642 - also didnt work fine
If someone has relevant suggestions please share!
I have SVG documents which I convert to PDF via ghostscript in the end of my workflow. Now I have to add a new feature.
I need to replace some element in the SVG with PDF content. It's not
just overlay, it could be rotated and scaled proportionally, here is an image for example:
"example"
My question is are there any way to do it with ghostscript?
At the moment I just insert it as rasterized image by SVG image elements but I'll need it to be vector for printing.
NOTE: I'll need to take only first page from the inserted PDF.
I know there are a pdftk which can overlay one PDF file over another, but I can't scale and rotate overlayed PDF document with it.
OK so I'm afraid that, due to recent changes in the Ghostscript PDF interpreter to address security vulnerabilities, this code will only work with versions up to 9.26. In future teh PDF itnerpreter will be altered and there will be better ways to achieve this, but I'm afraid that's a long-term goal. For now, to use this code, you'll need to stick with an older version.
The PostScript program which does this is as follows:
%!PS
%%
%% This code is copied from pdf_main.ps, pdfshowpage_finish
%% sadly that routine always calls showpage, and we want that
%% to be under our control, so we have to duplicate the code
%% here. Not only that but it uses GS extensions which aren't
%% available outside of startup, so some things it simply can't
%% replicate. As a result some of the error handling is less
%% good.
%%
%% I plan to extend the PDF interpreter with two new
%% routines, pdfnoshowpage_finish and then have both
%% that and pdfshowpage_finish call pdfoptionalshowpage_finish
%% which will take a boolean determining whether to actually
%% call the showpage. At that time we'll alter this code.
%%
/draw_page_content { % <pagedict> pdfshowpage_finish -
save /PDFSave exch store
/PDFdictstackcount countdictstack store
/PDFexecstackcount count 2 sub store
(before exec) VMDEBUG
% set up color space substitution (this must be inside the page save)
pdfshowpage_setcspacesub
% Display the actual page contents.
8 dict begin
/BXlevel 0 def
/BMClevel 0 def
/OFFlevels 0 dict def
/BGDefault currentblackgeneration def
/UCRDefault currentundercolorremoval def
%****** DOESN'T HANDLE COLOR TRANSFER YET ******
/TRDefault currenttransfer def
matrix currentmatrix
2 dict
dictbeginpage setmatrix
/DefaultQstate qstate store
count 1 sub /pdfemptycount exch store
% If the page uses any transparency features, show it within
% a transparency group.
dup pageusestransparency dup /PDFusingtransparency exch def {
% Show the page within a PDF 1.4 device filter.
0 .pushpdf14devicefilter {
/DefaultQstate qstate store % device has changed -- reset DefaultQstate
% If the page has a Group, enclose contents in transparency group.
% (Adobe Tech Note 5407, sec 9.2)
dup /Group knownoget {
1 index /CropBox pget {
/CropBox exch
} {
1 index get_media_box pop /MediaBox exch
} ifelse
oforce_elems normrect_elems fix_empty_rect_elems 4 array astore .beginformgroup
showpagecontents
.endtransparencygroup
} {
showpagecontents
} ifelse
} stopped {
% abort the transparency device
.abortpdf14devicefilter
/DefaultQstate qstate store % device has changed -- reset DefaultQstate
stop
} if .poppdf14devicefilter
/DefaultQstate qstate store % device has changed -- reset DefaultQstate
} {
showpagecontents
} ifelse
.free_page_resources
% todo: mixing drawing ops outside the device filter could cause
% problems, for example with the pnga device.
end % scratch dict
% Some PDF files don't have matching q/Q (gsave/grestore) so we need
% to clean up any left over dicts from the dictstack
PDFdictstackcount //false
{ countdictstack 2 index le { exit } if
currentdict /n known not or
end
} loop
pop
count PDFexecstackcount sub { pop } repeat
Repaired % pass Repaired state around the restore
PDFSave restore
currentglobal pdfdict gcheck .setglobal
.setglobal
/Repaired exch def
} def
% And now, draw the page from teh first PDF file
(d:/temp/SO/target.pdf) (r) file runpdfbegin
save
1 pdfgetpage
dup /Page exch store draw_page_content
restore
runpdfend
% and then the page from the secodn PDF file
(d:/temp/SO/source.pdf) (r) file runpdfbegin
save
1 pdfgetpage
dup /Page exch store
% Before drawing the second page, adjust the CTM so
% that the bottom left corner of the page is co-incident
% with the bottom left of the area we want to draw the
% page in
75 575 translate
% adjust the size of the output
0.11 0.11 scale
% and rotate it
-46 rotate
draw_page_content
restore
runpdfend
showpage
Save that in a file, lets call it test.ps, and adjust the paths in the PostScript program suitably. Then run Ghostscript with: gs -sDEVICE=pdfwrite -sOutputFile=out.pdf test.ps and you'll get a PDF file something like what I think you want. Obviously you'll also need to change the numbers for translate/scale/rotate.
I'm posting here a solution which support clipping of pasted PDF file in case if somebody will need it in future. I've added additional parameters to draw_page_content to support that. I appeared that "dict beginpage setmatrix" command somehow overrides clipping path and it should be set only after that command. I'm not an expert in PostScript, but at least this solution is working. Thanks again KenS for your help.
%!PS
%%
%% This code is copied from pdf_main.ps, pdfshowpage_finish
%% sadly that routine always calls showpage, and we want that
%% to be under our control, so we have to duplicate the code
%% here. Not only that but it uses GS extensions which aren't
%% available outside of startup, so some things it simply can't
%% replicate. As a result some of the error handling is less
%% good.
%%
%% I plan to extend the PDF interpreter with two new
%% routines, pdfnoshowpage_finish and then have both
%% that and pdfshowpage_finish call pdfoptionalshowpage_finish
%% which will take a boolean determining whether to actually
%% call the showpage. At that time we'll alter this code.
%%
/draw_page_content { % <pagedict> pdfshowpage_finish -
/clipx exch def /clipy exch def /clip_width exch def /clip_height exch def /should_clip exch def
save /PDFSave exch store
/PDFdictstackcount countdictstack store
/PDFexecstackcount count 2 sub store
(before exec) VMDEBUG
% set up color space substitution (this must be inside the page save)
pdfshowpage_setcspacesub
% Display the actual page contents.
8 dict begin
/BXlevel 0 def
/BMClevel 0 def
/OFFlevels 0 dict def
/BGDefault currentblackgeneration def
/UCRDefault currentundercolorremoval def
%****** DOESN'T HANDLE COLOR TRANSFER YET ******
/TRDefault currenttransfer def
matrix currentmatrix
2 dict
dictbeginpage setmatrix
% set clipping here
should_clip 0 gt
{
newpath clipx clipy moveto clipx clipy clip_height add lineto clipx clip_width add clipy clip_height add lineto clipx clip_width add clipy lineto closepath clip
}
{
}
ifelse
/DefaultQstate qstate store
count 1 sub /pdfemptycount exch store
% If the page uses any transparency features, show it within
% a transparency group.
dup pageusestransparency dup /PDFusingtransparency exch def {
% Show the page within a PDF 1.4 device filter.
0 .pushpdf14devicefilter {
/DefaultQstate qstate store % device has changed -- reset DefaultQstate
% If the page has a Group, enclose contents in transparency group.
% (Adobe Tech Note 5407, sec 9.2)
dup /Group knownoget {
1 index /CropBox pget {
/CropBox exch
} {
1 index get_media_box pop /MediaBox exch
} ifelse
oforce_elems normrect_elems fix_empty_rect_elems 4 array astore .beginformgroup
showpagecontents
.endtransparencygroup
} {
showpagecontents
} ifelse
} stopped {
% abort the transparency device
.abortpdf14devicefilter
/DefaultQstate qstate store % device has changed -- reset DefaultQstate
stop
} if .poppdf14devicefilter
/DefaultQstate qstate store % device has changed -- reset DefaultQstate
} {
showpagecontents
} ifelse
.free_page_resources
% todo: mixing drawing ops outside the device filter could cause
% problems, for example with the pnga device.
end % scratch dict
% Some PDF files don't have matching q/Q (gsave/grestore) so we need
% to clean up any left over dicts from the dictstack
PDFdictstackcount //false
{ countdictstack 2 index le { exit } if
currentdict /n known not or
end
} loop
pop
count PDFexecstackcount sub { pop } repeat
Repaired % pass Repaired state around the restore
PDFSave restore
currentglobal pdfdict gcheck .setglobal
.setglobal
/Repaired exch def
} bind def
% And now, draw the page from teh first PDF file
(/opt/files/main.pdf) (r) file runpdfbegin
save
1 pdfgetpage
dup /Page exch store 0 1125 1125 0 0 draw_page_content
restore
runpdfend
gsave
% and then the page from the next PDF file
(/opt/files/placement1.pdf) (r) file runpdfbegin
save
1 pdfgetpage
dup /Page exch store
% Before drawing the second page, adjust the CTM so
% that the bottom left corner of the page is co-incident
% with the bottom left of the area we want to draw the
% page in
120 120 translate
% and rotate it
25 rotate
% adjust the size of the output
0.7 0.7 scale
%let's skew file
[1 0 1.3 1 0 0] concat
% draw file and clip it
1 100 100 0 0 draw_page_content
restore
runpdfend
grestore
showpage
I am creating a PDF file from a TIFF image using ImageMagick and Ghostscript.
My source tiff is 16 bits per channel with no alpha (48 bit image) with an attached ICC Profile (AdobeRGB) and I want to maintaing this in the final PDF.
convert input.tif[0] -density 600 -alpha Off -size 5809x9408 -depth 16 intermediate.ps
This takes my input tiff image (just the main image, and not the thumbnail via using [0]) and creates a .ps file from the bitmap.
When I look at the size of the PostScript file, it's roughly the same size (3-4 MB larger than the 328MB tiff) as the source TIFF, but I can't tell if the image data in the .ps is 8 or 16 bit per channel.
Then, when I use GhostScript to convert this to a PDF, I'm getting 8 bits per channel in the PDF.
gs -dPDFA=1 -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sDefaultRGBProfile=AdobeRGB1998.icc -dOverrideICC -sOutputFile=output.pdf -r600 -P PDFA_def.ps -f custom.joboptions intermediate.ps
If I use pdfimages to inspect the PDF, it shows me 8 bit per channel.
pdfimages -list output.pdf
page num type width height color comp bpc enc interp object ID x-ppi y-ppi size ratio
--------------------------------------------------------------------------------------------
1 0 image 5809 9408 rgb 3 8 image no 10 0 600 600 74.1M 47%
The contents of my PDFA_def.ps has been modified from the default Ghostscript install to specify AdobeRGB (1998) as the colour profile:
%!
% This is a sample prefix file for creating a PDF/A document.
% Feel free to modify entries marked with "Customize".
% This assumes an ICC profile to reside in the file (ISO Coated sb.icc),
% unless the user modifies the corresponding line below.
% Define entries in the document Info dictionary :
/ICCProfile (AdobeRGB1998.icc) % Customise
def
[ /Title (Title) % Customise
/DOCINFO pdfmark
% Define an ICC profile :
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
[{icc_PDFA}
<<
/N currentpagedevice /ProcessColorModel known {
currentpagedevice /ProcessColorModel get dup /DeviceGray eq
{pop 1} {
/DeviceRGB eq
{3}{4} ifelse
} ifelse
} {
(ERROR, unable to determine ProcessColorModel) == flush
} ifelse
>> /PUT pdfmark
[{icc_PDFA} ICCProfile (r) file /PUT pdfmark
% Define the output intent dictionary :
[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
[{OutputIntent_PDFA} <<
/Type /OutputIntent % Must be so (the standard requires).
/S /GTS_PDFA1 % Must be so (the standard requires).
/DestOutputProfile {icc_PDFA} % Must be so (see above).
/OutputConditionIdentifier (sRGB) % Customize
>> /PUT pdfmark
[{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark
I've also got a custom.joboptions file that I created in Acrobat Distiller and then have modified for PDF/A compliance - I have tried to force 16-bit images in this file too, but I'm still getting 8-bit images in the PDF.
I don't know how many of these options Ghostscript respects and how many it ignores however. If I don't use this custom.joboptions file when making the PDF, the images are downsampled to a very low resolution.
<<
/ASCII85EncodePages false
/AllowTransparency false
/AutoPositionEPSFiles true
/AutoRotatePages /All
/Binding /Left
/CalGrayProfile (Dot Gain 20%)
/CalRGBProfile (sRGB IEC61966-2.1)
/CalCMYKProfile (U.S. Web Coated \050SWOP\051 v2)
/sRGBProfile (sRGB IEC61966-2.1)
/CannotEmbedFontPolicy /Error
/CompatibilityLevel 1.4
/CompressObjects /Off
/CompressPages true
/ConvertImagesToIndexed true
/PassThroughJPEGImages true
/CreateJobTicket false
/DefaultRenderingIntent /Default
/DetectBlends true
/DetectCurves 0.0000
/ColorConversionStrategy /LeaveColorUnchanged
/DoThumbnails false
/EmbedAllFonts true
/EmbedOpenType false
/ParseICCProfilesInComments true
/EmbedJobOptions false
/DSCReportingLevel 0
/EmitDSCWarnings false
/EndPage -1
/ImageMemory 1048576
/LockDistillerParams true
/MaxSubsetPct 100
/Optimize false
/OPM 1
/ParseDSCComments true
/ParseDSCCommentsForDocInfo true
/PreserveCopyPage true
/PreserveDICMYKValues true
/PreserveEPSInfo true
/PreserveFlatness true
/PreserveHalftoneInfo false
/PreserveOPIComments false
/PreserveOverprintSettings false
/StartPage 1
/SubsetFonts false
/TransferFunctionInfo /Apply
/UCRandBGInfo /Remove
/UsePrologue false
/ColorSettingsFile (None)
/AlwaysEmbed [ true
]
/NeverEmbed [ true
]
/AntiAliasColorImages false
/CropColorImages true
/ColorImageMinResolution 600
/ColorImageMinResolutionPolicy /OK
/DownsampleColorImages false
/ColorImageDownsampleType /Average
/ColorImageResolution 600
/ColorImageDepth -1
/ColorImageMinDownsampleDepth 16
/ColorImageDownsampleThreshold 1.50000
/EncodeColorImages true
/ColorImageFilter /FlateEncode
/AutoFilterColorImages false
/ColorImageAutoFilterStrategy /JPEG
/ColorACSImageDict <<
/QFactor 0.15
/HSamples [1 1 1 1] /VSamples [1 1 1 1]
>>
/ColorImageDict <<
/QFactor 0.15
/HSamples [1 1 1 1] /VSamples [1 1 1 1]
>>
/JPEG2000ColorACSImageDict <<
/TileWidth 256
/TileHeight 256
/Quality 30
>>
/JPEG2000ColorImageDict <<
/TileWidth 256
/TileHeight 256
/Quality 30
>>
/AntiAliasGrayImages false
/CropGrayImages true
/GrayImageMinResolution 300
/GrayImageMinResolutionPolicy /OK
/DownsampleGrayImages false
/GrayImageDownsampleType /Average
/GrayImageResolution 600
/GrayImageDepth -1
/GrayImageMinDownsampleDepth 2
/GrayImageDownsampleThreshold 1.50000
/EncodeGrayImages true
/GrayImageFilter /FlateEncode
/AutoFilterGrayImages false
/GrayImageAutoFilterStrategy /JPEG
/GrayACSImageDict <<
/QFactor 0.15
/HSamples [1 1 1 1] /VSamples [1 1 1 1]
>>
/GrayImageDict <<
/QFactor 0.15
/HSamples [1 1 1 1] /VSamples [1 1 1 1]
>>
/JPEG2000GrayACSImageDict <<
/TileWidth 256
/TileHeight 256
/Quality 30
>>
/JPEG2000GrayImageDict <<
/TileWidth 256
/TileHeight 256
/Quality 30
>>
/AntiAliasMonoImages false
/CropMonoImages true
/MonoImageMinResolution 1200
/MonoImageMinResolutionPolicy /OK
/DownsampleMonoImages false
/MonoImageDownsampleType /Average
/MonoImageResolution 2400
/MonoImageDepth -1
/MonoImageDownsampleThreshold 1.50000
/EncodeMonoImages true
/MonoImageFilter /CCITTFaxEncode
/MonoImageDict <<
/K -1
>>
/AllowPSXObjects false
/CheckCompliance [
/PDFA1B:2005
]
/PDFX1aCheck false
/PDFX3Check false
/PDFXCompliantPDFOnly true
/PDFXNoTrimBoxError false
/PDFXTrimBoxToMediaBoxOffset [
0.00000
0.00000
0.00000
0.00000
]
/PDFXSetBleedBoxToMediaBox true
/PDFXBleedBoxToTrimBoxOffset [
0.00000
0.00000
0.00000
0.00000
]
/PDFXOutputIntentProfile (Adobe RGB \0501998\051)
/PDFXOutputConditionIdentifier ()
/PDFXOutputCondition ()
/PDFXRegistryName ()
/PDFXTrapped /False
/CreateJDFFile false
>> setdistillerparams
<<
/HWResolution [600 600]
/PageSize [697.080 1128.960]
>> setpagedevice
PostScript can't handle 16 bits per component, it only handles 1, 2, 4, 8 and 12.
PDF doesn't support 12 BPC, only 1, 2, 4, 8 and 16.
So there isn't any way to get a PDF file with more than 12 BPC if you use PostScript as an intermediate format. Even if the PDF file says its 16 BPC the actual data will be limited to 12 (16BPC original -> 12 BPC PostScript -> 16 BPC PDF)
Now further to that, you say that you are creating a PDF/A file, and its PDF/A-1. If you read the PDF/A-1 specification you will see that its limited to PDF 1.4, checking the PDF Reference Manual, we find that 16 BPC images were introduced in PDF 1.5
So even if pdfwrite were able to upscale the 12 BPC image to a 16 BPC image (with padding), its not allowed to do so if you want to create a PDF/A-1 file, because that's not allowed by the specification. So I'm afraid you can't do what you want, you can't create a legal PDF/A-1 file with 16 BPC images using any tool.
Regarding downsampling, the default for colour image downsampling is 'false', so if you don't enable it (DownsampleColorImages=true) then the pdfwrite device won't downsample the images.
in v0.8.0 doing a
process :convert => "pdf"
on a jpg results in a the jpg being stored as is inside the pdf. I.e. the PDF is just a wrapper around the pdf.
after v0.9.0 the same operation results in a much smaller / lower resolution resampled jpg being stored in the pdf.
Same version of minimagick is begin used throughout.
the following two blocks are clipped from the resulting pdfs the first block was generated with carrierwave 0.9.0, the second was 0.8.0. That was the only change in the code / gemfile. The file being converted to PDF is a 600 DPI image. It appears that carrierwave 0.9.0 by default is using a dpi of 72 when converting images to PDF...
/Type /XObject
/BitsPerComponent 8
/ColorSpace /DeviceRGB
/Filter [ /RunLengthDecode ]
/Height 522
/Length 317714
/Name /Im0
/SMask 8 0 R
/Subtype /Image
/Width 378
/Type /XObject
/BitsPerComponent 8
/ColorSpace /DeviceRGB
/Filter [ /DCTDecode ]
/Height 4350
/Length 649502
/Name /Im0
/Subtype /Image
/Width 3150
This is a work around: replace
process :convert => :pdf
with
process :convert_to_pdf
and add
def convert_to_pdf # copied from carrierwave code base
# #format = :pdf # this line causes the problem... why?
manipulate! do |img|
img.format(:pdf)
img
end
end
In otherwords create your own convert function that DOES NOT have #format = :pdf which is what is causing the problem. #format = :pdf I believe is only needed if you are chaining manipulations together.
I'm currently trying to extract an image from a pdf file using iTextSharp.
The pdf is made from a scanner: it has a single page that contains one big image.
When looking at the file I find the following:
<< /Type /XObject /Subtype /Image /Name /Obj3 /Width 2480 /Height 3507 /ColorSpace /DeviceGray /BlackIs1 true /BitsPerComponent 1 /Length 5 0 R /Filter /CCITTFaxDecode /DecodeParms << /K -1 /Columns 2480 >> >> stream
I can access that using iTextSharp and I try to save it using the following code:
Dim aFromImageStream = New MemoryStream()
aFromImageStream.Write(bytes, 0, bytes.Length)
Dim anImage = System.Drawing.Bitmap.FromStream(aFromImageStream, True, True)
anImage.Save("c:\test.tiff", System.Drawing.Imaging.ImageFormat.Tiff)
But, that doesn't work as I get one big black tiff file with different shades of gray on top.
Does anyone know a way how I can decode those CCITTFaxDecode images?
Please see answers for Extracting image from PDF with /CCITTFaxDecode filter question.