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

Printing only first page of multiple PDF's

Guest
Jan 20, 2013 Jan 20, 2013

Copy link to clipboard

Copied

I need to be able to process a stack of PDF documents.

What I need: to always print-out only the first page of all documens.

These are invoices with sometimes 5 pages, sometimes 2....but I only need to archive the frontpage.

So: opening each of these maybe 100 documents and always only print the first page manually seems a bit like "nonsense" to me.

Could do this on a friends machine who has an Acrobat Pro X installed.

Help appreciated

Anna

TOPICS
Print and prepress

Views

48.5K

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

correct answers 1 Correct answer

Community Expert , Jan 20, 2013 Jan 20, 2013

This can be done in Acrobat Pro using an Action. Create a new Action with

the following JavaScript command:

this.print(false,0,0,true);

This will silently print the first page of all the files you will run this

Action on (to the last used printer).

Votes

Translate

Translate
Community Expert ,
Jan 20, 2013 Jan 20, 2013

Copy link to clipboard

Copied

This can be done in Acrobat Pro using an Action. Create a new Action with

the following JavaScript command:

this.print(false,0,0,true);

This will silently print the first page of all the files you will run this

Action on (to the last used printer).

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
Guest
Jan 20, 2013 Jan 20, 2013

Copy link to clipboard

Copied

Great! Many thanks

Is there actually a kind of marketplace for Javascipts for Adobe Acrobat Pro somewhere? ...

Really useful!

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
Community Expert ,
Jan 20, 2013 Jan 20, 2013

Copy link to clipboard

Copied

You're welcome!

I have a website where I sell many custom-made scripts that I've made for

Acrobat, but I was asked not to publish it here...

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
Guest
Jan 20, 2013 Jan 20, 2013

Copy link to clipboard

Copied

ok 😕 too bad. can you PM?

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
Community Expert ,
Jan 20, 2013 Jan 20, 2013

Copy link to clipboard

Copied

Sure... You can also google my handle-name and you'll find it.

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 ,
Apr 30, 2013 Apr 30, 2013

Copy link to clipboard

Copied

Thank you very much.

Is there also a way to print the first and last pages of multiple PDF's?

Also is there a general formula for this?


Thanks!

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
Community Expert ,
Apr 30, 2013 Apr 30, 2013

Copy link to clipboard

Copied

Yes, like this:

this.print({ bUI: false, nStart: 0, bSilent: true});

this.print({ bUI: false, nStart: this.numPages-1, bSilent: true});

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 ,
Apr 30, 2013 Apr 30, 2013

Copy link to clipboard

Copied

Thanks for your response.

Could you show a few examples?

How would I ask Acrobat to print just the last pages of several PDF's?

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
Community Expert ,
Apr 30, 2013 Apr 30, 2013

Copy link to clipboard

Copied

Use the code I just provided in an Action. It will print the first and last pages of each PDF that you process.

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
Community Beginner ,
Jan 10, 2017 Jan 10, 2017

Copy link to clipboard

Copied

Is there a different command to save these to PDFs instead of sending them to the printer?

I tried setting my default printer as Adobe, but that didnt work with " this.print(false,0,0,true); "

Thanks for your help in advance!

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
Community Expert ,
Jan 10, 2017 Jan 10, 2017

Copy link to clipboard

Copied

Yes, it's possible to do that using the extractPages method, but you need to specify what file-name to use for each file.

The basic syntax would be something like this:

this.extractPages(0, 0, this.path.replace(/\.pdf$/i, "_first page.pdf"));

The code above will save the first page of each file into the same folder as the original, adding the "_first page" suffix to the file-name.

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
Community Beginner ,
Jan 10, 2017 Jan 10, 2017

Copy link to clipboard

Copied

Thanks for your response!

This is what i did to work around:

1. Install CutePDF as a PDF printer, and print an individual file to prompt Adobe.

2. then ran the script you provided (slightly modified to print the first 2 pages - I feel like a genius here cuz I have absolutely no programming knowledge)

this.print(false,0,1,true);

Adobe prompts me a "Save as" window to save the file names, and since I need them to be the same, its working like a charm!!!

Thanks a lot man - mad props!

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 ,
Feb 17, 2020 Feb 17, 2020

Copy link to clipboard

Copied

Try67, thanks very much for posting that script.  It reflects exactly what I need to do for many thousands of pdfs.  I've downloaded a trial of Acrobat Pro to see if I can get it to work (not being an Acrobat or Java Script expert by any means).  Unfortunately when I create an action based on executing the Java Script you provided, a "Javascript Editor" pops open aslomg me to "put script title here."  Which seems odd since I'm running an action called Extract 1st pages.  Any idea where the problem is?  Thanks!  Markjava.jpg

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 ,
Jan 15, 2020 Jan 15, 2020

Copy link to clipboard

Copied

I used your scipt to print 1st page of multiple pdfs. It worded for awhile now printing whole file. /* this.print(false,0,0,true); */

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 ,
Jan 15, 2020 Jan 15, 2020

Copy link to clipboard

Copied

or won't print at all!

 

 

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 ,
Oct 10, 2022 Oct 10, 2022

Copy link to clipboard

Copied

Hi there, I have tried the JavaScript, it works well, just that each document I have choose "print current page" then I have to click "print" - is not run automatically? Is it possible to make run automatically?

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
Community Expert ,
Oct 11, 2022 Oct 11, 2022

Copy link to clipboard

Copied

From where are you running it, exactly? It should be silent, if you used the code I posted.

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 ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

Hi , thanks for your reply.

firstly, I allocated all documents in a folder. then I open the action Wizard, then I choose the action. after that,

each PDF will pop up automatically. but i have to choose the first page (I only need to print the first page of each dcument). It save some time in opening each PDF, but i still have to choose " print current page", then " Print. please let me know if I have missed any steps? Thank you,

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
Community Expert ,
Oct 18, 2022 Oct 18, 2022

Copy link to clipboard

Copied

What commands did you add to your Action?

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 ,
Oct 19, 2022 Oct 19, 2022

Copy link to clipboard

Copied

this.print(false,0,0,true);

this is the action I added 

 

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
Community Expert ,
Oct 20, 2022 Oct 20, 2022

Copy link to clipboard

Copied

LATEST

Do you want to print the current page, or the first page?

If the latter, try the code I provided above:

this.print({ bUI: false, nStart: 0, bSilent: true});

Also, make sure there are no other commands in your Action beside the one that executes this code.

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 ,
Jul 05, 2017 Jul 05, 2017

Copy link to clipboard

Copied

Hi there, does anyone know a code that can be implied within a macro in Outlook to print all the pages except for the last one of a PDF?

The code I current have to print PDF's from an email is:

Sub OpenDossierFolder()

Dim sPath

Dim iReply As String

iReply = InputBox("Dossiernummer:")

If iReply = "" Then

Exit Sub

Else

sPath = "\\nlsvfil001\trismd\Trisdigdocs\" & iReply & "\"

Shell "C:\Windows\Explorer.exe """ & sPath & "", vbNormalFocus

End If

End Sub

Sub SaveEmailAttachmentsToFolder(OutlookFolderInInbox As String, _

ExtString As String, DestFolder As String)

Dim ns As NameSpace

Dim Inbox As MAPIFolder

Dim SubFolder As MAPIFolder

Dim Item As Object

Dim Atmt As Attachment

Dim FileName As String

Dim MyDocPath As String

Dim I As Integer

Dim wsh As Object

Dim fs As Object

Dim sDate As Date

Dim aDate As String

On Error GoTo ThisMacro_err

Set ns = GetNamespace("MAPI")

Set Inbox = ns.GetDefaultFolder(olFolderInbox)

Set SubFolder = Inbox.Folders(OutlookFolderInInbox)

I = 0

' Check subfolder for messages and exit of none found

If SubFolder.Items.Count = 0 Then

MsgBox "There are no messages in this folder : " & OutlookFolderInInbox, _

vbInformation, "Nothing Found"

Set SubFolder = Nothing

Set Inbox = Nothing

Set ns = Nothing

Exit Sub

End If

'Create DestFolder if DestFolder = ""

If DestFolder = "" Then

Set wsh = CreateObject("WScript.Shell")

Set fs = CreateObject("Scripting.FileSystemObject")

MyDocPath = wsh.SpecialFolders.Item("mydocuments")

DestFolder = MyDocPath & "\" & Format(Now, "dd-mmm-yyyy hh-mm-ss")

If Not fs.FolderExists(DestFolder) Then

  1. fs.CreateFolder DestFolder

End If

End If

If Right(DestFolder, 1) <> "\" Then

DestFolder = DestFolder & "\"

End If

' Check each message for attachments and extensions

For Each Item In SubFolder.Items

For Each Atmt In Item.Attachments

If LCase(Right(Atmt.FileName, Len(ExtString))) = LCase(ExtString) Then

sDate = Item.SentOn

aDate = Format(sDate, "yyyymmddhhmm")

FileName = DestFolder & aDate & Item.SenderName & " " & Atmt.FileName

  1. Atmt.SaveAsFile FileName

I = I + 1

End If

Next Atmt

Next Item

' Show this message when Finished

If I > 0 Then

' MsgBox "De PDF bestanden staan in de map: " _

' & DestFolder, vbInformation, "Finished!"

Else

MsgBox "No attached files in your mail.", vbInformation, "Finished!"

End If

' Clear memory

ThisMacro_exit:

Set SubFolder = Nothing

Set Inbox = Nothing

Set ns = Nothing

Set fs = Nothing

Set wsh = Nothing

'Set DestFolder = Nothing

Exit Sub

' Error information

ThisMacro_err:

MsgBox "An unexpected error has occurred." _

& vbCrLf & "Please note and report the following information." _

& vbCrLf & "Macro Name: SaveEmailAttachmentsToFolder" _

& vbCrLf & "Error Number: " & Err.Number _

& vbCrLf & "Error Description: " & Err.Description _

, vbCritical, "Error!"

Resume ThisMacro_exit

'-----------------------------------------

End Sub

Sub Saveattachementstofolder()

Dim ns As NameSpace

Dim Inbox As MAPIFolder

Dim SubFolder As MAPIFolder

Dim Msg As MailItem

Dim Messages As Selection

Dim ObjFolder As Outlook.Folder

Dim oMailItem As MailItem

Dim myCopiedItem As Outlook.MailItem

Dim x As Object

Dim olDestFolder As Outlook.MAPIFolder

Dim strFilelocation As String

strFilelocation = "C:\Facturen\"

On Error Resume Next

Kill (strFilelocation & ("*.*"))

On Error GoTo 0

Set ns = Application.GetNamespace("MAPI")

Set Inbox = ns.GetDefaultFolder(olFolderInbox)

Set SubFolder = Inbox.Folders("Facturen printen")

Set ObjFolder = SubFolder

'Set ObjFolder = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Folders("Facturen printen")

Set Messages = ActiveExplorer.Selection

If Messages.Count = 0 Then

Exit Sub

End If

'-----------------------------------------

For Each Msg In Messages

  1. Msg.Move ObjFolder

Next

'-----------------------------------------

If Dir(strFilelocation, vbDirectory) = vbNullString Then

MkDir strFilelocation

End If

SaveEmailAttachmentsToFolder "Facturen printen", "", "C:\Facturen"

Shell "Explorer.exe /e,C:\Facturen", vbNormalFocus

Set olDestFolder = ns.GetDefaultFolder(olFolderInbox)

Set olDestFolder = olDestFolder.Folders("RIO RINTO")

Set olDestFolder = olDestFolder.Folders("Rio Tinto INVOICES")

Set ns = Nothing

Set Inbox = Nothing

Set SubFolder = Nothing

'-----------------------------------------

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

For Each Msg In ObjFolder.Items

  1. Msg.Move olDestFolder

Next

'-----------------------------------------

Set ns = Nothing

Set Inbox = Nothing

Set SubFolder = Nothing

Set Msg = Nothing

Set Messages = Nothing

Set ObjFolder = Nothing

Set oMailItem = Nothing

Set myCopiedItem = Nothing

Set x = Nothing

Set olDestFolder = Nothing

'Set strFilelocation = Nothing

End Sub

Sub batfile()

Dim batPath As String: batPath = "C:\bat\"

Call Shell(Environ$("COMSPEC") & " /c " & batPath & "\batchprint.bat", vbNormalFocus)

End Sub

Thanks in advance!

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