• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

how to set pdf compatibility to ai file or doc?

New Here ,
Sep 29, 2017 Sep 29, 2017

Copy link to clipboard

Copied

how to set pdf compatibility to ai file or doc? I want to convert ai file to pdf file and I have used writeDocument() api. it converts ai file into pdf file but pdf file shows "create pdf compatible file option turned on".

here is my code -

ai::UnicodeString myString(filepath);

ai::FilePath aiFile1(myString);

              

ASErr result = kNoErr;

try

{

     SDK_ASSERT(sAIDocument);

     result = sAIDocument->WriteDocument(aiFile1, fileFormatName, false);    

     aisdk::check_ai_error(result);

}   

catch (ai::Error& ex)

{

      result = ex;

}

Please give answer if anyone knows.

TOPICS
SDK

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Explorer ,
Jan 24, 2018 Jan 24, 2018

Copy link to clipboard

Copied

Use WriteDocumentWithOptions instead of  WriteDocument and pass parameter integer parameter 'pdf ' in additionalOptionsDict

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 15, 2019 May 15, 2019

Copy link to clipboard

Copied

@Xpertios​Can you elaborate on this? I have a hard time understanding how this looks like in code. I'm uncertain what the key and entry in the additionalOptionsDict would look like.

Here's what I have:

    ai::FilePath path(ai::UnicodeString("/tmp/renderDocument.ai"), false);

    AIDictionaryRef additionalOptionsDict;

    sAIDictionary->CreateDictionary(&additionalOptionsDict);

    AIDictKey key = sAIDictionary->Key(kAINativeFileFormat);

    sAIDictionary->SetIntegerEntry(additionalOptionsDict, key, kAINativePDFCompatibilityKey);

    ai::int32 fileFormatOptions = kFileFormatWrite

        | kFileFormatWriteAs

        | kFileFormatNoWarningOption

        | kFileFormatSuppressUI;

    error = sAIDocument->WriteDocumentWithOptions(path,

                                                  kAINativeFileFormat,

                                                  fileFormatOptions,

                                                  additionalOptionsDict,

                                                  false);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 16, 2019 May 16, 2019

Copy link to clipboard

Copied

Try this

                AIDictKey key = sAIDictionary->Key("IntegerValue");

                result = sAIDictionary->SetIntegerEntry(additionalOptionsDict,fIntKey,'pdf ');

                result = sAIDocument->WriteDocumentWithOptions(path, "Adobe Illustrator Any Format Writer", kFileFormatWrite , additionalOptionsDict  , false);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 16, 2019 May 16, 2019

Copy link to clipboard

Copied

This does not seem to work. There's the boolean value missing (how would I express to disable PDF compatibility)?

The main question is: How do I know what the keys and entries are in the additionalOptionsDict?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 16, 2019 May 16, 2019

Copy link to clipboard

Copied

LATEST

You can try write using PlayActionEvent, here is an example

// Initialize param 
AIActionParamValueRef param;
error = sAIActionManager->AINewActionParamValue(&param); 

// Set parameter - where path is ai::UnicodeString, you can get it from ai::FilePath using GetFullPath()
error = sAIActionManager->AIActionSetStringUS(param, kAISaveDocumentAsNameKey, path); 

// Set parameter - Native format writer and extension  (true or false)
error = sAIActionManager->AIActionSetString(param, kAISaveDocumentAsFormatKey, kAINativeFileFormat);
error = sAIActionManager->AIActionSetStringUS(param, 'extn', ai::UnicodeString(kAINativeFileFormatExtension)); 

// Here set PDF compatibility
error = sAIActionManager->AIActionSetBoolean(param, kAINativePDFCompatibilityKey, true); 

// Play Action
error = sAIActionManager->PlayActionEvent("adobe_saveACopyAs", kDialogOff, param); // here you can use other action such as SaveAS or Save

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines