13 Replies Latest reply: Aug 13, 2012 3:27 PM by Neil-Kentucky RSS

    JavaCode: Save as image, then re-combine as PDF?

    Neil-Kentucky Community Member

      I'm using Acrobat X Pro, Windows 7.

       

      I'm trying to remove ALL ability for clients to modify data in a file.  Because not even flattening will remove everything, and printing and scanning again is out of the question, I have a slow workaround: I save my PDF as a PNG image, then back as a PDF in order to clean the file and make everything permanent.

       

      This is VERY time consuming so in order to speed up this process, I need an action that runs a javascript that does the following:

       

      1) Save the current open file as a PNG into currentdirectory\currentfilename1.png... filename2.png... filename3.png... etc.

      2) Combines the PNG files into a single PDF.

      3) Saves that PDF as the original filename with "_img" appended to the end of the filename.

      4) Deletes the PNG files recently created.

       

      Can someone help me code this? It looks like something that a guru could code quickly, but i know nothing about java yet this code would save me hours a day.  Any help you can offer is greatly appreciated! Thank you.

       

      -Neil

        • 1. Re: JavaCode: Save as image, then re-combine as PDF?
          Test Screen Name MVP

          Won't they just run OCR? Or, if it is worth five minutes, create new elements and copy/paste them over your file? Or just make a fake if a changed document has value to them?

           

          Stopping modification is pretty much a non-starter. They way the world is going is digital signatures, which don't stop anything, but make it easy to verify you have an original, and to detect change.

          • 2. Re: JavaCode: Save as image, then re-combine as PDF?
            Neil-Kentucky Community Member

            Yeah, i've been through this discussion with others before and the bottom line is I like it as an image.

             

            If they do text recognition, that's fine and not the issue.  The issue is in seeing how the document was created or easily extracting the different elements in the file.  With an image there's absolutely NO way for them to seperate different portions of the original document the same way it was originally constructed, such as finding out a stamp was used to sign a name, etc. etc.

             

            Is this script not an easy one? for me it seems impossible after hours of trying to learn how to do the java in adobe, I can't figure it out.

            • 3. Re: JavaCode: Save as image, then re-combine as PDF?
              Neil-Kentucky Community Member

              Nobody knows how to scrip this?

              • 4. Re: JavaCode: Save as image, then re-combine as PDF?
                James Wilson

                Is there a reason it needs to be Java, or are you just referring to the javascript execution available in Acrobat's Actions?

                • 5. Re: JavaCode: Save as image, then re-combine as PDF?
                  Neil-Kentucky Community Member

                  It can be setup any way.. I just need it to execute automatically at the press of a button anad i thought that java was the only way.

                  • 6. Re: JavaCode: Save as image, then re-combine as PDF?
                    Bernd Alheit MVP

                    Adobe Acrobat doesn't use Java.

                    • 7. Re: JavaCode: Save as image, then re-combine as PDF?
                      MarkWalsh Community Member

                      Neil-Kentucky wrote:

                       

                      It can be setup any way.. I just need it to execute automatically at the press of a button anad i thought that java was the only way.

                       

                      You're using the term 'Java' instead of 'JavaScript'. They are not the same thing. Acrobat uses JavaScript, not Java.

                      • 8. Re: JavaCode: Save as image, then re-combine as PDF?
                        MarkWalsh Community Member

                        I haven't used it myself, but have you checked out the 'Sanitize document' feature in Acrobat X? It's under the 'Tools' bar, 'Protection' tab. I believe this might do what you need.

                        • 9. Re: JavaCode: Save as image, then re-combine as PDF?
                          James Wilson Community Member

                          One more question - is there a reason you aren't using the security settings to restrict any edits to the document? It's available at the click of a button and fairly effective at rendering documents unusable for anything but viewing (correctly configured).

                           

                          Other than that, you could create an action that has no steps, just the Save function, using the 'Export File9s) to Alternate format' option to create the PNG files (adding the _img extension.

                           

                          Then create a second action that assembles files in the directory (where the PNG files were saved) into a single PDF.

                           

                          Unfortunately, you're stuck with having not only multiple actions, but manual intervention with this method, as you have to identify the files to combine for the second action.

                          • 10. Re: JavaCode: Save as image, then re-combine as PDF?
                            Neil-Kentucky Community Member

                            MarkWalsh wrote:

                             

                            I haven't used it myself, but have you checked out the 'Sanitize document' feature in Acrobat X? It's under the 'Tools' bar, 'Protection' tab. I believe this might do what you need.

                             

                            It might protect the document, but you are able to visually discern that the document was electronically modified that way.  Such as stamps flickering when you page down while the images refresh.  Although you cannot modify them, it's quite obvious they were added later.  With an image it's all blended together as one.

                            • 11. Re: JavaCode: Save as image, then re-combine as PDF?
                              Neil-Kentucky Community Member

                              James Wilson wrote:

                               

                              One more question - is there a reason you aren't using the security settings to restrict any edits to the document? It's available at the click of a button and fairly effective at rendering documents unusable for anything but viewing (correctly configured).

                               

                              Other than that, you could create an action that has no steps, just the Save function, using the 'Export File9s) to Alternate format' option to create the PNG files (adding the _img extension.

                               

                              Then create a second action that assembles files in the directory (where the PNG files were saved) into a single PDF.

                               

                              Unfortunately, your stuck with having not only multiple actions, but manual intervention with this method, as you have to identify the files to combine for the second action.

                              First, thanks everyone for your help so far! it's been great! but it is still an unanswered question:

                               

                              Regarding security settings, see the post i just made.

                               

                              For the action solutions, I like your suggestion better than what i've been doing because it at least reduces my steps by a few.

                               

                              so then is it possible to create a javaSCRIPT to combine all files in a fixed location sequentially into a single PDF?  Theoretically, this seems like an easy thing to script to someone who knows how--unless it's just not possible the way acrobat was written.  Am i wrong?   

                              • 12. Re: JavaCode: Save as image, then re-combine as PDF?
                                MarkWalsh Community Member

                                Did you try it? On the PDF form I tested it on, it seemed to make the entire PDF into an image (Text that was native & selectable in the original PDF was rasterized in the sanitized file)

                                Neil-Kentucky wrote:

                                 

                                MarkWalsh wrote:

                                 

                                I haven't used it myself, but have you checked out the 'Sanitize document' feature in Acrobat X? It's under the 'Tools' bar, 'Protection' tab. I believe this might do what you need.

                                 

                                It might protect the document, but you are able to visually discern that the document was electronically modified that way.  Such as stamps flickering when you page down while the images refresh.  Although you cannot modify them, it's quite obvious they were added later.  With an image it's all blended together as one.

                                • 13. Re: JavaCode: Save as image, then re-combine as PDF?
                                  Neil-Kentucky Community Member

                                  It doesn't work for me mainly because I need my comments and stamps to remain in the document.

                                   

                                  Secondly, one effect that printing to image give me that I actually LIKE (which most people wouldn't) is that it drops the resolution in the file as well and makes all the text blend together more.  For example, if I have a scanned document, then paste a stamp on it, the stamp looks much more crisp and obviously is not part of the original document--the detail difference is just too great.  However, after converting to image and back to pdf, everything looks about the same,  This works great for signing documents with stamps.