AppleScript to save pdf as pdf-x in Acrobat - pdf

I am currently using Adobe Acrobat Pro DC 2015.23 on macOS Sierra.
My goal is to create AppleScript that do such things:
Open PDF File
Save this file to pdf-x format
Close file
I create AppleScript, that do all steps, but i can't find any documentation how to choose with PDF standard to use while saving.
If I want to do this manually I do following steps:
Open PDF in Adobe Acrobat
Choose PDF Standards Menu
Click (Save as PDF/X)
Press save
The question is how to set PDF/X standard while saving.
My script
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
set theFiles to choose file with prompt "Select the files" of type {"pdf"} with multiple selections allowed
set aaRunning to is_running("Adobe Acrobat")
tell application "Adobe Acrobat"
repeat with theFile in theFiles
open theFile without dialogs
save active doc to theFile
close active doc
end repeat
if not aaRunning then
quit
end if
end tell

As you may have noted, Applescript support of Acrobat is very limited.
Just so, the following possible workflows come to my mind:
a) you can use Preflight Profiles to create PDF/X (this is also the engine if you do it manually). You can run/apply Preflight Profiles using Acrobat JavaScript, and you can run Acrobat JavaScripts using the do script Applscript command.
b) you create a Preflight Droplet which makes an according PDF/X file. You then can use Applescript to open the document (file) in that droplet.
c) you use System Events to control the user interface elements of Acrobat. In other words, you do what you would do manually, but using System Events. You may want to use an utility, such as UI Browser to find the ways to address the various dialog elements.

Related

How to copy only specific page content of pdf to clipboard?

I had tried to copy the whole document(which is in pdf format) to notepad and word but now I want to move at some specific page of document let say 3 and I want to store the content only of that page to the clipboard. Is there any way to do that?
Till all I know is how to store the whole document in the clipboard.
program acrord32
keyboard ⋘ALT⋙⋘DOWN⋙⋘3⋙
keyboard ⋘CTRL+A⋙⋘CTRL+C⋙
♥doc1 = ♥clipboard
Using keyboard CTRL+A in Adobe Acrobat always select ALL text in WHOLE ALL pages.
But there are other options.
This option is available in NOT FREE version in example "Acrobat Standard DC" or "Acrobat Pro DC". Unfortunatelly these versions are paid applications. In these version has function named "Extract pages" and you can specify that each page as separate file. After extraction you have any file with once page and you can using CTR+A :)
But we have alternative option by using google chrome. Open PDF file in google chrome and send file to print with change printer as "Save as PDF". There you can specify page as new file PDF.

Can I ask Acrobat Pro XI to open the PDF document through other applications?

As I need to read help-documentation for Stata, I need to set Acrobat as the default PDF viewer. However, compared to Sumatra, the main drawback is that I can no longer obtain the following menu.
Is there a way to create such menu-entries in Acrobat, so that I can open other PDF editors from Acrobat? The use-case is: first, have Stata open the help-file correctly in Acrobat; and in Acrobat, with this file under view, open the same file (and show the same page, at best) in an external PDF viewer.
Is there a way to create such menu-entries in Acrobat, so that I can open other PDF editors from Acrobat?
No. Acrobat does allow menu items to be added via folder level JavaScript but you can't use it to launch other applications in that way. You can cause PDF files to open, but they'd get opened by the default viewer... which is Acrobat... and defeats your purpose.

Force a webbrowser to display a PDF file only on Adobe Acrobat Reader

I create a PDF with iTextsharp and then I show the preview of the PDF inside a webbrowser control. From the preview the user can SAVE or PRINT using the defaults Adobe Reader's buttons
Working on Windows x64 bits with Adobe Reader as the default PDF viewer everything works fine.
The same program on a Windows x64 bits but with Foxit Reader as the default PDF open the file on Foxit Reader on full application window, outside my program.
I need to manage that.
My code is like
Dim PathToPDF As String
PathToPDF = DirectoryOfMyApp & "\ReportPreview.pdf"
ReportPreviewWebBrowser.Navigate(PathToPDF)
Where DirectoryOfMyApp just gets the C: or D: letter of the hard disk.
I read this link
How to start an Adobe Reader or Acrobat from VB.NET?
but a line like
ReportPreviewWebBrowser.Navigate("acrobat", PathToPDF )
didn´t work and I think the webbrowser control don´t have the option to choose the PDF viewer
https://msdn.microsoft.com/es-es/library/system.windows.forms.webbrowser(v=vs.110).aspx
Is there a way to set the webbrowser to use Adobe Acrobat Reader only or to force any other PDF viewer to show the PDF inside the webbrowser control?
I agree with Zaggler on his comments on this. You are making assumptions at a certain point on software that is installed on an end user's computer. Unless you are going to make the application's PDF viewer be part of a dependency installation or cooked into .NET you cannot guarantee they have that program to use. Nor can you guarantee it's installed location.
However there is a cheap hack for Windows based processes you can do in VB.NET. You can use the ole System.Diagnostics.Process()
Sub Main()
Dim nProcess = New System.Diagnostics.Process()
nProcess.Start($"D:\PdfFile.pdf")
End Sub
In this example I did a quick file location, you can try to ensure it is a valid location that will not change or is in your app's running process folder. This is really low tech as far as development goes, but it is basically saying: "Run me a process, any process, at this location. I don't care what it is, use the Windows defaults to determine what to do with it."
So when I run this on my Windows 10 Dev box it loads up Edge to display it, at home it would fire up Adobe Viewer. It is just opening the file essentially with the OS's choice of what is using that file extension. Not glamorous or very good for hardened code but it works when you want something quick to happen.
No, you can't do this.
You can't even guarantee that Adobe Reader is installed at all.
Reader might not even exist on the machine. It's not built into Windows, and not everyone uses it. Even if it is, FoxIt isn't the only alternative. A big one is that Chrome includes it's own PDF viewer.

How to open the PDF files in Powerbuilder windows application

I saved the datawindow in PDF format using SAVEAS method and I want to open the saved file in Acrobat reader. But in web application after save as method using Downloadfile() i'm able to open it. I think using OLEobject it is possile but i don't know how to do that. Any suggestions ?
If you just want to view the document (ie, no interaction with your PowerBuilder application) you can use the 'RUN' command.
Example:
RUN('C:\temp\mydoc.pdf')
This will open the file using whichever program is associated with .pdf files within your Windows settings.
We simply use the Internet context service to open the PDF URL:
inet l_inet
string ls_url
// set ls_url to the URL to open
GetContextService("Internet", l_inet)
l_inet.HyperlinkToURL(ls_url)

Prevent users from opening PDFs in Reader

We use a LiveCycle form, but don't utilize Reader Extensions as all of our internal users should have Adobe Pro installed. However, there are a handful (often new employees or people working from new systems), that either don't have Pro installed yet or have Adobe Reader opening PDFs by default.
Is there any way to either prevent a form from opening in Reader, or determine when a PDF is opened with Reader and display a message? The latter is ideal, as we could direct our users to see IT staff to install Pro.
This should be possible, see this link: http://www.serhatdundar.com/javascript-inside-pdf-detect-browser-acrobat-reader-version for more information.
Basically the link confirms that it is possible in Javascript (running within Reader or Acrobat) to detect which variation of the application is being used. Given that you can create PDF files with an "open script" - a script run when the file is being opened, that should answer your question.
Put an open script in all of your PDF forms.
User opens the PDF, the script is run.
The script then does the following:
Check application variation to detect Reader (as opposed to Pro)
Show dialog box with appropriate information if the variation is Reader.