Splitting PDFs within a page
-
- PlatinumLounger
- Posts: 5536
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Splitting PDFs within a page
I have a number of (almost) identical PDF pages, in separate one-page files, where I want just the top third (or so) of each page.
All the PDF splitters I've come across seem to split at page boundaries.
I don't have Adobe Acrobat, and the PDFs seem to have been set to prevent cut-and-paste.
Can anyone point me at an online method of extracting just the section I want from every page, please?
Otherwise I shall have to do something messy with Print Screen and Paint -> Crop...
All the PDF splitters I've come across seem to split at page boundaries.
I don't have Adobe Acrobat, and the PDFs seem to have been set to prevent cut-and-paste.
Can anyone point me at an online method of extracting just the section I want from every page, please?
Otherwise I shall have to do something messy with Print Screen and Paint -> Crop...
John Gray
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
-
- Administrator
- Posts: 79676
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- PlatinumLounger
- Posts: 5536
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Re: Splitting PDFs within a page
Not in Word 2010, I'm afraid, otherwise that would be ideal, since I want to put each third-page into a 2 x 4 Word table to reduce printing...
John Gray
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
-
- Administrator
- Posts: 79676
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Splitting PDFs within a page
Time to upgrade to a recent version of Office...
Or use LibreOffice Writer (free)
Or use LibreOffice Writer (free)
Best wishes,
Hans
Hans
-
- GoldLounger
- Posts: 2599
- Joined: 24 Jan 2010, 15:26
- Location: Olympia, WA
Re: Splitting PDFs within a page
Have you tried a screen shot and then OCR that?
I am so far behind, I think I am First
Genealogy....confusing the dead and annoying the living
Genealogy....confusing the dead and annoying the living
-
- PlatinumLounger
- Posts: 5536
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Re: Splitting PDFs within a page
Then I will probably use LibreOffice on one of my Linux distros.
Each PDF contains a bar code, which I need to preserve.
Thanks!
Each PDF contains a bar code, which I need to preserve.
Thanks!
John Gray
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
-
- Administrator
- Posts: 79676
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Splitting PDFs within a page
You seem unusually usual to me...John Gray wrote:Do I seem more unusual than usual?
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 5536
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Re: Splitting PDFs within a page
Thank you!
Or maybe not...
John Gray
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
-
- Administrator
- Posts: 79676
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- Administrator
- Posts: 12856
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Splitting PDFs within a page
It is trivially easy to remove password protection from a PDF file. I won't describe how here, but a quick internet search should show you how.
StuartR
-
- 3StarLounger
- Posts: 213
- Joined: 02 Feb 2010, 23:58
Re: Splitting PDFs within a page
You may like to try NAPS2.
Just drag and drop your pdf on the application. Crop out the areas you don't need and save.
You may want to duplicate the page before editing in case you need the other areas of the page.
There are other neat features like OCR (different languages) as well as pdf settings that you may want to implement when you want to share a pdf.
It is a freeware scanning software.
Just drag and drop your pdf on the application. Crop out the areas you don't need and save.
You may want to duplicate the page before editing in case you need the other areas of the page.
There are other neat features like OCR (different languages) as well as pdf settings that you may want to implement when you want to share a pdf.
It is a freeware scanning software.
-
- PlatinumLounger
- Posts: 5536
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Re: Splitting PDFs within a page
Thanks, Stuart and especially jolas!
The NAPS2 PDF software, although not entirely intuitive and with some scaling annoyances, enabled me to crop each single PDF page and save the resultant "top third" of the page as a JPEG, and insert it into a Word 2010 2x4 table cell, for subsequent printing!
The NAPS2 PDF software, although not entirely intuitive and with some scaling annoyances, enabled me to crop each single PDF page and save the resultant "top third" of the page as a JPEG, and insert it into a Word 2010 2x4 table cell, for subsequent printing!
John Gray
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
A car crashed into a barrier at speed; nobody was injured, but a front wheel became detached, and slowly rolled down the road.
Driver [sings]: "You picked a fine time to leave me, Loose Wheel"
-
- 2StarLounger
- Posts: 116
- Joined: 10 Oct 2022, 02:52
Re: Splitting PDFs within a page
Dear All,
I received a merge file including payslips. I tried to split payslips using below VBA code & there is a specific number in a particular place on every payslip. I hope to use this exact number as the file name (Eg. 37224.pdf) can anyone help me.
Option Explicit
Sub pdf()
Dim Acro_app As Acrobat.AcroApp
Dim Acro_PDDoc As Acrobat.AcroPDDoc
Dim Acro_NewPDDoc As Acrobat.AcroPDDoc
Set Acro_app = New Acrobat.AcroApp
Set Acro_PDDoc = New Acrobat.AcroPDDoc
Acro_PDDoc.Open "C:\Users\User\Desktop\PDF\Slip.pdf"
Dim i As Integer
For i = 0 To Acro_PDDoc.GetNumPages() - 1
Set Acro_NewPDDoc = New Acrobat.AcroPDDoc
Acro_NewPDDoc.Create
Acro_NewPDDoc.InsertPages -1, Acro_PDDoc, i, 1, 1
Acro_NewPDDoc.Save 1, "C:\Users\User\Desktop\PDF\S" & i & ".pdf"
Next i
End Sub
Thanks,
Priyan
I received a merge file including payslips. I tried to split payslips using below VBA code & there is a specific number in a particular place on every payslip. I hope to use this exact number as the file name (Eg. 37224.pdf) can anyone help me.
Option Explicit
Sub pdf()
Dim Acro_app As Acrobat.AcroApp
Dim Acro_PDDoc As Acrobat.AcroPDDoc
Dim Acro_NewPDDoc As Acrobat.AcroPDDoc
Set Acro_app = New Acrobat.AcroApp
Set Acro_PDDoc = New Acrobat.AcroPDDoc
Acro_PDDoc.Open "C:\Users\User\Desktop\PDF\Slip.pdf"
Dim i As Integer
For i = 0 To Acro_PDDoc.GetNumPages() - 1
Set Acro_NewPDDoc = New Acrobat.AcroPDDoc
Acro_NewPDDoc.Create
Acro_NewPDDoc.InsertPages -1, Acro_PDDoc, i, 1, 1
Acro_NewPDDoc.Save 1, "C:\Users\User\Desktop\PDF\S" & i & ".pdf"
Next i
End Sub
Thanks,
Priyan
You do not have the required permissions to view the files attached to this post.
-
- Microsoft MVP
- Posts: 1347
- Joined: 24 May 2013, 15:33
- Location: Warminster, PA
Re: Splitting PDFs within a page
I know almost nothing about the Acrobat object model, but I was able to follow the example in the first reply to https://stackoverflow.com/questions/297 ... -using-vba and got this to work.
The main thing that was missing was the AcroAVDoc object, which is used to open the PDF file. Then the AcroPDDoc object is assigned the result of the .GetPDDoc function of the AcroAVDoc. (I have no idea why it works this way.)
Code: Select all
Sub pdf()
Dim strPath As String
Dim Acro_app As Acrobat.AcroApp
Dim acro_AVDoc As Acrobat.AcroAVDoc
Dim Acro_PDDoc As Acrobat.AcroPDDoc
Dim Acro_NewPDDoc As Acrobat.AcroPDDoc
strPath = "C:\Users\User\Desktop\PDF\"
Set Acro_app = New Acrobat.AcroApp
Set acro_AVDoc = New Acrobat.AcroAVDoc
If acro_AVDoc.Open(strPath & "Slip.pdf", "") = True Then
Set Acro_PDDoc = acro_AVDoc.GetPDDoc
Dim i As Integer
For i = 0 To Acro_PDDoc.GetNumPages - 1
Set Acro_NewPDDoc = New Acrobat.AcroPDDoc
Acro_NewPDDoc.Create
Acro_NewPDDoc.InsertPages -1, Acro_PDDoc, i, 1, 1
Acro_NewPDDoc.Save 1, strPath & "S" & i & ".pdf"
Acro_NewPDDoc.Close
Next i
Acro_PDDoc.Close
Else
MsgBox "Open failed"
End If
acro_AVDoc.Close wdDoNotSaveChanges
Set Acro_PDDoc = Nothing
Set acro_AVDoc = Nothing
Set Acro_app = Nothing
End Sub
-
- 2StarLounger
- Posts: 116
- Joined: 10 Oct 2022, 02:52
Re: Splitting PDFs within a page
Dear Jay Freedman,
Thanks your guidance,
I want to capture the number or text at a specific position in each separated pdf page (Eg. Like the third word in the second line) and name the separated file based on it. For that, is there a possibility to capture the number or text in the relevant position by using a method of Finding the exact X and Y coordinates and then refer it to a variable?
Thanks,
Priyantha
Thanks your guidance,
I want to capture the number or text at a specific position in each separated pdf page (Eg. Like the third word in the second line) and name the separated file based on it. For that, is there a possibility to capture the number or text in the relevant position by using a method of Finding the exact X and Y coordinates and then refer it to a variable?
Thanks,
Priyantha
-
- Microsoft MVP
- Posts: 1347
- Joined: 24 May 2013, 15:33
- Location: Warminster, PA
Re: Splitting PDFs within a page
Using XY coordinates to locate specific text is not appropriate for PDF documents of the type in your sample Split.pdf file. That approach would be necessary if the PDF was created by scanning a paper document, because that kind of PDF contains only a picture of the original text. Extracting readable text from that picture would require optical character recognition (OCR) software.
Fortunately, Split.pdf and files like it are created from text generated by a program such as Word or a database, and the PDF contains readable text in addition to non-readable formatting information. That means the text can be extracted directly from the PDF -- for example, the document can be opened in Word (any version from 2013 onward) and a macro can "read" it.
I found that opening Split.pdf itself in Word doesn't start new pages in the same way that Acrobat Reader does, so you do need to split the file into separate files, one per page, before opening each resulting file in Word or another editor. (By the way, what Office program are you using to run the macro you posted?) The macro can then continue by searching the open document for the line's label, such as EMP. NO., followed by a tab and the employee number, and using the employee number to rename the file.
Fortunately, Split.pdf and files like it are created from text generated by a program such as Word or a database, and the PDF contains readable text in addition to non-readable formatting information. That means the text can be extracted directly from the PDF -- for example, the document can be opened in Word (any version from 2013 onward) and a macro can "read" it.
I found that opening Split.pdf itself in Word doesn't start new pages in the same way that Acrobat Reader does, so you do need to split the file into separate files, one per page, before opening each resulting file in Word or another editor. (By the way, what Office program are you using to run the macro you posted?) The macro can then continue by searching the open document for the line's label, such as EMP. NO., followed by a tab and the employee number, and using the employee number to rename the file.
You do not have the required permissions to view the files attached to this post.
-
- 2StarLounger
- Posts: 116
- Joined: 10 Oct 2022, 02:52
Re: Splitting PDFs within a page
Dear Jay Freedman,
I am using office 2016
I am using office 2016