Quantcast
Channel: Adobe Community : All Content - Acrobat SDK
Viewing all 2571 articles
Browse latest View live

How to remove only unused embedded fonts using PDF Library

$
0
0

I'm not sure it's the correct forum however I didn't find a forum specific for PDF Library. If there is one, I would love to get a link to it.

 

Now to the question(s).

 

I have an automated c# process that's optimizing pdf files that's coming from multiple sources using PDF Library:

 

    using (Library library = new Library())

    {

        using (PDFOptimizer optimizer = new PDFOptimizer())

        {

            SetOptimizerOptions(optimizer);

            try

            {

                optimizer.Optimize(new Document(sourceFile), targetFile);

            }

            catch(Datalogics.PDFL.LibraryException e)

            {

                throw new PdfException(e);

            }                   

        }

    }

 

    private void SetOptimizerOptions(PDFOptimizer optimizer)

    {

        optimizer.SetOption(OptimizerOption.MergeDuplicateFonts, true);

        optimizer.SetOption(OptimizerOption.DiscardUnusedForms, true);

        optimizer.SetOption(OptimizerOption.Linearize, true);

        optimizer.SetOption(OptimizerOption.SubsetAllEmbeddedFonts, true);

        optimizer.SetOption(OptimizerOption.RemoveAllBase14Fonts, true);

        optimizer.SetOption(OptimizerOption.RemoveAllEmbeddedFonts, RemoveEmbeddedFonts);

        optimizer.SetOption(OptimizerOption.DiscardOutputIntent, DiscardOutputIntent);

        optimizer.SetOption(OptimizerOption.DiscardStructureTrees, DiscardStructureTrees);

    }

 

 

Some of them are using embedded fonts, some do not.

 

1. Is there a way to find out if embedded fonts are used in the document?

2. Is there a way to remove only embedded fonts that are not used? (I didn't see an OptimizeOption for that)?


How to convert rgb image to cmyk?

$
0
0

I tried 2 methods, none of them worked.

 

1:

  1.     AVDoc avDoc = AVAppGetActiveDoc();
  2.     PDDoc pdDoc = AVDocGetPDDoc(avDoc);
  3.     PDColorConvertParams colorParams = (PDColorConvertParams) calloc( 1 , sizeof(PDColorConvertParamsRec) ); 
  4.     PDColorConvertAction colorConvertAction = (PDColorConvertAction) calloc( 1 , sizeof( PDColorConvertActionRec ) ); 
  5.     ASBool pageChanged = false; 
  6.     AC_Profile  workingProfile;  
  7.     ACGetWorkingSpaceProfile  (kACWorkingCMYK, &workingProfile); 
  8. //Populate the PDColorConvertAction data members 
  9.     colorConvertAction[0].mMatchAttributesAny = -1;//kColorConvObj_AnyObject; 
  10.     colorConvertAction[0].mMatchSpaceTypeAny = -1;//kColorConvAnySpace; 
  11.     colorConvertAction[0].mMatchIntent= AC_UseProfileIntent; 
  12.     colorConvertAction[0].mConvertIntent = AC_UseProfileIntent; 
  13.     colorConvertAction[0].mConvertProfile= workingProfile; 
  14.     colorConvertAction[0].mEmbed = true
  15.     colorConvertAction[0].mPreserveBlack = true
  16.     colorConvertAction[0].mUseBlackPointCompensation= true
  17.     colorConvertAction[0].mAction = kColorConvConvert; 
  18.     colorConvertAction[0].mIsProcessColor = false
  19.     colorParams->mActions = colorConvertAction; 
  20.     colorParams->mNumActions = 1; 
  21.     colorParams->mInks = NULL; 
  22.     colorParams->mNumInks = 0; 
  23.     pageChanged = false; 
  24.     PDDocColorConvertPage( pdDoc , colorParams , 0 , NULL , NULL , 0 , NULL , &pageChanged ); 

 

2:

  1. AVDoc avDoc = AVAppGetActiveDoc();
  2. PDDoc pdDoc = AVDocGetPDDoc(avDoc);
  3. int pageCount = PDDocGetNumPages(pdDoc);
  4. for(int i=0;i<pageCount;i++)
  5. {
  6.     PDPage page = PDDocAcquirePage(pdDoc, i);
  7.     PDEContent pdeContent = PDPageAcquirePDEContent(page, gExtensionID);
  8.     ASInt32 elementCount = PDEContentGetNumElems(pdeContent);
  9.     for(int j=0;j<elementCount;j++)
  10.     {
  11.         PDEElement e = PDEContentGetElem(pdeContent, j);
  12.         ASInt32 t = PDEObjectGetType(e);
  13.         if(t == kPDEImage)
  14.         {
  15.             PDEImage pdeImage = (PDEImage)element;
  16.             PDEColorSpace space = PDEImageGetColorSpace(pdeImage);
  17.             ASAtom spaceName = PDEColorSpaceGetName(space);
  18.             if(std::string(ASSAtomGetString(spaceName)) == "DeviceCMYK")
  19.             {
  20.                 PDEColorSpace cmyk = PDEColorSpaceCreateFromName(ASAtomFromString("DeviceCMYK"));
  21.                 PDEImageSetColorSpace(pdeImage, cmyk);
  22.             }
  23.         }
  24.     }
  25.     PDPageSetPDEContent(page, gExtensionID);
  26.     PDPageNotifyContentsDidChange(page);
  27.     PDPageReleasePDEContent(page, gExtensionID);
  28.     PDPageRelease(page)
  29. }

How to use VBA to make PDF of select worksheets in Excel

$
0
0

This seems like a simple one, but I've had some difficulty finding examples. I have Adobe Acrobat DC installed, and the Acrobat Addin for Excel. I'd like to convert say 3 of 5 worksheets in my Excel workbook into a PDF using VBA (and replace me having to do this manually). Hopefully this is easy to do.

DC 2017.012.20095 and plug-in tools

$
0
0

We have seen a new issue with Acrobat Pro DC 2017.012.20095 and multiple plug-ins. We are aware that it affects plug-ins from multiple vendors.

 

The plug-ins add tools which appear in the tool pane, can be added to the right hand pane, and appear as options in Quick Tools. So long as Tabbed mode is selected, this works as in previous updates to DC.

 

However, starting with this update, if tabs are switched off in Preferences, the plug-in tools do not appear in the tools pane, right hand pane, quick tools selection, or quick tool bar. They return if tabs are switched back on. The plug-in remains installed and active, with menu items that it added still working normally whether or not tabs are activated.

 

Does anyone have any info on this?

How to create outlines?

$
0
0

In illustrator, i can create outline for text.

How should I do the same in Acrobat SDK?

View an Oracle BLOB object

$
0
0

I save a PDF into an Oracle BLOB Object in C#.net using ODP.  I read the data into an OracleBlob object using pdf.pdfDoc = (dr.IsDBNull(1)) ? null : dr.GetOracleBlob(1);

How do I view this object so that it looks like a PDF?? 

How do I turn off "document preparation" in Acrobat XI?

$
0
0

I think I may have accidently turned on an option a few months ago and I want to turn it off.   It appears that, whenever I open a PDF, Acrobat starts to prepare the document for something.  There is a window that pops up on my screen almost immediately after opening that says, "Please wait while document is being prepared."  It then shows the page numbers as it "prepares" the document.   It normally only takes 5-10 seconds to prepare a 10-page document, but a long document can be very disruptive.  I am given the option to cancel the process, but this often locks up Acrobat and I have to close the app.

 

What is going on and can I stop it.  Should I stop it?  I don't really know what it is doing.   I have noticed that the window that displays the above message does not indicate which application the message is coming from, so it is possible it is not an Adobe message.

 

Thank you.

How to flatten transparency using Acrobat SDK(C++)?

$
0
0

I want to convert text to outline.

Step 1: add wartermark.

Step 2: flatten transparency.

 

I can't find a function that can flatten transparency.


AcroPDF.dll failure

$
0
0

When making a calll into the AcroPDF library to display a PDF within a client window, a failure occurs within the AcroPDF.dll file causing the program to crash

Using excel macro to run JS code in Acrobat Pro

$
0
0

I have an interesting question. I have an excel sheet that generates a pretty complicated JS script for Acrobat based on a bunch of user inputs in the spreadsheet. I wrote an excel VBA macro that takes this script, opens the desired PDF, opens the JS console, and pastes the code generated code in the console. However, I can't figure out how to actually run this code once it's in the console. Any ideas? Is it possible to make my VB excel macro force Acrobat to execute a JS?

 

So far this is what I have. My code is in column 1, anywhere from 10-500 lines long which is why I did the If statement in the loop to remove blank cells. How do I make the console execute the code?

 

Sub Open_Acrobat()

Dim OpenDoc As String

Dim gApp As AcroApp

Dim gPDDoc As Acrobat.AcroPDDoc

Dim jso As Object

 

 

OpenDoc = Application.WorksheetFunction.Concat(Cells(2, 3).Value, "\", Cells(2, 2).Value, ".pdf") 'This line generates the filepath of the doc to open

Set gApp = CreateObject("AcroExch.App")

Set gPDDoc = CreateObject("AcroExch.PDDoc")

 

  If gPDDoc.Open(OpenDoc) Then

    Set jso = gPDDoc.GetJSObject

    jso.console.Show

    jso.console.Clear

    For i = 1 To 500

        If Cells(i, 1).Value = "" Then Exit For

        jso.console.println (Cells(i, 1).Value)

    Next i

    gApp.Show

End If

 

 

End Sub

Adobe Reader. Password security block call replaced save as function.

$
0
0

I have replaced save function

 

 gcbAVAppSaveDialog = (void*) ASCallbackCreateReplacement(AVAppSaveDialogSEL, AdobePluginHelper::AdobeAppSaveDialog); 
 REPLACE(gAcroViewHFT, AVAppSaveDialogSEL, gcbAVAppSaveDialog); 

 

And when i set password security (In adobe acrobat 2015 with last updates) then open this document in Adobe Reader DC standard Adobe dialog appears instead of replaced dialog.
I set breakpoint in my function and it not reachable (i mean Adobe for some reason omit my function and calls self implemented func)

VBA Code error with Adobe Acrobat 10 Type Library

$
0
0

Hi,

 

I have some code I created in Word VBA to combine several separate PDFs into a single PDF.  The code works fine with the Adobe Acrobat 9.0 Type Library and Adobe Reader 9.0 installed.

 

But, with the Adobe Acrobat 10 Type Library and Adobe Reader 10 installed, the code fails at the marked code below.  Any suggestions??

 

    Dim acrobatApp As Acrobat.acroApp

    Set acrobatApp = CreateObject("AcroExch.App")

 

 

    Dim mainPDF As Acrobat.AcroPDDoc

    Set mainPDF = CreateObject("AcroExch.PDDoc")  ****THIS IS WHERE THE CODE STOPS WITH A "TYPE MISMATCH" ERROR****

   

    Dim nextPage As Acrobat.AcroPDDoc

    Set nextPage = CreateObject("AcroExch.PDDoc")

       

    Dim numPages As Integer

   

    'Loop through all selected VLS, and add each one to the end of the main PDF

    For i = 0 To lstSelected.ListCount - 1

        mainPDF.Open CurDir & "\" & Replace(ThisDocument.Name, ".doc", "") & ".pdf"

        numPages = mainPDF.GetNumPages

        nextPage.Open lstSelected.List(i)

       

        If mainPDF.InsertPages(numPages - 1, nextPage, 0, nextPage.GetNumPages, True) = False Then

            MsgBox "Cannot insert pages"

        End If

       

        If mainPDF.Save(PDSaveFull, CurDir & "\" & Replace(ThisDocument.Name, ".doc", "") & ".pdf") = False Then

            MsgBox "Cannot save"

        End If

       

        'MsgBox lstSelected.List(i)

        nextPage.Close

    Next i

PDF optimizer.

$
0
0

Does anyone know if the PDF Optimizer provided in Acrobat Pro XI can be called as an API from another application program? If the API exists where can it be obtained?

 

[Moved to Acrobat SDK forum... Mod]

tag tree appearance

$
0
0

How do I decrease the white space leading in the tag tree? With the August 2017 automatic update to Adobe Acrobat Pro DC Version 17.012.20095.42964, the tag tree suddenly got expanded using a lot of white space leading. This negatively impacts me because now I can only view about 27 lines of tags. Last month, I could see about 50. This means I now need to spend a lot more time scrolling up and down in order to see tags. This is not acceptable. Whoever thought this was a good idea was wrong. It's a bad idea. I'm a production person in Acrobat. I can't waste all this time. When I telephoned Adobe, the heavily-accented girl told me there was no way. And, she told me there is no way to go back to the previous version. Help!!! Please. Someone. Hello? Thanks [sniff sniff]

MenuItemExecute("Scan") doesn't work with Acrobat 2017

$
0
0

I've used the following code in VBA for years since Acrobat 9.  I had a new user of the application that had Acrobat 2017 Standard installed and it doesn't run the scan command.

 

Set gpdfApp = CreateObject("AcroExch.App")

gpdfApp.MenuItemExecute("Scan")

 

I did some debugging and I could make the MenuItemExecute("Scan") work if I opened a document in Acrobat first but it doesn't seem to work right when Acrobat launches.

 

Is there any code I could add/change to make this work for me?


Doc.submitForm MissingArgError: Missing required argument.

$
0
0

I am trying to have an html button post a message to my pdf file that will then submit the pdf file to a url

 

So far I have the html button posting the message to the pdf but when it tries to submit I get the error MissingArgError: Missing required argument.

 

Here is the onMessage code snippet

 

function myOnMessage(message)

{

     global.url = message[0];

     try

     {

          submitForm({

               cUrl: global.url,

               cSubmitAs: "PDF",

               cPermID: docID[0],

               cInstID: docID[1],

               cUsageRights: submitFormUsageRights.RMA});

     }

     catch(e)

     {

          app.alert(e.toString());

     }

}

 

Thoughts?

ExportAsFDF is not exporting all the annotation if run using IAC

$
0
0

Hi Expert,

 

I am new to IAC development, I have written one c# utility which will take pdf and extract the annotation from it and save it to some local drive.

 

Below is my code:

__________________________________________________________________________________________ ____________

          String fileName = "D:/test.pdf";

          

            Acrobat.CAcroPDDoc pdDoc;

        

            pdDoc = new AcroPDDoc();

            if(pdDoc == null)

            throw new Exception("Failed to create Acrobat PDDoc object.");

 

            // Open the source PDF document

            bool rc = pdDoc.Open(fileName);

           

            object jsObj = pdDoc.GetJSObject();

            Type T = jsObj.GetType();

            object[] arg = { "false","false","null","false","/D/mytesting.fdf","true"};

            T.InvokeMember("exportAsFDF", BindingFlags.InvokeMethod | BindingFlags.Public |BindingFlags.Instance,null, jsObj, arg);

          

__________________________________________________________________________________________ _____________________

 

What happening is it is generating the fdf file but it is not having any content in it.

 

can you please guide me what I am doing wrong, also what is the approach to export annotation using c#.

 

Any help would be appreciated.

Text Extraction from Native PDF

$
0
0

Hi,

 

Adobe PDF version may keep varying depends on the customer..

Hardware - VM Server with good configuration

 

Requirement / Scenario (PDF may be application form based or native text which is generated by the system)

  1. Tabular data without border (border less)
  2. Checkbox data in all different forms
  3. special characters
  4. Text inside the Image
  5. Free text (like signature)

 

Solution Tried:

 

We are using C# code through which we have tried to read the data from the PDF for the above scenario and didn't get the expected output.

we used ITextSharper library and used the same from C# to extract the content.

 

Any other library or suggestion would be really helpful.

Adobe Document Cloud 'Create PDF' service

$
0
0

I want to convert scanned pdf (images) to pdf files. Do we have any sdk / api for Adobe Document Cloud which I can use to call the 'Create PDF' service

Acrobat Printer output file and path set through the VS C++ Program

$
0
0

Hi all,

We install Acrobat (either standard or the pro version) on WIN 7 or WIN 10. By default window creates an "Adobe PDF" printer. When our application (written in C++ using VS2015), prints to the default printer, in this case "Adobe PDF"; normally the print dialog comes up and you can specify name and folder location for the PDF output. I can disable the Print Dialog box and system uses the default applications window title. There are various options in Acrobat to setup folder path and other features of the Acrobat. But, I like to configure the output file name and path through our application.

 

I have downloaded and spent many hours reading.... no luck yet. Could somebody point me to the right direction.

 

Any help is appreciated,

 

..Terry

Viewing all 2571 articles
Browse latest View live