How to save as "optimized" using IAC

Dear all,
I am trying to programmatically batch reduce the size of PDFs. Manually, I would go through File>Save as>Adobe PDF files, optimized. From reading the documenation I was expecting that I could achieve the same using (C# and IAC):
pdDoc.Save((short)Acrobat.PDSaveFlags.PDSaveLinearized, newName);
However, this doesn't reduce the size of the file at all. Could anyone point me in the right direction?
Kind regards,
Martin

I tried this:
Dim outDoc As CAcroPDDoc
Dim App As CAcroApp
Dim inDoc As CAcroPDDoc
Dim outputFileFullPath As String
Dim inputFileName As String
Dim i As Integer
'Dim fileNames(PDFfiles.Count - 1) As String
Dim xmlFileName As String
Dim w As String, x As String, y As String, z As String
Dim numInPages As Integer, numOutPages
Dim retval As Integer
Dim tempFileName As String
Dim xmlFile As String
Dim processAcrobat() As Process
Dim trialAttempts As Integer = 6
Dim triedAttempts As Integer
Dim finishedOptimization As Boolean
Dim killedAcrobat As Boolean
Dim BRetval As Boolean = False
Dim AcrobatJava As Object
'Dim pp As VariantType
'For i = 0 To PDFfiles.Count - 1
' fileNames(i) = PDFfiles(i)
'Next i
If PDFfiles.Count = 0 Then
'FileSet.LogMessage("No files were found for this set. Output File was going to be " & outputFileName)
Exit Function
End If
tempFileName = Path.Combine(outputDir, "temp.pdf")
If PDFfiles.Count > 1 Then
Try
'outDoc.New(outputFileFullPath)
outDoc = CreateObject("AcroExch.PDDoc")
App = CreateObject("AcroExch.App")
App.Hide()
'outDoc.Open(outputFileName)
File.Copy(PDFfiles(0), PDFfiles(0) + ".tmp", True)
outDoc.Open(PDFfiles(0) + ".tmp")
For i = 1 To PDFfiles.Count - 1
inDoc = CreateObject("AcroExch.PDDoc")
inputFileName = PDFfiles(i)
retval = inDoc.Open(inputFileName)
'outDoc.Attach(inDoc)
'outDoc.InputCopyAll()
numOutPages = outDoc.GetNumPages() - 1
numInPages = inDoc.GetNumPages()
retval = outDoc.InsertPages(numOutPages, inDoc, 0, numInPages, -1)
numOutPages = outDoc.GetNumPages()
inDoc.Close()
inDoc = Nothing
'File.Copy(inputFileName, outputDir & "/" & CStr(i) & ".pdf")
Next i
'outDoc.Close()
AcrobatJava = outDoc.GetJSObject()
App.Hide()
Dim pp As Object = AcrobatJava.getPrintParams()
pp.fileName = "file://c/ftp_stream/example/myDoc.ps"
pp.printerName = ""
AcrobatJava.print(pp)
'App.Show()
'App = Nothing
AcrobatJava = Nothing
outDoc.Save(Acrobat.PDSaveFlags.PDSaveFull + Acrobat.PDSaveFlags.PDSaveCollectGarbage + Acrobat.PDSaveFlags.PDSaveLinearized, Path.Combine(outputDir, outputFileName)) 'Path.Combine(outputDir, "final.pdf"))
outDoc.Close()
outDoc = Nothing
BRetval = True
Catch ex As Exception
'FileSet.LogMessage("Error Message 1007: Error concatenating Pdf Files for inputfile " & inputFileName & " OutputFile=" & outputFileName & " Error is " & Err.Description)
BRetval = False
Finally
outDoc = Nothing
Do Until killedAcrobat Or triedAttempts = trialAttempts
Try
processAcrobat = System.Diagnostics.Process.GetProcessesByName("Acrobat")
For i = 0 To processAcrobat.GetLength(0) - 1
processAcrobat(i).Kill()
Next
triedAttempts = triedAttempts + 1
If File.Exists(inputFileName + ".temp") Then
File.Delete(inputFileName + ".temp")
System.Threading.Thread.Sleep(1000)
End If
killedAcrobat = True
Catch exException As Exception
killedAcrobat = False
End Try
Loop
End Try
Else
File.Copy(PDFfiles(0), outputFileName, True)
End If
When I get to "getPrintParams" it pops up a dialogue window. How do I get it to not do that?

Similar Messages

  • How to save .pdf file using office word and excel

    Can someone help me how to save .pdf files using office word and excel?  I reinstalled my adobe 7.0 pro in my new pc and before I was able to do it but with my old pc.

    For anything after Office 2003, you have to print to the Adobe PDF printer. If you installed AA 7 on OS newer than XP, you may have to do a workaround to get it to work. With later versions of WORD you can always use the MS plugin for creating PDFs.

  • How to save Session Data using Oracle?

    Hi
    I am creating a web application that will be running on an infrastructure which will utilise a number of web servers, web gardens and a load balancer.
    As the application is using Sessions, and that our application is using Oracle as the database, we would like to use the database to save the Session data. However, I am struggling to find any good examples on how to do this with Oracle.
    I note that Oracle provides the following class: Oracle.Web.SessionState.OracleSessionStateStore, but I am unsure what I need to do in the Code Behind and what if any tables do I need to create in the database.
    Can anyone help me, please?

    You can store Oracle session state in the Oracle DB or in the mid-tier with Oracle Coherence.
    Here's a link to the Oracle ASP.NET provider doc:
    http://download.oracle.com/docs/cd/E17666_01/doc/win.112/e17192/toc.htm
    Chapter 1 has instructions about setting up the DB store ASP.NET provider data and schema objects.

  • How to save battery in using lumia 800

    I recharged my mobile phone tonight and when I woke up the phone was stll plugged into charging device ,
    I am using Lumia 800,
    following apps are installed on phone 
    1800 Pocket PC
    Adobe Reader
    ADO View
    Air Wakener
    Alarms
    App Highlights
    Audiocloud
    Baseball
    BBC News Free
    BBC World News
    Bluetooth Share
    Calculator
    Calculator Toolbox Free
    Calendar 
    Call Recorder
    Camera
    Camera Extras
    Cats
    ClearNote
    CNN
    Compass
    Concert Online
    Contacts Share
    Contacts Transfer
    Cool Remote
    Destination Manager
    Diary Buddy
    echoecho
    english_dictionary
    Facebook
    Free GPS Speedometer
    Games
    Google
    Google Mail
    Google Mail 2
    Google Mail 3
    Handyscan (free)
    Help+How-to
    HindiTranslator
    HT
    IBNLive
    IndianRail
    IndiaToday
    Internet Explorer
    Location Helper
    Maps
    Marketplace
    Messaging
    Music
    Music+Videos
    My Nokia
    NDTV
    Network Setup
    News 24
    Nokia City Lens
    Nokia Drive
    Nokia Maps
    Nokia Music
    NowFloats
    Office
    PC File Download
    PC Remote
    People
    Phone
    phoneTUBE
    Pictures
    Ringtone maker
    scan2pdf
    Settings
    Skydrive
    Skype
    Skyscanner
    SMS Collection
    Study Assist
    The Times of India
    TheHindu
    timesPoynt
    TrackMe
    Twitter
    Viber
    Video Search
    View Tube
    Voice Recorder
    Weather
    WhatsApp
    WiFi
    Wikitude
    WordMash
    WSJ Live
    Yahoo! Mail
    YouTube
    YouTube App
    What I notice is after 3 hours (approx) of disconnecting the phone from charging socket  battery is reduced  a bit I do not know how to measure the battery remaining etc , are these apps the reason for drain out of battery quickly if yes then how do I disable them for a few hours and re activate back again.
    Or I need some thing else to do to save battery?

    To cut the long story short.. Refer THIS  and THIS
    There are a lot of applications available at the MarketPlace which will give you the remaining battery time..but keep in mind that these values are calculated based on the immediate use and are just indicative. (e.g. immediately after playing a game which is draining the battery at a fast rate the battery may show 5 hrs. remaining..but after that you don't use the phone for a long time and the remaining battery may show as 12 hrs..)

  • How to save multiple rows using ADF faces ?!

    Hello;
    I am developing a search page using ADF faces (jdeveloper 10.1.3).
    after building my view i dragged it as search form on my page then i dragged it again as a read only table to display results with different iterator.
    I have a field act as a flag with 'Y' and 'N' value so i converted this field in the table to select boolean checkbox.
    what i need is ...
    after processing search operation i want to update this flag by 'Y' or 'N' (select/un-select checkbox) then click on a save button to save all result rows flag with its new status to the data base.
    Wish to know how to implement that.
    Thanks a lot

    Searching this forum yields How to do a bound af:SelectBooleanCheckbox inside of af:Table
    Hope this helps

  • How to save a page using pocket add on?

    .I installed it,,registered on it.can't find how to use it. I want to save web pages like in uc browser. In Firefox there is an option to save page for offline reading. But it will not save images.

    Hi kunnathukudy,
    It looks like there is an add on called Pocket Hits that adds the list to the new tab page panels. However I do not see the add on compatible for 37.0.2. So far I can only access it from the pocket website.

  • How to Save Screen data using BADI for Screen Exit

    Hi All,,
    I have requirement got MIGO Transaction. Customer wants one tab besides VENDOR on header level. For that i used BADI 'MB_MIGO_BADI'. Also i created Append Structure in MKPF Table for two fields and designed sreen using SE51.
    Now i want to save this data ( with added new fields ) into Data base table MKPF. I don't know where to place code .
    Also pl confirm me that, when i copy Sample Code from
    Go to -> Sample Code -> Copy . All the code is copied from BADI. So is it necessary to keep the code for each method as it or i have to comment all the code i each methos. i am littel bit confused abt it. Please tell me in detial.
    Also tell where to put logic for saving newly added fields .
    waiting
    Thanks and Regards.
    Ulhas

    is this the one you are looking for?
    Learning Series SAP NetWeaver Process Orchestration, Business to Business Add-on 2d OFTP Adapter

  • How to save requisitions without using E-Recruiting

    Hello All,
    Is there a way, to save requisitions data without using the E-Recruiting Web pages?
    Is there a Function module or a Class or a BAdI that I can use?
    We want to use a Interface that will send a flat fille with a lot of data
    and then to handle it in the same way the SAVE button on E-Recruiting does...
    Any Suggestions?
    Best Regards,
    Eran
    SAVE THE DATE 01-01-2011 ****

    Hi Roman,
    The flat file will come from other systems .
    It will store Requisitions details and the program/interface will have to proccess these records and create or update the infotypes according to them...
    Someone told me that it would be a bad thing to use classes and pointed out that there are FM like RH_* that wiil do the same
    I tried to use FM 'RH_INSERT_INFTY'  just to see if any record was entered ,but nothing happened...
    HRP1000 didn't get the new record
    What did I do wrong? What is the right way? FM's or Classes?
    Best Regards,
    Eran
    DATA: X1000 LIKE P1000 OCCURS 1 WITH HEADER LINE.
    X1000-MANDT = SY-MANDT.
    X1000-PLVAR = '01'.
    X1000-OTYPE = 'NB'.
    X1000-INFTY = '1000'.
    X1000-ISTAT = '1'.
    X1000-BEGDA = sy-datum.
    X1000-ENDDA = '99991231'.
    X1000-LANGU = 'B'.
    X1000-SHORT = 'ERAN'.
    X1000-STEXT = 'ERAN TEST'.
    append x1000.
    * 1. Reset standard authorization
      CALL FUNCTION 'RH_AUTHORITY_CHECK_OFF'.
    * 2. Insert new row into Infotype 1000 for position with new name
    CALL FUNCTION 'RH_INSERT_INFTY'
      EXPORTING
    *   FCODE                     = 'INSE'
        VTASK                     = 'S'
    *   ORDER_FLG                 = 'X'
    *   COMMIT_FLG                = 'X'
    *   AUTHY                     = 'X'
    *   PPPAR_IMP                 =
    *   OLD_TABNR                 = ' '
    *   REPID                     = ' '
    *   FORM                      = ' '
    *   KEEP_LUPD                 =
    *   WORKF_ACTV                = 'X'
      TABLES
        INNNN                     = X1000
    *   ILFCODE                   =
    * EXCEPTIONS
    *   NO_AUTHORIZATION          = 1
    *   ERROR_DURING_INSERT       = 2
    *   REPID_FORM_INITIAL        = 3
    *   CORR_EXIT                 = 4
    *   BEGDA_GREATER_ENDDA       = 5
    *   OTHERS                    = 6
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    COMMIT WORK.
    * 3. Set standard authorization
    CALL FUNCTION 'RH_AUTHORITY_CHECK_ON' .
    SAVE THE DATE 01-01-2011 ****
    More convenient to use, More efficient search , Easier to find...

  • How to save a website using firefox.

    webpage complete is a bunch of different files and
    all files does not include photos.
    I am trying to save my site
    rangeoflight.net
    Thank You.

    If you choose "Web Page, complete", it means only the page as retrieved from the server (plus images, style sheets, and scripts used in the page itself). It does not include changes that occurred to the page after loading or any linked pages.
    What you want depends on your purpose in saving your site.
    If you want an ''exact copy'' of what is on the server, for example, as a backup, you should use an FTP program or similar software that gives you direct access to the files. Depending on your host, they might also have a backup feature in the control panel.
    If you want a portable replica to use offline or copy to a CD, you should look into a category of software known as an "offline browser." I can't recall which ones I've used, but a Google search turns up some products you can evaluate.
    If you want a copy of the site to use in Firefox, you could check out the add-ons Scrapbook and Scrapbook Plus (I'm not sure of the difference between them). There were some add-ons for these add-ons to generate other formats such as Windows HTML help file (CHM), but they haven't been updated for a few months.
    If you want a print capture of the site, you could convert it to PDF. I'm not aware of a "one-shot" way to do that, but there might be an add-on or service.
    (I just played with an add-on that will capture all open tabs to a single PDF. The fonts can be a bit funky, but you could give it a try: [https://addons.mozilla.org/en-US/firefox/addon/print-pages-to-pdf/ Print pages to Pdf :: Add-ons for Firefox].)
    Please let us know whether any of these approaches solves your problem.

  • How to save files by using swing

    how to complete a JFileChooser which I can save the file that I create as we click save button when we are windows.the JFileChooser also have the function that I can choose the path where I want to save my file.thank you

    this is the relevant part from the link
    "A JFileChooser object only presents the GUI for choosing files. Your program
    is responsible for doing something with the chosen file, such as opening or
    saving it."
    so, you open the JFileChooser, select the directory, select the file (or type in a
    new file name) and click save. The rest of the code in your program saves the
    textArea's text to the selected file
    simple demo
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Testing
      JTextArea textArea = new JTextArea(5,10);
      public void buildGUI()
        JButton btnSave = new JButton("Save");
        final JFrame f = new JFrame();
        f.getContentPane().add(new JScrollPane(textArea),BorderLayout.CENTER);
        f.getContentPane().add(btnSave,BorderLayout.SOUTH);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
        btnSave.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent ae){
            JFileChooser fc = new JFileChooser(".");
            int returnValue = fc.showSaveDialog(f);
            if(returnValue == JFileChooser.APPROVE_OPTION)
              java.io.File file = fc.getSelectedFile();
              try
                java.io.FileWriter outStream = new java.io.FileWriter(file);
                textArea.write(outStream);
                outStream.close();
              }catch(Exception e){e.printStackTrace();}
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • How to save report in PersonalCategory  after creating it using java panel?

    Hi,
    Anybody knows How to save report in PersonalCategory  after creating it using java panel?
    I dont want to save it in public folder. I want to save report (webi) in user's personal category.
    can anybody send me source code?
    It will help me a lot.
    Thanks in advance
    Amol Mali

    Hi teda,
    i'm assuming that you have seen my post that i did successfuly save report in user's personal category.
    Actually the report is created in webi java panel using RE SDK and  is saved in Report Sample Folder then i'm saving it in user's personal category by following code
    string query = "Select SI_PERSONAL_CATEGORIES From CI_INFOOBJECTS Where "
                         + "SI_INSTANCE=0 And SI_ID=" + reportID;
                    InfoObjects infoObjects = infoStore.Query(query);
                    InfoObject infoObject = infoObjects[1];
                    Webi wreport = (Webi)infoObject;
                    ObjectRelativeIDs personalIDs = wreport.PersonalCategories;
                /personalIDs.Add(Convert.ToInt32(categoryID));
                   infoStore.Commit(infoObjects);
    But the report is presents in the Folder also and in user's personal category also.
    I dont want the report to be in the folder (Report Sample) if i saved it in user's personal category.
    How can i do that?
    any idea.
    Please help me.
    Thanks in advance
    Amol Mali
    Edited by: amol mali on Jan 9, 2009 7:55 PM

  • Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory

    Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory

    Here are a few Links to a helpful Knowledge Base article and a White Paper that should help you out: http://digital.ni.com/public.nsf/allkb/BBCAD1AB08F1B6BB8625741F0082C2AF and http://www.ni.com/white-paper/10435/en/ . The methods for File IO in Real Time are the same for all of the Real Time Targets. The White Paper has best practices for the File IO and goes over how to do it. 
    Alex D
    Applications Engineer
    National Instruments

  • I want to use Get Panel Image in Labview 5.0.1 and need details on how to save the BMP data generated

    I am trying to generate an application that saves a copy of its front panel on completion. This is easy to do using an invoke node with Print VI to HTML but this does not work in an .exe format. I have seen elsewhere that you have to use the Get Panel Image method, but no details are supplied in LV 5.0.1 documentation of how to use the "image" data (1-D Unsigned Byte array) that is generated. I want to save this in a format that can then be read as a bitmap in any standard graphics package. Any assistance?

    Hi,
    If you'd upgrade to LV5.1 or 6 you could use the 'standard' vi's for this.
    You need a VI called "Write BMP File.vi". It's not shipped with LV5.0.1.
    This vi only uses 3 subVI's, so perhaps someone at NI can convert it and
    send it to you (sorry, I won't, it's copywrited).
    If you cannot get this VI anywhere, you'll need to figure out the BMP file
    format yourself. It's not too complicated, but still could take some days.
    Perhaps someone figured it out before LV5.1 was released.
    Regards,
    Wiebe.
    "RDK" wrote in message
    news:[email protected]..
    > I want to use Get Panel Image in Labview 5.0.1 and need details on how
    > to save the BMP data generated
    >
    > I am trying to generate an application that saves a copy
    of its front
    > panel on completion. This is easy to do using an invoke node with
    > Print VI to HTML but this does not work in an .exe format. I have seen
    > elsewhere that you have to use the Get Panel Image method, but no
    > details are supplied in LV 5.0.1 documentation of how to use the
    > "image" data (1-D Unsigned Byte array) that is generated. I want to
    > save this in a format that can then be read as a bitmap in any
    > standard graphics package. Any assistance?

  • How to save HR data in Active Directory using ABAP i.e thru LDAP Connector

    Hi All,
           Can any one please help me out how
           to save HR data in Active directory
           using LDAP Connector ?             
           Please help ASAP as it is very urgent .
    Thanks
    Jitendra

    There are 100 of such scripts are there online.
    here are few tips and codes. you will get more.  
    https://gallery.technet.microsoft.com/scriptcenter/Feeding-data-to-Active-0227d15c
    http://blogs.technet.com/b/heyscriptingguy/archive/2012/10/31/use-powershell-to-modify-existing-user-accounts-in-active-directory.aspx
    http://powershell.org/wp/forums/topic/ad-import-csv-update-attributes-script/
    Please mark this as answer if it helps

  • How to save hr data in Active directory  using abap

    Hi all
    can any one please help me out how to save hr data in Active directory using LDAP connector
    please help as this is very urgent requirement
    thanks in advance
    Thanks
    Chanti

    What form do you have the user's name in ?
    ANTIPODES\alberteString searchFilter = "(&(objectClass=user)(samAccountName=alberte))";[email protected] searchFilter = "(&(objectClass=user)(userPrincipalName=[email protected]))";Albert EinsteinString searchFilter = (&(objectClass=user)(givenName=Albert)(sn=Einstein))";or using Ambiguous Name Resolution (anr)String searchFilter = "(&(objectClass=user)(anr=Albert Einstein))";or it's even clever enough to useString searchFilter = "(&(objectClass=user)(anr=Einstein Albert))";

Maybe you are looking for

  • Invoking Web Service with array paramter

    Hi, I'm trying to invoke a Java web service having an array as input parameter but it only works if i have only one child or if i chose one specific element with xpath. bpel variables: <variables> <variable name="mergedSupps" element="client:supplier

  • Im trying to place an arrow into iMovie, but picture in picture doesn't appear, replace or insert comes up instead?

    Im trying to place an arrow into iMovie, but picture in picture doesn't appear, replace or insert comes up instead? Im trying to make a highlight video and I cant place an arrow into picture on picture, I used to be able to untill I updated my IOS. A

  • Microsoft Office 2007 free trial

    I have had a ToshibaNB255-N245 for 3 years and have not used or activated the free trial. I do not know if the free trial has expired or how would you activate it is still available? The other thing is the 2007 version still availble if I need to pur

  • Can't link to index.html

    (Domains and project names are redacted.) I am publishing a Doxygen HTML tree using OS X Server (Mountain Lion). I have "Websites" on, and in "Server Website," I have aliased "/MyProject" to "/Users/fritza/Department/Project/docs/html". "index.html"

  • Setting the time in CIMC

    Newbie question.. but how do I set the time in CIMC?