Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Exporting XFA PDF from within Portfolio

Avatar

Level 10

Hi,

I have a series of XFA forms (designed in LC DS ES) which are then grouped in an Acrobat Portfolio (Acrobat 9 Pro Ext).

I want to have the ability to "export" any one form from the portfolio by the user clicking a button.

While Acrobat has a menu item to "Save File from Portfolio", I do not want to use this as I want to lock fields after the form has been saved out of the portfolio.

I have tried exportDataObject, but without success. Also tried getting the form open in a new window, but no joy!

In summary, I want to script a button that when the user clicks it, will open that particular form in a new window; lock certain fields and then save the form outside of the portfolio (leaving the original form intact and unaltered).

Any ideas?

Thanks,

Niall

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Ok I have figured out what is going on. In a later version there is a list of acceptable execMenuItems that can be used. If the menu command is not on the list then it cannot be used (for security reasons). So our idea of getting the attachment out via this method will not work. I do not see a way to do this until they expose Portfolio commands in the Javascript world. This also explains why some of your commands worked and some did not. Here is the sanctioned list of MenuItems:

Close

GeneralInfo

Quit

FirstPage

PrevPage

NextPage

LastPage

ActualSize

FitPage

FitWidth

FitHeight

SinglePage

OneColumn

TwoPages

TwoColumns

ZoomViewIn

ZoomViewOut

ShowHideBookmarks

ShowHideThumbnails

Print

GoToPage

ZoomTo

GeneralPrefs

SaveAs

FullScreen

OpenOrganizer

Scan

Web2PDF:OpnURL

AcroSendMail:SendMail

Spelling:Check Spelling

PageSetup

Find

FindSearch

GoBack

GoForward

FitVisible

ShowHideToolbarEditing

ShowHideToolbarCommenting

ShowHideToolbarEdit

ShowHideToolbarFile

ShowHideToolbarFind

ShowHideToolbarForms

ShowHideToolbarMeasuring

ShowHideToolbarData

ShowHideToolbarPageDisplay

ShowHideToolbarNavigation

ShowHideToolbarPrintProduction

ShowHideToolbarRedaction

ShowHideToolbarBasicTools

ShowHideToolbarTasks

ShowHideToolbarTypewriter

PropertyToolbar

ShowHideArticles

ShowHideFileAttachment

ShowHideAnnotManager

ShowHideFields

ShowHideOptCont

ShowHideModelTree

ShowHideSignatures

InsertPages

ExtractPages

ReplacePages

DeletePages

CropPages

RotatePages

AddFileAttachment

FindCurrentBookmark

BookmarkShowLocation

GoBackDoc

GoForwardDoc

DocHelpUserGuide

HelpReader

rolReadPage

HandMenuItem

ZoomDragMenuItem

Annots:Tool:InkMenuItem

CollectionHome

CollectionDetails

CollectionPreview

CollectionShowRoot

View solution in original post

13 Replies

Avatar

Former Community Member

You may have no choice but to use the menu item to get the file out of the portfolio. You coudl use the command app.execmenuItem("SaveFileFrom Portfolio"). If you go this route I will have to determine the exact syntax fro that command. This will not allow you to lock out the fields unless you create some sort of flagging mechanism to  indicate that this is being opened from the portfolio. Then on initialize you could check the flag and act accordingly.

The access to the portfolio via javascript is limited at this point in time.

Hope that helps

Paul

Avatar

Level 10

Thanks very much Paul,

I would be interested in getting the app.execmenuItem("SaveFileFrom Portfolio") to work and would appreciate if you could iron out the syntax.

How would the form "know" that it is being opened from within a portfolio and not as a standalone document?

I'll start thinking about the flags.

Thanks again,

Niall

Avatar

Former Community Member

I have a script which will dump out all of the menu names to use in a field so that you can get the one you want.

Here is my sample.

Paul

Avatar

Level 10

Hi Paul,

Sample is not showing up as "queued". Is it possible to attached it again or forward to niall.odonovan@assurehsc.ie

Thanks very much!

Niall

Avatar

Level 10

Thanks very much Paul,

I have identified "ExtractFilesFromPackage" as the menu item I need; however when I script a button in LC it does not work when the form is part of a portfolio (attached).

app.execMenuItem("ExtractFilesFromPackage");

It is getting past this line, without result. There are no errors showing up in the Javascript Console.

Any ideas?

Thanks,

Niall

Avatar

Correct answer by
Former Community Member

Ok I have figured out what is going on. In a later version there is a list of acceptable execMenuItems that can be used. If the menu command is not on the list then it cannot be used (for security reasons). So our idea of getting the attachment out via this method will not work. I do not see a way to do this until they expose Portfolio commands in the Javascript world. This also explains why some of your commands worked and some did not. Here is the sanctioned list of MenuItems:

Close

GeneralInfo

Quit

FirstPage

PrevPage

NextPage

LastPage

ActualSize

FitPage

FitWidth

FitHeight

SinglePage

OneColumn

TwoPages

TwoColumns

ZoomViewIn

ZoomViewOut

ShowHideBookmarks

ShowHideThumbnails

Print

GoToPage

ZoomTo

GeneralPrefs

SaveAs

FullScreen

OpenOrganizer

Scan

Web2PDF:OpnURL

AcroSendMail:SendMail

Spelling:Check Spelling

PageSetup

Find

FindSearch

GoBack

GoForward

FitVisible

ShowHideToolbarEditing

ShowHideToolbarCommenting

ShowHideToolbarEdit

ShowHideToolbarFile

ShowHideToolbarFind

ShowHideToolbarForms

ShowHideToolbarMeasuring

ShowHideToolbarData

ShowHideToolbarPageDisplay

ShowHideToolbarNavigation

ShowHideToolbarPrintProduction

ShowHideToolbarRedaction

ShowHideToolbarBasicTools

ShowHideToolbarTasks

ShowHideToolbarTypewriter

PropertyToolbar

ShowHideArticles

ShowHideFileAttachment

ShowHideAnnotManager

ShowHideFields

ShowHideOptCont

ShowHideModelTree

ShowHideSignatures

InsertPages

ExtractPages

ReplacePages

DeletePages

CropPages

RotatePages

AddFileAttachment

FindCurrentBookmark

BookmarkShowLocation

GoBackDoc

GoForwardDoc

DocHelpUserGuide

HelpReader

rolReadPage

HandMenuItem

ZoomDragMenuItem

Annots:Tool:InkMenuItem

CollectionHome

CollectionDetails

CollectionPreview

CollectionShowRoot

Avatar

Level 10

Thanks Paul,

I have tested and all (bar a few) work.

Niall

Avatar

Former Community Member

Hi, I'm trying to use the 'SearchResults -> Next Hit [Old]     'SearchSubmenu -> FindAgain' [New]

Out of all these:

Find

FindSearch

SearchSubmenu

FindAgain

FindPrevious

Only 'FindSearch' works from javascript -

None of others worked on Adobe 9 Pro:

For example:

app.execMenuItem("FindAgain")

did not work and no errors on debugger,

Please let me know, how I will be able to get to the next search item and previous search item from app.execMenuItem

I even tried these two to include with priv restrictions:

app.beginPriv();

app.endPriv();

Please help...

Thanks

Avatar

Level 10

Hi,

Here is a PDF form I did to test the various scripts to access menu items. Some worked, while others didn't. It is clear that where a menu item is not available in Acrobat (when viewing an XFA form) is not going to work in script either. Others though, like "FindAgain" should work, but don't for some reason.

Hope that helps,

Niall

ps I don't think the issue is security that would require a privileged context.

ps Looking again at the sanctioned list from Paul, "FindAgain" is not on the list, so explains why this does not work??

Avatar

Former Community Member

Hi Niall,

Thanks a lot for your quick reply on this two week pending problem.

I'm attaching the zip file that contains the two required files to view a pdf in a browser through html.

History: I'm working on this to help a old aged home where they have touch screens and it is very difficult for some to identify a pdf tool bar button or use their pdf's efficiently.

So, I was thinking about it for over six months and started two weeks back to really help them. Though I did not expect that it is going to make me purchase pdf 9 pro. I did. But, even after that with all these hours working on this, I could not get this working.

I got few samples from Jeff's

http://www.adobe.com/devnet/air/ajax/quickstart/scripting_pdf.html

I did use these files and trying to get that only feature which is 'Find Next' and 'Find Previous'. In fact tried almost all 'AcroSrch.....  es

In the html, I have hard coded a search string 'lorem' with #search=lorem..., I plan to get a new search string from other html page. I will do it later.

As per Jeff, I had that 'Edit java Script' inlcuded in the pdf file.

If you get a chance please check the attachment.

If "FindAgain" is not on the Paul's list,

IS THERE ANY OTHER WAY IN THIS WHOLE WORLD TO GET THIS 'FIND NEXT' and 'FIND PREVIOUS' to work? OR ANY OTHER IDEAS THAT WOULD GET THIS WORKING. THANKS A LOT. OR ATLEAST IN OLDER VERSIONS, IF POSSIBLE, ANY IDEAS THAT WOULD BE MOST WELCOME

Avatar

Level 10

Hi,

I have no experience in html, so won't be much help there.

I tried settign up buttons in an AcroForm (PDF with buttons and fields) instead of going into LiveCycle Designer. However I didn't have much luck there either.

I tried javascript and excuting a menu item, but findAgain and findPrevious are not available on that list either:

In Acrobat you can press Control+J to see the javascript console. I noticed an error:

this.hostContainer has no properties
68:Document-Level:myOnMessage

So I went digging and see that you inserted document level script. I am not sure what this is doing but you may want to have a look at this.The Acrobat SDK and Javascript guides are available on the Adobe web site. One thing that caught my eye was that there may be security issues with communication between containers.

I don't see why findAgain and findPrevious are now restricted (presumably for security reasons??), when find is accessible.

If you don't get any other replies in this thread, maybe you could start a new thread on this and the Acrobat forums.

Good luck,

Niall

Avatar

Former Community Member

Hi Niall, thanks a lot for all your time and suggestions,

I will definitely go through each one of it, Indeed i did go through some of them in these two weeks, I have to still look into them until this issue becomes a solution to those...

Also, i will try to post the same in

http://forums.adobe.com/community/acrobat/acrobat_scripting

forum.

In the mean time, if you can think of any ideas which can make this happen, it can be any even to buy some additional software or option to add some buttons in pdf itself that can do the job or sending the keyboard shortcuts commands like 'Ctrl+G' and 'Shift+Ctrl+G' [which does the same like 'FindNext' 'FindPrevious'] to the pdf object from the html button action would help,

Please let me know,

Thanks a lot,

Ben

==========================

Hi Niall, Just now, I did start a new discussion, hope I get some more eyes on this, thanks for your suggestion:

http://forums.adobe.com/thread/510327

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----