Questions tagged [pdf-manipulation]
56 questions
84
votes
5 answers
Documentation for using JavaScript code inside a PDF file
Where can I find documentation on running JavaScript code inside a PDF?
I've never added a JavaScript action inside a PDF document. However, I've done quite a bit of web development using JavaScript. I have a few questions to whoever has any…

Sam
- 26,946
- 12
- 75
- 101
25
votes
9 answers
How to convert a PDF to grayscale from command line avoiding to be rasterized?
I'm trying to convert to grayscale this PDF: https://dl.dropboxusercontent.com/u/10351891/page-27.pdf
Ghostscript (v 9.10) with pdfwrite Device fails with a "Unable to convert color space to Gray, reverting strategy to LeaveColorUnchanged."…

Panda
- 275
- 1
- 4
- 7
15
votes
1 answer
Manipulating fillable PDFs in Elixir/Erlang
I've been trying to find example functionality in Elixir or Erlang for taking a fillable PDF and then filling it with input data from an application.
So far I haven't been able to find any solutions to this in either Elixir or Erlang.
Does anyone…

Jack Carlisle
- 1,085
- 1
- 9
- 15
14
votes
5 answers
Parsing a PDF with no /Root object using PDFMiner
I'm trying to extract text from a large number of PDFs using PDFMiner python bindings. The module I wrote works for many PDFs, but I get this somewhat cryptic error for a subset of PDFs:
ipython stack…

Louis Thibault
- 20,240
- 25
- 83
- 152
10
votes
4 answers
Change metadata of pdf file with pypdf2
I want to add a metadata key-value pair to the metadata of a pdf file.
I found a several years old answer, but I think this is way to complicated. I guess there is an easier way today: https://stackoverflow.com/a/3257340/633961
I am not married with…

guettli
- 25,042
- 81
- 346
- 663
7
votes
1 answer
How to concatenate multiple pdf as one, each input pdf starting on an even page?
DUPLICATE OF How can I merge PDF files (or PS if not possible) such that every file will begin in a odd page?
I have a serie of documents, each one with an unpredictable number of pages.
Say :
a.pdf (1 page : A1)
b.pdf (3 pages : B1, B2, B3)
c.pdf…

Elvex
- 656
- 5
- 22
7
votes
7 answers
Merge Multiple PDF's into one PDF
I am having some issues with my code. I am trying to loop through a Drive folder that contains many PDFs and then merge these into one file. When I use my code it just creates a PDF for the last PDF in the Drive folder and not merge them all…

user1518316
- 83
- 1
- 1
- 5
5
votes
1 answer
ImageMagick pdf to black and white pdf
I would like to convert a pdf file to a Black and White PDF file with ImageMagick. But I've got two problems:
I use this command:
convert -colorspace Gray D:\in.pdf D:\out.pdf
But this command convert only the FIRST page... How to convert all…

szuniverse
- 1,076
- 4
- 17
- 32
4
votes
3 answers
wrong encode when update pdf meta data using ghostscript and pdfmark
I have a base pdf file, and want to update the title into Chinese (UTF-8) using ghostscript and pdfmark, command like below
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=result.pdf base.pdf pdfmarks
And the pdfmarks file (encoding is UTF-8…

Larry Cai
- 55,923
- 34
- 110
- 156
4
votes
2 answers
Calculating the exact positions of(Td, TD, Tm, cm, T*) content stream in pdf?
Getting or calculating the exact positions of(Td, TD, Tm, cm, T*) content stream in pdf?
As a human I am able to calculate(whether it is replacing last Td or adding to last Td or multiplication with fontsize) the positions of tags in pdf content…

SuperNova
- 25,512
- 7
- 93
- 64
4
votes
3 answers
Splitting single page into two pages with ghostscript
I have a pdf with something like presentations slides and multiple slides per page. How can I use ghostscript to split the file so that there is one slide per page?

howard
- 644
- 2
- 7
- 15
3
votes
3 answers
Crop PDF & add margins
I have a PDF with a CropBox size of 6" wide x 9" high. I need to add it to a standard letter-sized PDF. If I change the CropBox size, then the cropmarks become visible. So ideally what I'd like to do is crop out just the visible portion of the page,…

Jordan Reiter
- 20,467
- 11
- 95
- 161
2
votes
1 answer
PDF File Manipulation (open a large pdf file, find a keyword, then save in which page was found, and then split those pages and merge them in one pdf)
I'm working on a project for a friend of mine.
I want to find one specific keyword that is on multiple pages, and it has duplicates on other places on a large PDF file (40-60 pages and above) then save in memory in what page the keyword was found,…

gemgr
- 55
- 7
2
votes
2 answers
Edit or remove PDF header information in C
I need to edit the header information of several PDF files.
What I'd like to achieve is to remove all header data before %PDF-X.Y.Z.
What I came up with as a possible solution was to open the PDF in binary mode, read each character until %PDF-X.Y.Z…

Dominik
- 117
- 1
- 1
- 10
2
votes
4 answers
Best way to change pagination of existing PDF
We have a PDF that is generated as A5 landscape pages.
With that, we need to do a PDF with A4 portrait page format, by putting 2 pages of the source PDF on top of each other on each page of the result PDF.
Do you know a good library that could do…
Peter Fox