15 Replies Latest reply on Sep 9, 2013 1:43 PM by James Swainson

    Remove ALL Images from PDF Export?

    James Swainson

      I'd like to remove ALL images from a PDF export (Indesign CS6), with the intention of having the smallest file size possible for review. All the images are Photoshop PSDs.

       

      I have created a PDF Preset (PDF 1.7) that omits EPS, PDF and Bitmap.

       

      That covers any PSDs that contain opaque backgrounds, i.e. are considered to be non-transparent. However, any PSDs that do NOT contain such backgrounds still appear in the exported PDF. I assume they are NOT considered to be Bitmaps?!?

       

      I've gone for maximal compression of images (in the Preset) also just to see how small I can get the file, but it's still over a meg, and I'd really like even smaller. I live in a rural part of England where net access is painfully slow, and even a few meg of data takes far too long to upload, not to mention the constant drop-outs. Consider further that my document is likely to grow by several orders of magnitude and hopefully you can see why I'd like to sort this issue out as soon as possible.

       

      I've not done any scripting but assume it would be trivial to hide images with a script. However, I'm not sure how such a script might know how to make visible only the images that were previously hidden by the script. Obviously I would not wish to unhide images that must stay hidden. Maybe some form of image/object tagging, if that's even possible in this product, i.e. tag them "temp hide" on first pass of the script, and so forth.

       

      Any suggestions much appreciated.

       

      Regards,

      James

        • 1. Re: Remove ALL Images from PDF Export?
          Sandee Cohen Adobe Community Professional

          There are two suggestions I have.

           

          Don't bother with a script or a print preset.

           

          Just, as you are creating your document, put all images on their own layer. Then, when you're about to export as a PDF, set that layer to not print. The only downside to this is there is no indication that there was any image supposed to be there.

           

          Another way, use the PRINT dialog box to create a PostScript file. In that setup there is a section for Graphics. For the Send Data menu, choose None.

           

          send data.png

           

          What's surprising is this option is not available for the ordinary export to PDF.

           

          Once you have the PostScript file, you can then open it in Acrobat Distiller to create the PDF.

           

          The downside to this is it takes extra steps. The benefit is that each image area is indicated with a grey rectangle and an X through it.

          1 person found this helpful
          • 3. Re: Remove ALL Images from PDF Export?
            Laubender Adobe Community Professional & MVP

            @James – one solution could be setting the "nonprinting" property of all graphics to "true".

             

            To gather all graphics in a document, you could iterate through the "allGraphics" array of the active document and setting this property. Here an ExtendScript (JavaScript) example:

             

             

            //SetAllGraphicsToNonprinting_ACTIVE-DOCUMENT.jsx
            //Uwe Laubender
            /**
            * @@@BUILDINFO@@@ SetAllGraphicsToNonprinting_ACTIVE-DOCUMENT.jsx !Version! Sun Sep 08 2013 13:59:26 GMT+0200
            */
            
            //DESCRIPTION:Set all Graphics in the Active Document to Nonprinting; you can undo this.
            
            app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
            
            app.doScript(SetAllGraphicsToNonprinting, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Set all Graphics to Nonprinting");
            
            function SetAllGraphicsToNonprinting(){
            
                var allGraphicsArray = app.activeDocument.allGraphics;
            
                //Loop through all graphics in the active document:
                for(var n=0;n<allGraphicsArray.length;n++){
            
                    //Set one graphic after another to nonprinting
                    //To revert this, 
                    //just use undo or: 
                    //set the value " true " in the following line to " false "
                    //without the quotes!
            
                    allGraphicsArray[n].nonprinting = true;
            
                    };
                };
            

             

            You can "undo" this action after using the PDF export.

             

            Uwe

            1 person found this helpful
            • 4. Re: Remove ALL Images from PDF Export?
              rob day Adobe Community Professional & MVP

              In AppleScript  you can do it with one line and still get the undo

               

              tell application "Adobe InDesign CS6"

                  set nonprinting of all graphics of active document to true

              end tell

               

              Would JS do the same?

              app.activeDocument.allGraphics.nonprinting = true;

              • 5. Re: Remove ALL Images from PDF Export?
                Sandee Cohen Adobe Community Professional

                Uwe,

                 

                I still like the PostScript to Distiller technique as it shows where the images are supposed to be. Hiding the images leaves holes.

                 

                distiller.png

                 

                Oh, and you don't have to worry about undoing the action.

                1 person found this helpful
                • 6. Re: Remove ALL Images from PDF Export?
                  James Swainson Level 1

                  Uwe,

                   

                  Worked like a treat. PDF went down to approx. 600KB from 1.4MB with the additional image removal. Normal high quality at around 12MB.

                   

                  A few things of note:

                  • Text wrap remained untouched, as desired.
                  • Image location left as whitespace. Wonder if there is a way to somehow mark the image with a bounding rectangle? Perhaps a temporary border on the object box. Please forgive my lack of knowledge here.
                  • Undo worked as you said it would.

                   

                  Many thanks.

                   

                  I need to understand the whole scripting side better. Before copying your code, or even looking at it, I created one of my own, but used allGraphics[n] instead of allGraphicsArray[n]. This lead to an error in that it claimed a Photoshop image did not support nonprinting attribute. However, a switch over to your way worked just fine.

                   

                  All the best,

                  James

                  • 7. Re: Remove ALL Images from PDF Export?
                    James Swainson Level 1

                    Rob, I could not get JS to accept the command. Claiming that the object doesn't support the attribute. I did however get Uwe's script to work.

                     

                    Many thanks.

                    • 8. Re: Remove ALL Images from PDF Export?
                      James Swainson Level 1

                      Sandee, I too love the large X marks the spot, as opposed to the whitespace I'm getting from the scripting solution. I've asked Uwe if it's possible to somehow mark the bounding box in a similar way in scripting.

                       

                      Can you please confirm text wrap works as expected with your suggestion?

                       

                      Many thanks.

                       

                      James

                       

                      EDIT: I've just re-read your post and you show a clear text wrap example. I use detect edges on transparent images, so keen to know it would work with that situation.

                      • 9. Re: Remove ALL Images from PDF Export?
                        James Swainson Level 1

                        Thanks Salah.

                         

                        This lead to an interesting discovery. Even when I manage to turn off the printing of ALL images (using Uwe's script), the PDF Optimiser still shows 15% of the generated PDF is images?!? Very very curious.

                         

                        I'm weighing in with 25% for fonts as expected.

                         

                        My overhead however is 2.14%, so not so bad. Now would like to get to the bottom of this 15% issue.

                         

                        James

                        • 10. Re: Remove ALL Images from PDF Export?
                          James Swainson Level 1

                          I used the PDF Optimiser to remove embedded thumbnails to see if that resolved the issue. It did not.

                           

                          I then decided to Export All Images, that it claimed were taking up 15% of my document, and I received an error "Acrobat could not extract any images from this document. Only images that contain bitmap or raster data can be extracted.

                           

                          The plot thickens

                          • 11. Re: Remove ALL Images from PDF Export?
                            vectorbabe Level 1

                            Yes. There's a wrap in what I showed.

                             

                            Sent from my iPhone

                            So pardon the brevi

                            • 12. Re: Remove ALL Images from PDF Export?
                              Laubender Adobe Community Professional & MVP

                              @James – to mark the container frames of the nonprinting images by a fill color, you could add the following lines of code in the for loop:

                               

                              allGraphicsArray[n].nonprinting = true;
                              
                              
                              //The parent of the graphic is the container that holds it.
                              //We could use it to fill it with a tint of e.g. 20% of black:
                              
                              allGraphicsArray[n].parent.fillColor = "Black";
                              allGraphicsArray[n].parent.fillTint = 20;
                              
                              
                              

                               

                              But this approach will add a new problem for images, that only use a portion of the holding graphic frame. Or are only partly visible due to a clipping path or a clipping mask or totally transparent areas due to transparent pixels.

                               

                              Already colored backgrounds will be recolored…

                               

                              @Sandee – I see the advantage of the PostScript to Distiller way in this situation, but there are two disadvantages:

                               

                              1. Live transparency will be flattened (could be no issue in this use case, but you never know).

                              2. The gray area with the big X will be applied also to parts of the images where no pixels are present (transparent pixels in PhotoShop or TIFF files).

                               

                              To work around all these issues we need a more complex script that is building a  path object around the transparent parts of an image or using an applied clipping path for that purpose and fill that with a gray tint (and maybe with an X).

                               

                              Here some screen shots to illustrate the problems (with or without using PostScript/Distiller):

                               

                              1. Original set up:


                              One placed PhotoShop file with transparency stacked upon the text frame.
                              The image inside its holding frame is selected.

                              The visibility of one of its layers depicting a second chair on the left side is switched off.

                               

                              OriginalSetUp.png

                               

                              2. The same setup in a different view:

                               

                              OriginalSetUpWithoutGuidesShowing.png

                               

                              3. After running the script with the two additional lines of code:

                               

                              AfterFillColorApplied.png

                               

                              Using the PostScript method would do nearly the same plus adding a cross using the  area of the selected image.

                               

                               

                              Uwe

                              1 person found this helpful
                              • 13. Re: Remove ALL Images from PDF Export?
                                James Swainson Level 1

                                I suspected edge detection would cause such an issue.

                                 

                                That would be the ultimate solution, to show the outline of the detected edge (with a chosen stroke), and/or a chosen fill within that stroke.

                                 

                                Possibly this snippet could be used:

                                http://indisnip.wordpress.com/2010/08/11/extract-clipping-path/

                                 

                                James

                                • 14. Re: Remove ALL Images from PDF Export?
                                  rob day Adobe Community Professional & MVP

                                  I've gone for maximal compression of images (in the Preset) also just to see how small I can get the file, but it's still over a meg, and I'd really like even smaller.

                                  Have you tried maxing out the downsampling also? Something like this–9x9 is the smallest allowed:

                                   

                                  Screen Shot 2013-09-09 at 9.21.26 AM.png

                                  I tried it on a document with 36 images, which exported as 6.5mb with the default PDF/X-4 preset. With the above compression I got 472kb. With all the images deleted I got 431kb, so the 36 compressed images are only adding 40kb.

                                  • 15. Re: Remove ALL Images from PDF Export?
                                    James Swainson Level 1

                                    Good tip Rob.

                                     

                                    Mine went down to 993KB with the 9x9 downsample (Min quality). However, the image hide script takes it down to 595KB.

                                     

                                    The results looked awesome, like some 8bit Atari/Commodore from the 1980s

                                     

                                    The High Quality Print is now sitting at 11,719KB and the Min quality version at 3,590KB. Not bad considering I can hardly tell the difference in the images, even when blown wide to full screen.

                                     

                                    If I go for a 72PPI downsample on everything with min quality, I get images that look okayish in full page view, which is pretty good for review, at that comes in at 1,581KB.

                                     

                                    Having said all that, and been impressed with the results considering the reduction, ya just can't beat that 600KB no image review version. Now if I get some time, maybe I'll try and convert that snippet I posted earlier to expose the boundaries of a detect edge transparency and I'm good to go.

                                     

                                    James